multiple dtmf input in asterik dialplan - asterisk

In asterisk dialplan why it is so when dtmf input is two or more digits and if a digit is
pressed when the prompt is being played it goes into i extension(invalid extension) as in
case of single digit dtmf input if digit is pressed as the prompt is being played it moves
into the right extension? thanks

Here's another example where a user must enter a 4 digit PIN to continue in the dialplan:
[Login]
exten = s,1,Playback(/var/lib/asterisk/sounds/custom/login)
exten = s,n,Set(rightPIN=1234)
exten = s,n,Read(inPIN,/var/lib/asterisk/sounds/custom/enterPIN,4)
exten = s,n,GotoIf($["${inPIN}" = "${rightPIN}"]?pin-accepted,1)
; Didn't go to pin-accepted, so play badPIN and hangup
exten = s,n,Playback(/var/lib/asterisk/sounds/custom/badPINgoodbye)
exten = s,n,Hangup()
; correct pin, play something
exten = pin-accepted,1,Playback(/var/lib/asterisk/sounds/custom/something)
...
The third parameter of the Read() application is how many digits to wait for. For more information on Read, see Asterisk Wiki: Read
Edit: There's also a dialplan app called Authenticate that does this quite well.

This will depend on how your diaplan is configured, but it sounds like you are using the background() application. Background() will listen for DTMF and then route to an extension in the current context on the 1st unambiguous match.
For example if you have 1, 2 and 100 in the context then pressing 2 will route directly to 2 (because it's unambiguous.) Pressing 1 will wait for a timeout because background() doesn't know if you are going to 1 or 100. After the timeout it will route to 1. Pressing 3 will go to the i special extension because there's is not extensions in the current context that start with 3.
If the desired behavior is to route from your IVR context to one of your internal phones then you need to include the phones context inside the IVR context:
[phones]
exten => 100,1,Dial(SIP/phone1)
exten => 101,1,Dial(SIP/phone2)
...
[IVR]
exten => s,1,Background(message)
exten => 1,1,Queue(Sales)
exten => 2,1,Queue(Support)
exten => i,1,Playback(pbx-invalid)
include => phones
More info in official documentation:
https://wiki.asterisk.org/wiki/display/AST/Application_BackGround

I recomend you start from reading this:
http://astbook.asteriskdocs.org/en/2nd_Edition/asterisk-book-html-chunk/asterisk-CHP-5-SECT-1.html
or ORelly's book "Asterisk the future of telephony".

Related

Asterisk IVRS setting

I'm using asterisk 13.9.1 right now and I wanna set an IVRS : when the user dial to a extension, say 512, the system will play a .wav file asking for user input his/her credit card number, which is 16 digit, after the user input 16 digit , the system will read the digit out and ask to confirm(an .wav again), then the user should input either 1 (confirm) or 0 (back to input), if the input is 1, then the system forward the call to another extension(someone in charge).
I've written the code for asking input, but it doesn't work and I dont know how to fix it, the system can only play the .wav asking for input now and cant listen for user input, here is my extensions.conf
[voicemenu-custom-200] ; once the user dial 512, the following section
include default ; will be executed
exten = s,1,NoOp(InCallExt)
exten = s,2,Answer()
exten = s,3,Playback(dir-intro); I'm using the default sound right now,
; here is where the system ask for user input
exten => s,1,Gotoif($[ "${LEN(${extensao})}" < "16"]?16:100)
; here might be listening the 16 digit input
exten => s,n,Read(digito||16)
exten => s,n,SayDigits(${digito})
exten => s,n,Set(extensao=${extensao}${digito})
exten => h,1,hangup()
I havent do the confirmation part yet since the system cant read out the digit,
the code is not created by me to be honest, I just google it and give it some modification, I dont know where does the digit is saved and read from which file.
I tail the log messages after dialing 512 (the extension)
there is error saying: app_voicemail.c: Couldn't find mailbox 801 in context default
Note that 801 is the user I'm currently logging in
You have write dialplan for extension 512. Dialplan you have shown is for empty extension(s).
For more info better read some nice book like ORelly "Asterisk the future of telephony", too much issues in your task still have be solved.

Dialplan for ringing multiple extension

how can i dial multiple extension in asterisk using dial command in round robin method?
I do not want to use queues.
I want to dial 3 extensions in round robin method.
You can try dial sequentially all ramal or extensions that do you want like it:
exten => 111(start),1,Dial(SIP/YOUR_RAMAL,30,tT)
exten => 111,n,Dial(SIP/YOUR_RAMAL,30,tT)
exten => 111,n,Dial(SIP/YOUR_RAMAL,30,tT)
exten => 111,n,GotoIf($["${DIALSTATUS}" = "NOANSWER"]?start)
In this case we try call the first dial for 30 seconds if no answer he jump for the next, at the end if does not exist answer he jump to start again!

How to announce (beep) the spied asterisk channel that they are being intercepted? (ChanSpy)

When using ChanSpy() to barge-in or listen is it possible to announce the spied channels that they are being intercepted?
The law says you can intercept if you announce the spied channel.
Currently if I do not use the 'q' option Asterisk beeps and says the channel number only to the interceptor. This is silly because the interceptor already knows this. Nothing is played on the intercepted channels!
[barge-in]
exten => _*224x.#,1,Macro(user-callerid,)
exten => _*224x.#,n,Answer
exten => _*224x.#,n,NoCDR
exten => _*224x.#,n,Wait(1)
exten => _*224x.#,n,ChanSpy(SIP/1,B)
exten => _*224x.#,n,Hangup
There are no way do it like you want with small effort.
Possible solutions on your choice
1) Hire someone who will extend app_spy.c code to play file to other party
2) Use instead transfer to conference, play in conference file you want
3) Create dialplan (above average complexity/expert level required) which will do spychan session,playback first file, after that do other session and connect human.

Why 'Dial' application is not executed in this asterisk dial plans' context?

I have this dial plan in the Asterisk config files:
[voicemenu-custom-1]
exten = s,1,NoOp(VM_Main)
exten = s,n,Answer()
exten = s,n,Goto(ringgroup,s,1)
exten = s,n,Dial(DAHDI/g1/009396464991)
exten = s,n,Hangup()
It's a very simple context in a dial plan, which asks the Asterisk to Answer, then to execute another context named ringgroup (to ring all the phones at the same time), then try to ring an external number (009396464991) and then hangup.
The code of the ringgroup context is:
[ringgroup]
exten = s,1,NoOp(RG1)
exten = s,n,Dial(SIP/1001&SIP/1002&SIP/1003&SIP/1004,30,${DIALOPTIONS})
exten = s,n,Hangup()
But what I get is that Asterisk answers the inbound call, then goes to the ringgroup context, but when it comes to the execution of the line s,n,Dial(DAHDI/g1/009396464991), it encounters a dial error and won't execute Dial application.
What is wrong here?
Based on the behavour you describe, I suggest you change your "Goto" into a "GoSub" and replace the "HangUp" in [ringgroup] with a "Return". That will produce the effect you are looking for.
A "Goto" never comes back from the context you send it into. It's a one-way ticket. GoSub, as long as the call remains active (ie, not hung-up), will automatically return to the context it has been sent from as soon as it exhausts the new context.
Incidentally, GoSubs are considered the "better way" to do things than using macros now, so getting used to them is a good idea.
Further reading: http://www.voip-info.org/wiki/view/Asterisk+cmd+Gosub
You could jump back to the voicemenu-custom-1 Context, because you HangUp (as already pointed out by arheops) after the Groupdial.
You could jump to a Label, ie. "FwdOutbound" of voicemenu-custom-1, with Goto(context,extension,label).
[voicemenu-custom-1]
exten = s,1,NoOp(VM_Main)
exten = s,n,Answer()
exten = s,n,Goto(ringgroup,s,1)
; Label
exten = s,n(FwdOutbound),Dial(DAHDI/g1/009396464991)
exten = s,n,Hangup()
Goto in the Ringgroup, instead of Hangup:
[ringgroup]
exten = s,1,NoOp(RG1)
exten = s,n,Dial(SIP/1001&SIP/1002&SIP/1003&SIP/1004,30,${DIALOPTIONS})
exten = s,n,Goto(voicemenu-custom-1,s,FwdOutbound)
exten = s,n,Hangup()
Use
asterisk -r
core set verbose 10
to see what is gooing on.
In your plan I can see that you are dooing Goto(ringgroups,s,1) but context is ringroup, not ringroups.

Custom extension with Asterisk that "Answers" then "Beeps"

I'm trying to solve a very painful problem that impedes on my world utilizing my amazing powers as a programmer... (my front gate makes my friends call my cell phone, then I have to press "9" and it lets them in)...
So, my amazing powers have gotten me very far, except this last part I can't get (perhaps due to lack of sleep).
I've got every thing worked out so far: The call-box now dials my Google Voice account, which forwards it to my virtual machine on my laptop running the latest 'trixbox' (Asterisk), which will receives the call via Gizmo5/SIP junk.
What I need now is to have the phone call answered, and then "press" the number "9"... wait about 5 seconds, then hang-up.
I'm sure it's as easy as putting this code somewhere in a config file:
exten => 1234,1,Answer
exten => 1234,n,Press("the flippin 9 key")
exten => 1234,n,Wait(5)
exten => 1234,n,Hangup
But I don't know:
1) Is this possible (pretty sure it is)
2) What file do I edit?
3) Do I need to make an extension first?
4) Is that code in my example above anywhere close?
5) What do I actually need to do!
I greatly appreciate any help on this one.
You're close, try:
exten => 1234,1,Answer
exten => 1234,2,Wait(2) ; Safety time
exten => 1234,3,SendDTMF(9)
exten => 1234,4,Wait(5)
exten => 1234,5,Hangup
This tells Asterisk how to handle a call coming in for 1234
In a "standard" Asterisk installation, this goes in extensions.conf and 1234 should be whatever extension/number the incoming call is coming in on.
extensions.conf has different sections, which can vary based on distribution and local setup, but it's usually best to put this in the [default] section.

Resources