Getting Value of the function Waitdigit

I have a basic svi wich make these action:
put 1: goto queue(support)
put 2: the client gives me his command number and I use function waitdigit

My question, How to get this value?
Below the context of my svi
[ivr_1]
exten => s,1,agi(googletts.agi,“Bienvenue dans IVR”,fr,any)
same => n,Answer()
same => n,agi(googletts.agi,“taper 1 si vous voulez contacter un support”,fr,any)
same => n,agi(googletts.agi,“taper 2 si vous voulez verifier votre numero de commande”,fr,any)
same => n,agi(googletts.agi,“taper 3 si vous voulez autre question”,fr,any)
same => n(loop),Background(press-1&or&press-2&press-3)
same => n,Set(TIMEOUT(response)=10)
same => n,WaitExten()

exten => 1,1,NoOp(choix 1)
same => n, agi(googletts.agi,“Choix 1:Contact Support”,fr,any)
same => n, Queue(support)
same => n,Goto(s,loop)

exten => 2,1,NoOp(choix 2)
same => n, agi(googletts.agi,“Entrer votre numero et terminer par un diez”,fr,any)
same => n, waitDigit(5,5) ;5 sec and 5 digits
;------ How Should I use here and then the agent can hear the digits of tne number

    same => n, SayDigits () ; the value of waitDigit 
    same => n,Hangup()

exten => 3,1,NoOp(choix 3)
same => n, agi(googletts.agi,“Entrer votre numero et terminer par un #”,fr,any)
same => n, agi(googletts.agi,“Votre choix est 1”,fr,any)
same => n, Dial(SIP/1002,20) ;appel direct exten 1002
same => n,Hangup()

exten => _[3-9#],1,NoOp(choix 3)
same => n,Goto(invalid,s,1)

[invalid]
exten => s,1,NoOp(invalid touch)
same => n,agi(googletts.agi,“Choix invalid”,fr,any)
same => n,Goto(ivr_1,s,1)

Thanks you so much

Please re-read the description of waitexten(). The second parameter is an option, not a number of digits.

Also, take a gander at Special Dialplan Extensions and verbose().

Either the entry matches an exten in the current context, times out, or is invalid. Dialplan execution only continues after waitexen() on timeout if you don’t have a ‘t’ extension.

In each of these cases, dialplan execution continues at the respective extension where you could use saydigits().

This isn’t WaitExten(). It seems to be a new addition. The wiki page says how the result is returned (name of variable): https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+Application_WaitDigit

However, note that it only reads one digit, and with a second parameter of 5, there is no need to check which that is, as it will always be 5, else the request will fail.

I suspect the OP really wants ReadExten(): https://wiki.asterisk.org/wiki/display/AST/Asterisk+15+Application_ReadExten

My bad. Disregard my post above. Move along, nothing to see.

Hello ,
I am using the function readExten but I have error like below

let me show you the contexte

exten => _1XXX,1,NoOp()
same => n,agi(googletts.agi,“Enter the number and #”,fr)
same => n,ReadExten(test,macroform-robot_dity.ulaw,readnum,n,10)
same => n,NoOp(${test})
same => n,Hangup()

[readnum]
exten => t,1,NoOp(${EXTEN})

Action attempted: Just Diplay the number in variable test but I have this error:
ast_streamfile: Unable to open macroform-robot_dity.ulaw (format (ulaw)): No such file or directory
however the file macroform-robot_dity.ulaw exist in directory /var/lib/asterisk/moh
May be I’ve missed something but I dont know what

Thank you so much

Wrong directory. This is treated as an announcement, not as music on hold, so should be in the sounds directory, or its relevant language sub-directory.

Wrong file name. The filename should not include the filetype, as Asterisk will look for the best filetype based on the current codec.

I found into this path
/var/lib/asterisk/sounds/en
And I choose this unwelcomecall.ulaw But I have the same error

ReadExten(“SIP/1001-00000061”, “test,unwelcomecall.ulaw,readnum,n,10”) in new stack
[Jun 11 11:47:01] WARNING[5334][C-0000010b]: file.c:787 ast_openstream_full: File unwelcomecall.ulaw does not exist in any format
[Jun 11 11:47:01] WARNING[5334][C-0000010b]: file.c:1260 ast_streamfile: Unable to open unwelcomecall.ulaw (format (ulaw)): No such file or directory
Thank you

You have only addressed one of the points I made.

yes you are right But
see below the contexts

exten => _1XXX,1,NoOp(Test readexten)
same => n,agi(googletts.agi,“Enter number”,fr)
same => n,ReadExten(test,unwelcomecall,readnum,i,20)
same => n,Verbose(“Numero est:${test}”)
same => n,Hangup()

[readnum]
exten =>t,1,Verbose(“readnum:${EXTEN}”)
same =>n,Hangup()

1-What parameter should I use and then if the user touch “#”, the dialplan will be execute immeditely the next plan because now it waits 20s before going to the next step ?

2- the result is not what I attempted

As result I would like display readnum:value of the variable test that I input into the function readExten

So how should I write my context readnum if I would like have this result

Thank you so much

My purpose is to display the value of the variable test

That’s not a useful purpose. If you want design suggestions, you need to explain the real world purpose, as there may be other ways of achieving that.

we have an svi, by the way the digit that the user enter, there is an action that the user enter his number of command.
1-After he enters his number of commands, we match this number into our own database
2-If it is matching, the next plan of dialplan will be continued
3-if not, return

My purpose is that, so I get the value of test using readExten, and passed it into context readnum and then I can create an app using API ARI to find this number into our database

so the context readnum will be
exten => t,Noop()
same=>n,stasis(my_app) ==> this part will do the matching in our database the number which enter the user

exten => _1XXX,1,NoOp(Test readexten)
same => n,agi(googletts.agi,“Enter number”,fr)
same => n,ReadExten(test,unwelcomecall,readnum,i,20)
same => n,Verbose(“Numero est:${test}”)
same => n,Hangup()

[readnum]
exten =>t,1,Verbose(“readnum:${EXTEN}”)
same=>n,stasis(my-app)
same =>n,Hangup()

That is my purpose, if you have another suggestions it will be very helpful for me

Thanks a lot

ReadExten looks for valid extensions in the specified context, so will only accept # as a terminator when it is not valid in the extension, at the place where it occurs. I think that means that it will not be recognized where it ends up matched against “.” at the end of a pattern.

If you want to read an arbitrary string of digits that can be terminated by a #, you need Read(), but note that this will accept any character, not just digits. (ReadExten isn’t limited to digits, if the dialplan is not limited to digits.)

(I’ve not checked the behaviour of all the sub-routines called, but it looks to me as though # is only considered when it is not possible to validly enter more digits to match a valid extension.)

There are no DTMF dialable numbers in readnum, so I’d actually expect it to return with an immediate failure.

I cannot find any definition of SVI in a telephony context.

You are still describing an implementation of your requirement, rather than the requirement itself, and added an another question, as to why ARI is needed.

Note the code I’m referring to is:

			exten[x] = res;
			if (!ast_matchmore_extension(chan, arglist.context, exten, 1 /* priority */,
				S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))) {
				if (!ast_exists_extension(chan, arglist.context, exten, 1,
					S_COR(ast_channel_caller(chan)->id.number.valid, ast_channel_caller(chan)->id.number.str, NULL))
					&& res == '#') {
					exten[x] = '\0';
				}
				break;
			}

and I haven’t fully understood, it so part of above interpretation may be wrong, but I can see nothing that would result in the t extension ever actually being run.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.