Recording Audio Files
For a more robust interface, to do the same as above within the diialplan, a sample dialplan example will be displayed here. It makes use of this previously installed topic: https://wiki.allstarlink.org/wiki/Passing_DTMF_to_shell_scripts
Some background. In order to get a nice clean audio for your id's and tail message, you should do your recording from a quite environment, and a better radio with the best quality audio as possible. It is suggested here to do this from a computer and iaxrpt: https://wiki.allstarlink.org/wiki/Setup/Download_IAXRpt or possibly a sip phone.
Install Alt Method
You will find the need to keep your stuff organized as passing dtmf to shell script and the dialplan explodes the possibilities of the app_rpt software which limits dtmf and the use of star and pound by necessity.
So, the directory structure presented here is suggested for your initial setup and testing. Then make it what you want once you have it working. This also reduces type errors.
You need to create a directory to house separately your sound files. Our example here uses /etc/asterisk/msg so you will want to create that directory and set permissions for it.
Create a new directory if it does not already exist, /etc/asterisk/custom and check/set permissions for it. This is a standard directory for asterisk to add additional section of dialplan. We use it for our custom elements to keep these from exploding our dialplan without organization. So you can quickly view and edit those elements without searching the whole thing. Fewer fat finger errors without seeing them.
2 Setting file paths
edit rpt.conf to reflect the following
idrecording = /etc/asterisk/msg/idmsg1
optionally idtalkover= /etc/asterisk/msg/idmsg2 but it is advised here to keep this very short/quick or just use the cwid talkover. |N1CALL
tailmessagelist= /etc/asterisk/msg/tmsg1, tmsg2, tmsg3 ...these rotate in order presented not random. So you could repeat some to play a few more than others.
Be sure to set the timing interval on these if you have not run them before. tailmessagetime=1800000 ; 20 minutes between tail messages tailsquashedtime=300000 ; If squashed by another user, try again after 5 min
Save your edit
3 The DTMF DialPlan Magic
Add this line to your command list, and again, organization of your dialplan and commands is key here especially when you later debug.
It is suggested here that all these dialplan redirects stay organized in/near your phone patch commands starting with 6x and so you can see that they are non-conflicting listed together as we really are making a phone patch to ourselves in a call by 'CONTEXT', not by number. That is equated in the context when it is redirected to that context. Standard Asterisk stuff. It is also here suggested that you renumber you phonepatch commands to reflect the following.
- 60 patch hangup / even *0 is better
- 61 phonepatch
So all our DTMF redirects can be hung-up with a *60 or *0 if/as needed
4 DialPlan Preparation
Edit extensions.conf and add the following line as it appears at the very bottom of the file, the last line. It is not commented out, # required.
Save your edit.
5 The DialPlan
Create the file /etc/asterisk/custom/rsm.conf and add these contents:
[rsm] ;the context we are dialing into
exten => 10,1,Playback(/etc/asterisk/msg/idmsg1) ; primary long id
exten => 10,n,Hangup
exten => 11,1,Playback(please-enter-your&vm-message&after-the-tone)
exten => 11,n,Record(/etc/asterisk/msg/idmsg1:wav)
exten => 11,n,Hangup
exten => 20,1,Playback(/etc/asterisk/msg/idmsg2) ; secondary quick id (provided but not suguested over cwid)
exten => 20,n,Hangup
exten => 21,1,Playback(please-enter-your&vm-message&after-the-tone)
exten => 21,n,Record(/etc/asterisk/msg/idmsg2:wav)
exten => 21,n,Hangup
exten => 30,1,Playback(/etc/asterisk/msg/tmsg1) ; tail message #1
exten => 30,n,Hangup
exten => 31,1,Playback(please-enter-your&vm-message&after-the-tone)
exten => 31,n,Record(/etc/asterisk/msg/tmsg1:wav)
exten => 31,n,Hangup
exten => 40,1,Playback(/etc/asterisk/msg/tmsg2) ; tail message #2
exten => 40,n,Hangup
exten => 41,1,Playback(please-enter-your&vm-message&after-the-tone)
exten => 41,n,Record(/etc/asterisk/msg/tmsg2:wav)
exten => 41,n,Hangup
exten => 50,1,Playback(/etc/asterisk/msg/tmsg3) ; ; tail message #3
exten => 50,n,Hangup
exten => 51,1,Playback(please-enter-your&vm-message&after-the-tone)
exten => 51,n,Record(/etc/asterisk/msg/tmsg3:wav)
exten => 51,n,Hangup
exten => 60,1,Playback(/etc/asterisk/msg/spmsg) ; ; tail message #3
exten => 60,n,Hangup
exten => 61,1,Playback(please-enter-your&vm-message&after-the-tone)
exten => 61,n,Record(/etc/asterisk/msg/spmsg:wav)
exten => 61,n,Hangup
exten => i,n,Playback(vm-goodbye) ; if anything else was entered and not match above, play goodby and hangup
exten => i,n,Hangup
Command List for Recording System Messages
You will need to dial our prefix (*65) + The function we seek in 2 numbers.
So, *6510 will playback our existing Main ID
and *6511 will record our new system ID
- 6530 will play our tail message 1
- 6531 will record our tail message 1 Overwriting the old
- 6540 will play our tail message 2
- 6541 will record our tail message 2 Overwriting the old
- 6550 will play our tail message 3
- 6551 will record our tail message 3 Overwriting the old
- 6560 will play our special message
- 6561 will record our special message Overwriting the old
Record all your messages and change the permissions of the files. So that owner and group users can execute.
Now this dialplan may be revised, and likely will be. When it was originally written, the asterisk function of stopping on silence would not work correctly from app_rpt. Perhaps it was the older asterisk version we used at the time. This may have changed. AT present, you will have to issue a (pound) or patch hangup command to end it. Hence some of the requested changes. Not as clean and neat as we would otherwise like it. But functionally better for those that have the need to change tail messages on the fly from where you are. There is plenty of room for you to add something special of your own, if you think you understand how to work the asterisk dialplan. You are encouraged to do so. No better time to learn.
So, what is the special message ? Anything you want it to be. But you will need to call it via macro and scheduler with localplay or playback. Remember where it is located and it's name.
So, with this tool, you can now alter it to suit your exact needs. Suggested you make it run correctly first. If you make some useful additions, please post them on the Users List