An unprepared person who wants to write the simplest voice menu using VoiceXML on the voice gateway from Cisco will have to step on a lot of rakes. Some of them I will note in this article. It is possible that some Cisco-specialist will snort and say that this is all elementary people, but nevertheless, when I faced this task, I did not know where to start. Google did not give any sensible examples of ready IVR. The only more or less good starting point was
this article . My
Habravopros also did not give special results. But discard the lyrics and get down to business. Suppose that we have a Cisco voice gateway that supports VoiceXML scripts (for example, Cisco 3925). We will develop the voice menu shown in the picture. During business hours, a greeting will be played and the call will be transferred to the specified internal number, during off-hours and weekends - a special announcement that, they say, call on weekdays.
Let us single out the main “building blocks” and stages of building our voice menu.
1. Routing incoming call to our vxml script.
2. Temporary condition
3. Play a sound file
4. Transfer call to extension number
5. Download and Activate Vxml Script
1. Routing an incoming call
Suppose that the number we have comes from the provider via a regular telephone line (pots) in the form 7XXXYYYZZZZ. You need to create a new dialpyr and specify that the incoming call should be routed to the “test” service:
gw # conf t
gw (config) # dial-peer voice 100 pots
gw (config-dial-peer) # description IVR-Test
gw (config-dial-peer) # incoming called-number 7XXXYYYZZZZ
gw (config-dial-peer) # service test
Great, the call comes in, but as long as we don’t have the actual test application, we’ll now write it in parts.
2. Temporary condition
Writing the first XML block. First, we initialize the variables, then we make the necessary condition, not forgetting that we are working on the XML document, which means that all characters like "<" and "&" should be screened:
<! - Time is in UTC ->
<! - Day of week: 0 - sunday, 1 - monday ... 6 - sunday ->
<var name = "VAR_Hour" expr = "new Date (). getHours ()" />
<var name = "VAR_Day" expr = "new Date (). getDay ()" />
')
<! - Time condition ->
<form id = "IVR_TimeCondition" >
<block >
<if cond = "5 & lt; = VAR_Hour & amp; & amp; VAR_Hour & lt; 14 & amp; & amp; <0 & lt; VAR_Day & amp; & amp; VAR_Day & lt; 6" >
<goto next = "#IVR_Business" />
<else />
<goto next = "#IVR_NonBusiness" />
</ if >
</ block >
</ form >
Here we move to a block called IVR_Business during business hours, and IVR_NonBusiness during off-hours and weekends. About them later.
3. Sound files and their playback.
I keep sound recordings in the flash memory of the gateway in G.711 ÎĽ-law format. In Windows, they can be recorded using the standard Sound Recorder, and in Linux I use the sox program. The following command converts a PCM audio file to a ÎĽ-law file:
sox input.wav -e u-law -V4 -r 8k -c 1 output.wav
We upload the necessary files into memory, for example, from the HTTP server 192.168.0.10:
gw # mkdir test
gw # copy http: // 192.168.0.10/ivr1.wav flash0: /test/ivr1.wav
gw # copy http: // 192.168.0.10/ivr2.wav flash0: /test/ivr2.wav
The XML block that is responsible for the announcement on weekends looks like this:
<! - Non business hours ->
<form id = "IVR_NonBusiness" >
<block >
<prompt > <audio src = "flash0: /test/ivr2.wav" /> </ prompt >
</ block >
</ form >
4. Routing to an internal number
Here, according to the scheme, we also have a small greeting (ivr1) and transfer the call to the specified internal number. This number can be either a phone number or, for example, a CUCM (Hunt Pilot) group number. In my case, the call was transferred using the phone: // EXT address, although on the Internet I saw variations of the form tel: // EXT or sip: // EXT. So you may have a little bit different.
<! - Business hours ->
<form id = "IVR_Business" >
<block >
<prompt > <audio src = "flash0: /test/ivr1.wav" /> </ prompt >
</ block >
<transfer name = "mycall" transferaudio = "flash0: /test/music.wav" bridge = "false" dest = "phone: // 123" >
<filled >
<log > TRANSFER RETURNED: <value expr = "mycall" /> </ log >
</ filled >
</ transfer >
</ form >
If necessary, we will be able to catch the call result code in the mycall variable if we enable debug voip application vxml puts debug mode. Note also that the transferaudio parameter is a sound file that will play until the number 123 picks up the phone.
5. Download and Activate Vxml Script
So now we have the final script
test.vxml , and we can upload it to the gateway. Similarly, using an HTTP server:
gw # copy http: // 192.168.0.10/test.vxml flash0: /test/test.vxml
Finally, activate the “test” script:
gw # conf t
gw (config) # application
gw (config-app) # no service test flash0: /test/test.vxml
gw (config-app) # service test flash0: /test/test.vxml
That's all! I hope that with the help of this basic script even a beginner can write a simple voice menu. I suppose the next step would be to screw up the selection of one of the menu branches by pressing one of the numbers on the phone. But I did not need it yet, so we leave it behind the brackets.
In conclusion, here are some links that can help in the development of IVR:
- www.cisco.com - an official document from Cisco - VoiceXML Programmer's Guide
- www.vxml.org - there are many tutorials, though this is not a Cisco implementation, but Voxeo companies
- www.w3.org - VoiceXML 3.0 Language Specification