Dial pattern in asterisk


#1

Hello
I wrote an ivr on Stersk, but after playing the audio file, I did not allow more than one digit.
In the matching pattern in _X! It means a digit or more than a digit, so why not apply in the following example?

[testdialplan]
exten => 33,1,Answer
same => n,Set(TIMEOUT(digit)=3)
same => n,Background(demo-congrats)
same => n,wait(3)
exten => _XXX!,1,NoOp(number1)


#2

_X! means that Asterisk will only try to assemble a number until at least one digit has been obtained. That is, of course, the trivial case. Generally, when doing IVR’s digits arrive individually, so it will always match exactly one digit. The only time that it would match more is on the start of a call, where the digits are in the request URI.


#3

Modify the code as follows:
I wrote an ivr on Stersk, but after playing the audio file, I did not allow more than one digit.

[testdialplan]
exten => s,1,Answer
same => n,Set(TIMEOUT(digit)=3)
same => n,Background(demo-congrats)
same => n,wait(3)

exten => _X!,1,Dial(SIP/${EXTEN})


#4

You still have only one X, so, it will still match as soon as at least one digit has arrived.


#5

Maybe I did not make my question well


#6

tnanks for answering david
No, my problem is something else. The above code does not allow me to dial a 3-digit internal.
And as soon as you enter the first number of the Hangup happens


#7

That’s correct. That code will not allow you to enter a three digit number using DTMF, as DTMF digits are sent individually. If there is any match with an ! the longest match based on the number of digits already received is used.

If you want a to match with a timeout, you should use . rather than ! You may want to use XXX! to avoid a timeout once three digits are entered.


#8

You right, DTMS are sent individually
But,as i know ! means that, caller can enter nothing or unlimit of numbers
And if your opinion about ! for dtmf are right, So Why it works fine with dot (.) (For exampe X.)


#9

! also bypasses the timeout on additional digits.

. looks tries to get the longest match, subject to a timeout.


#10

ok
I realized
I wanted to write a program that supports at least one digit and more, but if (dot) let me enter at least 2 digits and more.
But it’s not like that
tanks


#11

Have a simple pattern that matches exactly one digit, and does the same as _X.


#12

Engineer ، I’m sure _X. matches exactly two digit


#13

_X. matches at least two digits.


#14

I suggest to use Read.
In my opinion it is more powerful than using Backgound and Pattern matching.

–Satish Barot


#15

Right
But my question was something else. I wanted to answer this question with this question
My main problem is that my users have a context called internal, in this context there is an exten ( _X! ) In which an AGI is called as follows:

[internal]
exten => _[*#0-9a-zA-Z]!,1,NoOp(Calling FastAgi)
same => n,AGI(agi://127.0.0.1:5567/dialplan, internal)
same => n,Hangup

I do not have any problems dialing, but when I need to transfer, once the first number is called AGI, it does not allow me to enter the next digits.

And if instead ! From dot I’ll use this problem to resolve but can not enter a digit. I must enter at least two digits .


#16
exten => _[*#0-9a-zA-Z].,1,NoOp(Calling FastAgi)
same => n,AGI(agi://127.0.0.1:5567/dialplan, internal)
exten => _[*#0-9A-Z],1,NoOp(Calling FastAgi)
same => n,AGI(agi://127.0.0.1:5567/dialplan, internal)

The Hangup is redundant.

Note allowing single digit a-z will result in mis-operation as it will match h, i, t, e, s, etc. That is why I removed “a-z”.