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.
Related
My plan is to dial a number and when the call get connected, join that call to the Conference room (565601),
but I do not have any idea how to do it.
I have tried this dial plan but it not works
exten => 800,1,dial(PJSIP/4141233908080249372127#US-VOS-Out)
exten => 800,n,ConfBridge(565601)
The second priority is executed when call ends - So nobody is joining the confbridge.
Just use the dial flag G and join each ( caller and callee ) to the confbridge...
exten => 800,1(join_conf_call),dial(PJSIP/4141233908080249372127#US-VOS-Out,,G(2))
exten => 800,2(join_caller),ConfBridge(565601)
exten => 800,3(join_callee),ConfBridge(565601)
The Logic: After call is established caller goto priority 2 and callee to priority 2+1
Second example
exten => 800,1(join_conf_call),dial(PJSIP/4141233908080249372127#US-VOS-Out,,G(2))
exten => 800,2(caller_wait),wait(5)
exten => 800,3(join_callee_first_then_caller),ConfBridge(565601)
The Logic: After call is established caller jumps to priority 2 and wait 5 seconds before joining in priority 3. Callee jumps directly to priority 3.
Last but not least...
exten => 800,1(join_conf_call),dial(PJSIP/4141233908080249372127#US-VOS-Out,,G(2))
exten => 800,2(caller_bye),hangup(16)
exten => 800,3(join_only_callee),ConfBridge(565601)
The Logic: The caller pushes callee to confbridge and leave the show (hangup) - This is usefull in cases caller wants only to join the callee to others in conference
I would like to call a phone, hangup and call an another phone from the server.
Like this :
Server->Phone A->Hangup->Server->phone B
This is what I already tried :
[appel]
exten => a,1,Answer
[do something]
exten => 2,1,Goto(pasCharge)
[pasCharge]
exten => [do something]
exten => ce,2,Dial(SIP/vincent)
exten => [doSomething]
exten => ce,3,Hangup
I have the first call (appel) but not the second (centre). It just hangup after the first.
Could you help me please ?
If you want dialplan be able continue after hangup of first call, you shoudl add g option to dial param
pro-sip.net> core show application Dial
-= Info about application 'Dial' =-
.....
[Syntax]
Dial(Technology/Resource[&Technology2/Resource2[&...]][,timeout[,options[,URL]]])
....
g: Proceed with dialplan execution at the next priority in the current
extension if the destination channel hangs up.
To build on what #arheops was saying, adding the lowercase g in the Dial() command instructs Asterisk that when the called party hangs up, continue to execute commands in the current context at the next priority.
So you could do something like this:
[pasCharge]
exten => ce,2,Dial(SIP/vincent,g)
exten => ce,3,Dial(SIP/Vbourdon,g)
exten => ce,4,[doSomething]
This would dial vincent then Vbourdon, and your doSomething could be a Goto, etc, anything you like.
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 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.