August 1, 2014
Hot Topics:
RSS RSS feed Download our iPhone app

Introduction to CCXML, Part III

  • November 6, 2002
  • By Jonathan Eisenzopf
  • Send Email »
  • More Articles »
In case you missed it, you can still read the previous sections of this article: Introduction to CCXML, Part I and Introduction to CCXML, Part II.

In Part III of the Introduction to CCXML, we will begin developing practical call control applications.

Overview

As I've mentioned previously, I'm using the Voxeo CCXML platform to develop and test my CCXML applications. You can signup for a developer account at techpreview.voxeo.com. I would also recommend installing Voxeo Application Insight (which was also reviewed by Hitesh Seth).

Accept a call, start a dialog

Probably the most basic CCXML application accepts an incoming call with the <accept> element and starts a VoiceXML dialog with the <dialogstart> element.

1  <?xml version="1.0" encoding="UTF-8"?>
2  <ccxml version="1.0">
3  
4    <eventhandler>
5 <transition 
event="connection.CONNECTION_ALERTING" 
name="evt">
6 <accept callid="evt.callid"/>
7      </transition>
8    
9 <transition event=
"connection.CONNECTION_CONNECTED">          
10    <dialogstart src="'example2.vxml'"/>
11      </transition>
12  
13      <transition event="dialog.exit">
14  <log expr="'Thats all for now folks.'"/>
15        <exit/>
16      </transition>
17  
18    </eventhandler>    
19  </ccxml>

The CCXML application above defines three event handlers on lines 5, 9, and 13. The first catches the connection.CONNECTION_CONNECTED event, which gets triggered when a call comes into the system. The <accept> element on line 6 takes the phone off-hook (or in other words, it answers the call).

Once the call has been connected, the connection.CONNECTION_CONNECTION event is triggered and handled on lines 9-11 where the <dialogstart> element starts the example2.vxml dialog. At this point, the CCXML processor is still working in the background as the caller interacts with the VoiceXML dialog. The VoiceXML application doesn't incur any additional restrictions because it's being loaded by a CCXML application. Any valid VoiceXML application can be launched from a CCXML application.

When the VoiceXML dialog finishes execution, the dialog.exit event is thrown. The event handler on lines 13-16 handles this event. Line 14 records this event in the Voxeo log. The <log> element is not part of the CCXML specification, but was added by Voxeo so that developers can log call progress and error messages. Line 15 calls the <exit/> element, which ends the execution of the CCXML application.

Blocking Callers

Now, let's make our example a bit more sophisticated. Let's say that we have a list of phone numbers that we want to block from accessing the application. If someone calls from one of these blocked numbers, then we don't want to even pick up the phone.

1  <?xml version="1.0" encoding="UTF-8"?>
2  <ccxml version="1.0">
3  
4    <eventhandler>
5   <transition event=
"connection.CONNECTION_ALERTING" 
name="evt">
6    <if cond="evt.callerid == '7035551212'">
7          <reject/>
8          <exit/>
9   <elseif cond="evt.callerid == '2025551212'"/>
10          <reject/>
11          <exit/>
12        <else/>
13          <accept callid="evt.callid"/>
14        </if>
15      </transition>
16    
17 <transition event=
"connection.CONNECTION_CONNECTED">          
18        <dialogstart src="'example2.vxml'"/>
19      </transition>
20  
21      <transition event="dialog.exit">
22        <log expr="'Thats all for now folks.'"/>
23        <exit/>
24      </transition>
25  
26    </eventhandler>    
27  </ccxml>

As with the previous example, we have created an event handler for connection.CONNECTION_ALERTING via a <transition> element on lines 5-15. We've added several conditional statements that check the caller's phone number. If the caller's number is 202-555-1212 or 703-555-1212, then we <reject> the call and <exit> the application, otherwise, we <accept> the call.

As before, once the call is connected, the CCXML processor starts the example2.vxml dialog on line 18.





Page 1 of 2



Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Sitemap | Contact Us

Rocket Fuel