I set up a simple asterisk server on a debian server.
My goal is to make two android phones call each other, using voice and later video, on my asterisk server. Actually they are connected via 3G/4G network, and I use imsDroid softphone.
I can make both phones call each other, I can answer the call on both ends.
But I can't hear anything nor see any video.
I'm a beginner using SIP protocol and asterisk. I may have configured asterisk or the softphones badly.
Do you know how to resolve this issue ? Or even how to debug it ? Thanks!
sip.conf:
[general]
context=internal
allowguest=no
allowoverlap=no
bindport=5060
bindaddr=0.0.0.0
srvlookup=no
disallow=all
allow=ulaw
alwaysauthreject=yes
canreinvite=no
nat=yes
session-timers=refuse
localnet=192.168.1.0/255.255.255.0
[7001]
type=friend
host=dynamic
secret=123
context=internal
[7002]
type=friend
host=dynamic
secret=456
context=internal
extensions.conf:
[internal]
exten => 7001,1,Answer()
exten => 7001,2,Dial(SIP/7001,60)
exten => 7001,3,Playback(vm-nobodyavail)
exten => 7001,4,VoiceMail(7001#main)
exten => 7001,5,Hangup()
exten => 7002,1,Answer()
exten => 7002,2,Dial(SIP/7002,60)
exten => 7002,3,Playback(vm-nobodyavail)
exten => 7002,4,VoiceMail(7002#main)
exten => 7002,5,Hangup()
exten => 8001,1,VoicemailMain(7001#main)
exten => 8001,2,Hangup()
exten => 8002,1,VoicemailMain(7002#main)
exten => 8002,2,Hangup()
modules.conf:
[modules]
autoload=no
load=pbx_config.so
load=chan_sip.so
load=chan_iax2.so
load=res_rtp_asterisk.so
load=app_hangup.so
load=app_dial.so
load=codec_ulaw.so
load=codec_gsm.so
Resolved !
I had to configure externip=my.external.ip in sip.conf, because I'm running asterisk behind a NAT !
I also added h263 codec to make video work, and added videosupport=yes in sip.conf
Related
Hello my èxtensions_conf`, this is a queue;
exten => 1,1,NoOp(call for call center)
same => n,Set(__OTHERCHANNEL=${CHANNEL})
;same => n,Set(CHANNEL(hangup_handler_push)=call-center,csh,1(args))
same => n,Dial(SIP/trunk/XXXXXXXXX,,tTG(msg,1))
exten => msg,1,Goto(anum,1)
exten => msg,2,Goto(cnum,1)
exten => anum,1,BridgeWait()
exten => anum,n,NoOp("after bridgewait")
exten => cnum,1,Playback(hello)
exten => cnum,n,Set(CHANNEL(hangup_handler_wipe)=call-center,csh,1(args))
exten => cnum,n,WaitExten(100)
exten => csh,1,Verbose(0)
same => n,AGI(test.py,${ORIGCHANNEL},${OTHERCHANNEL})
same => n,Return()
;same => n,AGI(test.py,${ORIGCHANNEL})
exten => #,1,NoOp(press #)
same => n,Bridge(${ORIGCHANNEL})
exten => 9,1,AGI(test.py,${ORIGCHANNEL})
same => n,Hangup()
My test.py;
#!/usr/bin/env python3
import sys
from asterisk.agi import AGI
agi = AGI()
if sys.argv[2]:
agi.env['agi_channel'] = sys.argv[2]
agi.hangup(channel=sys.argv[1])
I want to when answered press 9key hangup answered and caller channel. This works fine. But when answered hangup phone, my agi script running in hangup handler does not hangup the caller's channel. Give me RESULT_LINE: 511 Command Not Permitted on a dead channel or intercept routine error. I can try change to àgi_channel`but this not work. How to can fix this problem. How to hangup caller after hangup answered. Thanks for reply.
Since DeadAGI and AGI is now same application, that behavour is normal one.
You are responsible for detect channel is hanguped, for example you can check Dial command response code or issue CHANNEL(state) check.
I need to make a voice translation service on active calls like skype, for that purpose I need to record voice from caller and whisper the translated voice to callee and vise-versa
I need to add to the dialplan lines to playback audio to the other channel with lower voice but current playback app doesn't have this option
any solution for that?
this is my code below
[macro-speech]
;;Speech recognition demo:
;exten => s,1,Answer()
exten => s,1,agi(googletts.agi,"Say something in English, when done press the pound key.",en)
exten => s,n(record),agi(speech-recog.agi,en-us)
exten => s,n,Verbose(1,Script returned: ${confidence} , ${utterance},en-us)
;Check the probability of a successful recognition:
exten => s,n(success),GotoIf($["${confidence}" > "0.6"]?playback:retry)
;Playback the text:
exten => s,n(playback),agi(googletts.agi,"The text you just said was...",en)
exten => s,n,agi(googletts.agi,"${utterance}",en)
;------------- Translate to different languages
;Translate a text string from english to german:
exten => s,n,agi(googletranslate.agi,"${utterance}",de)
exten => s,n,agi(googletts.agi,"${gtranslation}",de)
;------------------------------------------------
exten => s,n,goto(record)
;Retry in case speech recognition wasn't successful:
exten => s,n(retry),agi(googletts.agi,"Can you please repeat more clearly?",en)
exten => s,n,goto(record)
exten => s,n(fail),agi(googletts.agi,"Failed to get speech data.",en)
exten => s,n(end),Hangup()
freepbx11*CLI> core show function VOLUME
-= Info about function 'VOLUME' =-
[Synopsis]
Set the TX or RX volume of a channel.
[Description]
The VOLUME function can be used to increase or decrease the 'tx' or 'rx' gain
of any channel.
For example:
Set(VOLUME(TX)=3)
Set(VOLUME(RX)=2)
Set(VOLUME(TX,p)=3)
Set(VOLUME(RX,p)=3)
[Syntax]
VOLUME(direction[,options])
[Arguments]
direction
Must be 'TX' or 'RX'.
options
p: Enable DTMF volume control
[See Also]
Not available
freepbx11*CLI>
I used these commands for save CallerID in database :
exten => s,1,MYSQL(Connect connid localhost root 123456 CallerID)
exten => s,2,Set(idcaller=${CALLERID(name)})
exten => s,3,MYSQL(Query resultid ${connid} INSERT INTO CallerID SET Num="${idcaller}")
exten => s,4,MYSQL(Disconnect ${connid})
Now i want to execute these commands when extension is ringing ...
It means that first IVR works then the diall extension Id then these Commands have to work ...
where i have to put my commands ?
thanks alot .
You can't do anything on ringing state, it is not implemented in asterisk
You can do that when extension entered before dial - just put that before dial command like
exten => 100,1,MYSQL(Connect connid localhost root 123456 CallerID)
exten => 100,2,Set(idcaller=${CALLERID(name)})
exten => 100,3,MYSQL(Query resultid ${connid} INSERT INTO CallerID SET Num="${idcaller}")
exten => 100,4,MYSQL(Disconnect ${connid})
exten => 100,n,Dial(SIP/100,,ro)
NOTE, MYSQL command is depricated. User func_odbc or realtime.
To do something when extension is ringing you have to use AMI interface and write your own application using it to detect ringing state and write it to database (or do anything else you like).
https://wiki.asterisk.org/wiki/pages/viewpage.action?pageId=4817239
I am using confBridge in my asterisk for conferencing. I want to detect if number of user remain less than or equal to 1 in ongoing call then terminate the conference call.
I have tried this-
exten => ConfTest,1,System(asterisk -rx "confbridge kick ${DB(CONF/NUM)} ${DB(CONF/ConfTest)}")
exten => ConfTest,n,Set(DB(CONF/ConfTest)=${CHANNEL})
exten => ConfTest,n,Set(ID=${RAND(1,500)})
exten => ConfTest,n,Set(DB(CONF/NUM)=${ID})
exten => ConfTest,n,Set(target=ConfTest1)
exten => ConfTest,n,Originate(SIP/${target},app,confBridge,${ID},default_user)
exten => ConfTest,n,Set(target=ConfTest2)
exten => ConfTest,n,Originate(SIP/${target},app,confBridge,${ID},default_user)
exten => ConfTest,n,Macro(dialout-trunk-predial-hook-test)
exten => ConfTest,n,confbridge(${ID},,src_user)
exten => ConfTest,n,Answer()
exten => ConfTest,n,Set(i=1)
exten => ConfTest,n,While($[${i} = 1])
exten => ConfTest,n,GoToIf($[0${CONFBRIDGE_INFO(parties,${ID})} <= 1]?18:15)
exten => ConfTest,n,NoOp(number of participants in conference call = ${CONFBRIDGE_INFO(parties,${ID})})
exten => ConfTest,n,Wait(1000)
exten => ConfTest,n,EndWhile()
exten => ConfTest,n,System(asterisk -rx "confbridge kick ${DB(CONF/NUM)} ${DB(CONF/ConfTest))
here lines are not executing from while loop.
Is there any thing available to register hangup handler for all the channel involve in conference call.
For example-
debianpc08*CLI> confbridge list 1
Channel User Profile Bridge Profile Menu CallerID
============================= ================ ================ ================ ================
SIP/ConfTest1-0000009c default_user default_bridge ConfTest1
SIP/ConfTest2-0000009d default_user default_bridge ConfTest2
SIP/ConfTest3-0000009b src_user default_bridge ConfTest3
here i want to register hangup handler for all the channels like SIP/ConfTest1-0000009c.
You can use default hangup handler(h-extension) to catch that
;record situation
exten => ConfTest,n,Set(HANGUP_OK=NO)
exten => ConfTest,n,confbridge(${ID},,src_user)
; if user exit confbridge, clear it
exten => ConfTest,n,Set(HANGUP_OK=YES)
; if hanguped in confbridge, do something
exten => h,1,GotoIF($[ "${HANGUP_OK}" == "NO" ]?dosomething,s,1)
You are going the wrong about it. Your best choice for this task would be to use Asterisk ARI and the bridges API. The idea will be very simple, initiate a Stasis application to handle your bridge, put the channels into the bridge. As they come in and out of the bridge, listen to the WebSocket events to see who left and who came in.
You can have a look at http://www.phpari.org for additional information on how to write such an application, the demo dial application should give you ample information on how to do it.
Nir
I did like this :
1. install red5,asterisk
2. setting environment variable, such as java, apache-ant
3. configure sip.conf at asterisk
4. Running Red5phone
It's successfully registered, but when I call between two client the Red5phone ended calling and shows that Busy or Rejected?
I don't have any idea about it. What must I do?
thanks in advance.
My sip.conf configuration :
[general]
enabled=yes
bindaddr =0.0.0.0
context=lain-lain
allowoverlap=no
srvlookup=yes
[1000]
username=1000
secret=1234
host=dynamic
disallow=all
qualify=yes
type=peer
context=digium
allow=alaw
allow=ulaw
[1001]
username=1001
secret=1234
host=dynamic
disallow=all
qualify=yes
type=peer
context=digium
allow=alaw
allow=ulaw
my extensions.conf :
[globals]
[general]
autofallthrough=yes
[lain-lain]
[digium]
exten => 1000,1,Dial(SIP/1000)
exten => 1001,1,Dial(SIP/1001)
include => internal
include => remote
[internal]
# This is how we get to our voicemail. Dial 123 from any SIP connected phone.
exten => 123,1,Answer()
exten => 123,2,VoiceMailMain(0203123456)
exten => 123,3,Hangup()
# If we’re trying to call any extension that starts with the number 2 and has 4 digits only, assume internal.
exten => _2XXX,1,NoOp()
exten => _2XXX,n,Dial(SIP/${EXTEN},30)
exten => _2XXX,n,Playback(the-party-you-are-calling&is-curntly-unavail)
exten => _2XXX,n,Hangup()
[remote]
# Anything that isn’t internal we send to the PSTN.
exten => _X!,1,NoOp()
exten => _X!,n,Dial(SIP/siptrunk/${EXTEN})
exten => _X!,n,Hangup()
[incoming]
# This is where calls coming in from the PSTN are directed – see context setting in sip.conf
exten => _X.,1,NoOp()
# Try and call the desktop and mobile. If this fails, direct to voicemail.
exten => _X.,n,Dial(SIP/jamesdesktop)
exten => _X.,n,Dial(SIP/jamesmobile)
exten => _X.,n,VoiceMail(0203123456,u)
exten => _X.,n,Hangup()
First, thanks to #gnxtech3 for your attention
finally, I make it. the solution is about configuration at module.conf
i put this line of code at my module.conf :
[modules]
.
.
load = app_dial.so
dont forget to reload asterisk.