Asterisk context configuration - asterisk

I have three contexts on my asterisk configuration and I want to configure it.
This is my extensions.conf with my users :
[agent]
exten => 100,1,NoOp(Communication en cours)
exten => 100,n,Dial(SIP/legende,10)
exten => 100,n,Hangup()
exten => 200,1,NoOp(Communication en cours)
exten => 200,n,Dial(SIP/malotru,10)
exten => 200,n,Hangup()
[sources]
exten => 300,1,NoOp(Communication en cours)
exten => 300,n,Dial(SIP/pepe,10)
exten => 300,n,Hangup()
exten => 400,1,NoOp(Communication en cours)
exten => 400,n,Dial(SIP/meme,10)
exten => 400,n,Hangup()
[analyste]
exten => 500,1,NoOp(Communication en cours)
exten => 500,n,Dial(SIP/cyclone,10)
exten => 500,n,Hangup()
exten => 600,1,NoOp(Communication en cours)
exten => 600,n,Dial(SIP/lafouine,10)
exten => 600,n,Hangup()
I want the users from the context "sources" not to be able to call anyone but they can receive calls from others and I want the context "analyst" only be able to call the "agents" users.
Maybe we have to add regex ?

If you want context not able call anything use something like that
[sources]
exten => _.,1,Answer
exten => _.,n,Playback(pbx-invalid); or put name of any sound file you want.
Incoming calls from OTHER contexts depend of that contexts, i.e incoming will work if it work now.

Related

Asterisk autodial and play recording

I am trying to originate a call using rawman, sending a phone number (57522666) as a parameter and playing a message to the answering party.
This is what I have so far:
http://192.168.11.11:8088/rawman?action=originate&channel=????&context=outboundmsg1&exten=s&priority=1&timeout=30000
And in extensions.conf:
[outboundmsg1]
exten => s,1,Answer
exten => s,2,Wait(1)
exten => s,3,Background(custom/message)
exten => t,1,Playback(vm-goodbye)
exten => t,2,Hangup
I have a SIP ATA as trunk with the following name: 23656429
I have no clue what to put in the channel parameter. I have tried SIP/23656429#57522666, but I don't get the outbound call.
In case someone else runs into this question... I got it to work by using the following:
http://192.168.11.11:8088/rawman?action=originate&channel=SIP/23656429/57522666&context=outboundmsg1&exten=s&priority=1&timeout=30000&callerid=23656429
And in extensions.conf
[outboundmsg1]
exten => s,1,Answer
exten => s,2,WaitExten()
exten => s,n,Wait(1)
exten => s,n,Playback(custom/elcodigo) ; "play outbound msg"
exten => s,n,SayDigits(1498)
exten => 2,n, Wait(1)
exten => s,n,Hangup

Send DTMF Digit with dialplan

I have the following dialplan:
exten => 224,1,NoOp(IN CALL : ${CALLERID(num)} => ${EXTEN})
exten => 224,n,Dial(${PJSIP_DIAL_CONTACTS(97,97)})
;exten => 224,n,Wait(3)
exten => 224,n,SendDTMF(*11234*,200)
exten => 224,n,Wait(3)
exten => 224,n,SendDTMF(#*)
exten => 224,n,Hangup()
When I call the extension 97 and it is connected, it doesnt seem to go next in line SendDTMF. What am I doing wrong?
Greetings
For who is looking for something like this without SendDTMF application, you can send DTMF with D option:
exten => n, Dial (SIP/97,60,D(1234))
If the DTMF passed are getted on the other side incomplete, use w option to delay 500 milliseconds.
Here I'm delaying 1 second
exten => n,Dial (SIP/97,60,D(ww1234))
Did you try using macros
[macro-send]
exten => s,1,SendDTMF(*11234*,200)
exten => s,n,Wait(3)
exten => s,n,SendDTMF(#*)
[yourDialPlan]
exten => 224,1,NoOp(IN CALL : ${CALLERID(num)} => ${EXTEN})
exten => 224,n,Dial(${PJSIP_DIAL_CONTACTS(97,97)},,M(send))
exten => 224,n,Hangup()

asterisk ivr no dealing tone

I am setting up IVR and encountered following trouble there is no dealing tone when client gets to "Dial", it just silently dialing. How to fix this?
exten => s,1,Background(custom/welcome-msg)
exten => s,n,WaitExten(10)
exten => s,n,Dial(SIP/0773,20)
exten => _X,1,Read(NUMBER,,4,n,,10)
exten => _X,n,Dial(SIP/${NUMBER},20)
exten => _X,n,HangUp()
You need add 'r' option in params.
exten => _X,n,Dial(SIP/${NUMBER},20,r)
https://wiki.asterisk.org/wiki/display/AST/Dial+Application

Asterisk Dialplan preventing dialplan from repeating continuously

I have the following macro in my diaplan which is excuted each time an incoming call comes.
Problem is that it is repeating itself indefinitely. I want it to repeat 3 times, if no input from the user, it should say goodbye and quit. Could anyone help me with this please.
Thanks
[macro-test]
;exten => s,1,Answer()
;exten => s,n,Wait(2)
exten => s,1,Set(AGISIGHUP=no)
exten => s,n,NoOp(AGISUGHUP: ${AGISIGHUP})
exten => s,n,Set(CALLED=${MACRO_EXTEN})
exten => s,n,Set(CALLER=${CUT(CUT(SIP_HEADER(From),#,1),:,2)})
exten => s,n(action),Set(EXIT=0)
exten => s,n,Set(TOKEN="")
exten => s,n,Set(INIT="true")
exten => s,n,While($[${EXIT}<1])
exten => s,n,Set(EXIT=1)
exten => s,n,Agi(agi://${ARG1}/server.agi?caller=${CALLER}&called=${CALLED}&init=${INIT})
exten => s,n,Set(INIT="false")
exten => s,n,NoOp(AGISTATUS: ${AGISTATUS})
exten => s,n,GotoIf($["${AGISTATUS}" != "SUCCESS"]?fail:succ)
exten => s,n(succ),EndWhile()
exten => s,n,Set(INIT="end")
exten => s,n,Agi(agi://${ARG1}/server.agi?caller=${CALLER}&called=${CALLED}&init=${INIT})
exten => s,n,Hangup()
exten => s,n(fail),Wait(2)
exten => s,n,Playback(vm-goodbye)
exten => s,n,Hangup()
exten => h,1,NoOp(Notify Billing System)
exten => h,n,NoOp(Other Tasks)
exten => h,n,Hangup()
Simple loop dialplan
exten =>s ,1,Set(loop=3)
exten =>s,n(loop),Noop(loop start here)
exten =>s,n,Noop(do something here)
exten =>s,n,Set(loop=$[ ${loop} - 1 ]);decrease loop countr
exten =>s,n,GotoIf($[ ${loop} > 0 ]?loop); if still have something, do again
exten => h,n,Hangup()
Don't call hangup, when you're already hung up.

SpeechBackground

Hai everyone,
I have used the SpeechBackground application in asterisk. I used the version 1.6.0.6.
I have a entry like,
;;SpeechCreate
exten => s,1,SpeechCreate()
exten => s,2,SpeechActivateGrammar(yesno)
exten => s,3,SpeechStart()
exten => s,4,SpeechBackground(demo-instruct)
exten => s,5,SpeechDeactivateGrammar(yesno)
I don't know which file I meed to give in SpeechBackground application. Please give me any idea. I have given the sound file from /sounds directory.
If I call to 's' the call will be immediately released.I didn't get any audio sound.
Please any one help me...
It doesn't appear that you have Answer()'d the channel.
;; SpeechCreate
exten => s,1,Answer()
exten => s,n,SpeechCreate()
exten => s,n,SpeechActivateGrammar(yesno)
exten => s,n,SpeechStart()
exten => s,n,SpeechBackground(demo-instruct)
exten => s,n,SpeechDeactivateGrammar(yesno)

Resources