text stringlengths 0 152 |
|---|
worse than a prompt recorded through a phone set. |
5 Unless you are an expert in these areas, in which case go for it! |
Building Your AA |
| |
253 |
Using the dialplan to create recordings |
The simplest method of recording prompts is to use the Record() application. |
Add this new subroutine at the bottom of your extensions.conf file: |
[subRecordPrompt] |
exten => 500,1,Playback(vm-intro) |
same => n,Record(daygreeting.wav) |
same => n,Wait(2) |
same => n,Playback(daygreeting) |
same => n,Hangup |
exten => 501,1,Playback(vm-intro) |
same => n,Record(mainmenu.wav) |
same => ... etc ... (create dialplan code for each prompt you need to record) |
In order to use this context, you will need to include it in the con‐ |
text where your sets enter the dialplan. So in your [LocalSets] |
context, you will want to add the line include=>UserServices. In a |
production environment, you’ll probably want a password on this |
so that not just anybody can record prompts. |
This subroutine plays a prompt, issues a beep, makes a recording, and plays that |
recording back.6 It’s notable that the Record() application takes the entire filename as |
its argument, while the Playback() application excludes the filetype extension |
(.wav, .gsm, etc.). This is because the Record() application needs to know which for‐ |
mat the recording should be made in, while the Playback() application does not. |
Instead, Playback() automatically selects the best audio format available, based upon |
the codec your handset is using and the formats available in the sounds folder (for |
example, if you have a daygreeting.wav and a daygreeting.gsm file in your sounds |
folder, Playback(daygreeting) will select the one that requires the least CPU to play |
back to the caller). |
You’ll probably want a separate extension for recording each of the prompts, possibly |
hidden away from your normal set of extensions, to prevent a mistyped extension |
from wiping out any of your current menu prompts. If the number of prompts you |
have is large, repeating this extension with slight modifications for each will get tedi‐ |
ous, but there are ways around that. We’ll show you how to make your prompt |
recording more intelligent in Chapter 16, but for now the method just described will |
serve our immediate needs. |
6 The vm-intro prompt isn’t perfect (it asks you to leave a message), but it’s close enough for our purposes. The |
usage instructions at least are correct: press # to end the recording. Once you’ve gotten the hang of recording |
prompts, you can go back, record a custom prompt, and change priority 1 to reflect more appropriate instruc‐ |
tions for recording your own prompts. |
254 |
| |
Chapter 14: The Automated Attendant |
Here’s the dialplan (in bold) that’ll create all our prompts. Place it wherever you wish |
in the [sets] context: |
exten => _4XX,1,Noop(User Dialed ${EXTEN}) |
same => n,Answer() |
same => n,SayDigits(${EXTEN}) |
same => n,Hangup() |
exten => 500,1,GoSub(subRecordPrompt,${EXTEN},1(daygreeting) |
exten => 501,1,GoSub(subRecordPrompt,${EXTEN},1(nightgreeting) |
exten => 502,1,GoSub(subRecordPrompt,${EXTEN},1(mainmenu) |
exten => 503,1,GoSub(subRecordPrompt,${EXTEN},1(holdwhileweconnect) |
exten => 504,1,GoSub(subRecordPrompt,${EXTEN},1(faxandaddress) |
exten => 505,1,GoSub(subRecordPrompt,${EXTEN},1(transfertoreception) |
exten => 506,1,GoSub(subRecordPrompt,${EXTEN},1(invalid) |
exten => 507,1,GoSub(subRecordPrompt,${EXTEN},1(holdwhileweconnect) |
exten => _555XXXX,1,Answer() |
same => n,SayDigits(${EXTEN}) |
exten => _55512XX,1,Answer() |
same => n,Playback(tt-monkeys) |
The recordings (aka prompts) will be placed in the /var/lib/asterisk/sounds folder. You |
can put them elsewhere, so long as you specify the full path when recording and play‐ |
ing back (and ensure the directory where you put them is readable by the asterisk |
user). In a production system, you should put them elsewhere, so as to separate your |
custom prompts from the generic prompts. For now, we’ll keep things simple and put |
them in the same folder as the system prompts. |
The Dialplan |
Here is the code required to create the AA that we designed earlier. We will often use |
blank lines before labels within an extension to make the dialplan easier to read, but |
note that just because there is a blank line does not mean there is a different |
extension. |
You can place this code at the end of your [TestMenu] context, right before your |
subroutines: |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.