How to read # tone

Hi all,

I need to read with Asterisk a six digits code which can include numbers, * and #.

I’m using Read function but this function always finish when # is introduced so I am not able to do what I want.

The Read function functionalities of timeout or maxdigits are perfect and all I need in this case, but I don’t know how avoid the # termination…

Does anybody knows any solution for this?

Thanks in advance…


Hi again,

I’ve got another cuestion with some relation with the other one…

¿is there any function or app like the ‘Read’ one that allows to play a video while it is reading the dtmf’s to a varible?



You can’t use read with a # but how about this: -

exten => s,1,Answer
exten => s,n,WaitExten(10)
exten => s,n,Return
exten => _[0-9*#][0-9*#][0-9*#][0-9*#][0-9*#][0-9*#],1,Set(CODE=${EXTEN})
exten => _[0-9*#][0-9*#][0-9*#][0-9*#][0-9*#][0-9*#],n,Return

exten => 128,1,Gosub(ReadCode,s,1)
exten => 128,n,NoOp(${CODE})[/code]
The 128 is just a test exten. The NoOp is just for test. WaitExten(10) waits for input for 10 sec. Background could be used to play music etc.
Do NOT “include” ReadCode context into your default context.

Thank a lot, jedi98…

I’d forgotten this cuestions and this post for a long time and I’ve recovered the works this days…

The ReadCode suboutine really do the job and it has let me solved both problems; I can capture # insaide the codes and I can capture codes in video calls using a clip inside the subroutine that remains while the user is introducing the code, something like that:

[ReadCode] exten => s,1,Answer exten => s,n,mp4play(clip.3gp) exten => s,n,WaitExten(10) exten => s,n,Return exten => _[0-9*#][0-9*#][0-9*#][0-9*#][0-9*#][0-9*#],1,Set(CODE=${EXTEN}) exten => _[0-9*#][0-9*#][0-9*#][0-9*#][0-9*#][0-9*#],n,Return

Next step would be to show the introduced code to the videocall user in the following screen. Something like:

You have introduced: 345*#3

Anyone knows if exists the posibility of show variables on screen? Something like a text-to-video function? I haven’t found anything like that but would be great…

Thanks again…


If your channel/device can handle displaying static pictures (jpeg etc?) then maybe you could use imagemagick’s convert command to create a picture with the text in and then SendImage() to display it to the user?

Or, does the device itself support some form of XML menu overlay?

Also a jpeg could be turned into a movie with mencoder which is part of mplayer.

These are all VERY rough ideas and need lots of research and probably some compilation to make them into a real solution.

just do sendtext(${EXTEN})