November 24, 2014
Hot Topics:

Designing an Interactive Voice Response System Using VoiceXML and CCXML

  • March 28, 2008
  • By Ponkumar and Sujata De
  • Send Email »
  • More Articles »

Using CCXML, the workflow is modified as shown in Figure 2:



Click here for a larger image.

Figure 2: State Diagram for CCXML and Modified VoiceXML Flow Using Advertising

Legend for Figure 2:

1. Gets the user details, including user preferences.
2A. Gets the advertisement information as per the user preferences, i.e, the Ad link.
2B. Gets the travel related details.
3A. Plays the advertisement.
3B. Gets the travel search related details and performs the travel search.
4. Gets the search results.

A sample CCXML file in this application will be as shown in Listing 5:

<? xml version="1.0"?>
<ccxml version="1.0">

<!-- Miscellaneous variables-->
<var expr="'initial'" name="currentstate" />
<var name="in_connectionid" />
<var name="out_connectionid" />
<var name="accepted" />

<var name="searchResult"/>
<var name="call_id"/>
<var name="dialog_id"/>
<var name="advertisingService"/>
<var name="businessService" />

<!-- Variables to calculate call length -->
<var name="callStart"/>
<var name="callEnd"/>
<var name="callLength"/>

<!-- Variable to hold value inputed by caller -->
<var name="departureCityCode" />
<var name="destinationCityCode" />
<var name="departureDate" />
<var name="returnDate"/>
<var name="response"/>

<!-- Variable flags to check which services returned -->
<var name="playedAd" expr="false"/>
<var name="completedSearch" expr="false"/>

<!--

<assign name="callStart" expr="new Date().getTime()"/>
<log expr="'*** creating another dialog. ***'"/>

-->


<eventprocessor statevariable="currentstate">

   <transition event="connection.alerting" state="initial">
      <assign expr="event$.connectionid"
              name="in_connectionid" />
      <accept />
   </transition>

   <transition event="connection.connected" state="initial">
      <log expr="'*** Started main vxml . ***'"/>
      <dialogstart dialogid="main" src="'userDetails.vxml'" />
      <log expr="'*** executed main vxml . ***'"/>
      <assign expr="'welcoming_caller'" name="currentstate"/>
   </transition>

   <transition event="dialog.exit"
               state="welcoming_caller" name="evt">
      <!-- place the caller on hold -->

      <log expr="'*** in dialog.exit . ***'"/>

      <!-- Get the values from userDetails.vxml -->
      <assign name="departureCityCode"
              expr="evt.values.departureCityCode"/>
      <assign name="destinationCityCode"
              expr="evt.values.destinationCityCode"/>
      <assign name="departureDate"
              expr="evt.values.departureDate"/>
      <assign name="returnDate"
              expr="evt.values.returnDate"/>

      <log expr="'DC =     ['+departureCityCode+']'"/>
      <log expr="'DestDC = ['+destinationCityCode+']'"/>
      <log expr="'DD =     ['+departureDate+']'"/>
      <log expr="'RD =     ['+returnDate+']'"/>

      <!-- Invoke advertising service and play the ad -->
      <dialogstart dialogid="advertisingService"
                   connectionid="in_connectionid"
                   src="'advertisement.vxml'" />

      <!-- Invoke flight business service -->
      <dialogstart dialogid="businessService"
                   connectionid="in_connectionid"
                   src="'userTravelSearchDetails.vxml'"
                       namelist="departureCityCode
                       destinationCityCode
                       departureDate returnDate"/>

      <assign expr="'travelsearch'" name="currentstate" />

   </transition>

   <transition event="dialog.exit"
               state="travelsearch"
               name="evt">
      <!-- get the response from travel search, pass it to
           another vxml to play -->
      <log expr="'MyEventName =   ['+evt.dialogid+']'"/>
      <log expr="'MyEventName2 is ['+businessService+']'"/>
      <log expr="'MyEventName2 is ['+advertisingService+']'"/>
      <log expr="Checking dialog exits."/>

   <if cond="evt.dialogid == businessService">
      <log expr="'MyData = ['+evt.values.response+']'"/>
      <log expr="exiting from travelsearch"/>
      <assign name="response" expr="evt.values.response"/>
      <assign name="completedSearch" expr="true"/>
      <log expr="'response = '+response+''"/>
   </if>
   <if cond="evt.dialogid == advertisingService">
      <!-- get the response from travel search, pass it to
           another vxml to play -->
      <log expr="exiting from advertisement"/>
      <assign name="playedAd" expr="true"/>
   </if>
   <log expr="'FLAG AD = playedAd'"/>
   <log expr="'FLAG Search = completedSearch'"/>
   <if cond="completedSearch == true">
      <if cond="playedAd == true">
         <log expr="ALL DONE. CAN TERMINATE!"/>
         <dialogstart dialogid="searchResult"
                      connectionid="in_connectionid"
                      src="'userTravelSearchResults.vxml'"
                      namelist="response"/>
         <assign expr="'completed'" name="currentstate"/>
      </if>
   </if>

   </transition>


   <transition event="dialog.exit" state="completed" name="evt">
      <disconnect/>
   </transition>

<!-- Clean up the call -->

   <transition state="completed" event="connection.disconnected" >
      <log expr="'Call has been disconnected.
                  Ending CCXML Session.'"/>
      <exit/>
   </transition>

</eventprocessor>

</ccxml>

Listing 5: Sample CCXML file





Page 3 of 4



Comment and Contribute

 


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

 

 


Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Sitemap | Contact Us

Rocket Fuel