Is it how possible to write incoming DTMF to a file on asterisk?
Example: Call asterisk to a specific inboud route, asterisk answers, you input some DTMF digits, asterisk waits 3 seconds, writes this digits pressed to a file (template with callerid an DTMF code, maybe timestamp) and hangsup the line.
I found something similar with AlarmReceiver, but I don’t think Ican use it, because the incoming device calling won’t be an alarm but regular phone or mobile. Or can I?
I have not tried this, but it should be possible to use the Read() function to prompt the caller and accept DTMF into a variable, and then use an AGI program to write the digits to a file:
I haven’t tried Dave’s solution yet but I just want to share how I solved this one. In my case I made an AGI executable program that is responsible for collecting the tones and then from there, I saved it to file.
just an excerpt from my program
in extensions.conf, add this line
where GetDTMF.py - is an executable program which in my case is a python executable program which I named GetDTMF.py
sys.stdout.write("GET DATA PlayAudio 10000\n")
sys.stdout.flush()
ReceivedDTMF = sys.stdin.readline().strip()
where GET DATA is the command for capturing streams of DTMF tones, PlayAudio is a sound file, just to play something while waiting for the tones, and 10000 is the timeout in ms, see >> http://www.voip-info.org/wiki/view/get+data
ReceivedDTMF - was just the name of the variable I used where the DTMF are stored as a string
If you want this to be saved on file, it depends on your Programming language used, just look it up on how to save this one on a file, and voila, you will have what you need.
I havent tried Dave’s solution but I think his solution is a lot better however, in my case, I just want to show you other flavor and I must say that the solution I presented to you is 100% guaranteed.
[quote=“sebek72”]thank you now the script gets executed.
But still no file created.
Is the bash script wrong?
Thank you[/quote]
I’m glad it worked!
I’m not very good at this, but I believe that you should find a file called FILE in your agi directory that has the digits. You also might want to make sure that whatever user is executing that script (asterisk?) has write permissions to that folder.
Thanks a lot…
I tought that the file would be created, but is has to already exist and have the right permissions.
I’m not so good at bash.
Anyone with an idea for a script like this? Every call gets saved to a file named: MM/DD/YYYY/HH:MM:SS
Inside the file there is lines for: CALLERID, DTMF pressed, TIMESTAMP.