CCXML 1.0-W3C Development Guide Home  |  Frameset Home

  Error Event Field Listing  |  TOC  |  D: Dialog Extensions  

Sending Custom Events


We just so happen to have a simple interface that will allow you to send custom events into an existing CCXML session.  Just send an HTTP request from your web-server to http://api.voxeo.net/SessionControl/CCXML.send and be sure to include the following parameters:


The event will be fired as a '[name you defined]' event.  Simply transition it, and perform any action you would like (within reason, of course).


The GET request:

http://api.voxeo.net/SessionControl/CCXML.send?sessionid=abc123&eventname=MyEvent


The resulting event:

<transition event="MyEvent">
  <log expr="'*** This is my custom CCXML Event! ***'"/>
</transition>


Two methods to "inject" custom events


Sending custom events via web interface

In order to use CCXML.send via a web interface, we'll need to somehow pass the relevant CCXML session ID and event name to your web interface on the internet, so it can make the proper request.  This can be done through the use of HTML and server-side scripting.  The resulting request will look something like this, assuming you are sending the event "MyEvent" to session ID abc123:


http://api.voxeo.net/SessionControl/CCXML.send?sessionid=abc123&eventname=MyEvent


Sending custom events via application code

If you don't want to bother using a web interface to inject your event, there is one other option: hard code it into your application.  You may integrate the CCXML.send request into your code by utilizing the <send> event:


<send name="'http.get'" target="'http://api.voxeo.net/SessionControl/CCXML.send?sessionid=abc123&eventname=MyEvent'"/>



Adding custom querystring parameters

At this point, you might be asking yourself, "Hey mister, what if I want to send more information to my custom event?"  Well, you can also tack on custom parameters to your CCXML.send request, if you wish:


The GET request:

http://api.voxeo.net/SessionControl/CCXML.send?sessionid=abc123&eventname=Clint&eastwood=day


The resulting event:

<transition event="Clint">
  <log expr="'Go ahead, make my: ' + event$.eastwood"/>
</transition>



Limitations?

In this section we'll try to clear up any lingering questions you may have regarding the ccxml.send interface.

Q: Are there any limitations regarding parameters or attributes being sent as part of the HTTP request string?

A: CCXML.send is a GET request, so you are subject to the character limit of a querystring, which is 255 characters.


Q: What if I want to do this on a local installation of Prophecy?

A: All we need to do is change "http://api.voxeo.net/SessionControl/CCXML.send" to "http://127.0.0.1:9999/CCXML.send" and we can then inject custom events into your local prophecy server.  Note that the default port for this is 9999, and not 9990.


Q: I'm using CCXML 1.0 W3C, so do I need to change CCXML.send to CCXML10.send?

A: Nope.  CCXML.send will work for both CCXML Voxeo and CCXML 1.0 W3C.




  ANNOTATIONS: EXISTING POSTS
romilly1
4/7/2010 1:58 AM (EDT)
Hi guys,

If we're in a VXML, how can we send an event to our parent CCXML with some parameters?

Thank you
voxeoJeffK
4/7/2010 2:44 AM (EDT)
Hello,

You can use the HTTP syntax as described in the tutorial above. The key is getting the sessionID from the CCXML parent when you start the VXML dialog so you know where to send your event. You can do this as described here by sending the session.id variable information to the VXML dialog:

  http://docs.voxeo.com/ccxml/1.0-final/ccxml10_passtovxml.htm

Regards,
Jeff Kustermann
Voxeo Support
romilly1
5/10/2010 10:03 PM (EDT)
Thank you
careprad_v
4/27/2012 10:20 PM (EDT)
I test it by browser, first I call my application and get the parentsessionid, and then request the url http://api.voxeo.net/SessionControl/CCXML.send?sessionid=thesessionid&eventname=MyEvent

got this response:
sendevent command was successful

and my voicexml dialog code is like this:
<?xml version="1.0"?>
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
<form>
<catch event="myevent">
<prompt>got my event. awesome you are.</prompt>
</catch>
<block>
<prompt bargein="false">
<audio src="audio/waiting.wav" />
</prompt>
</block>
</form>
</vxml>

But the event did not fire, I got the log from the debugger:

event: MYEVENT _sessionid="0" delay="0s" eventid="c50e8ed449d3444886db8e41a6893498" eventsource="basichttp" eventsourcetype="basichttp" hints="" name="myevent" namelist="sessionid,eventname" sendid="sendid" target="68c1fbe3d7a0899fb56736a1ef2d69f0" targettype="ccxml"
00249  69f0  02:32:46 AM  warning: event was not handled

What's the problem?
VoxeoDante
4/30/2012 7:24 AM (EDT)
Hello careprad_v,

The issue here is that you are sending the information to the CCXML API, but you are using VoiceXML for your application.  When you are sending that event, it is arriving at the CCXML engine, and not the VoiceXML engine.  There is not an external API for the VoiceXML, and the only way to fire events in VoiceXML is from the session it's self.

If you want to send an event to the session while it is running you would need to use CCXML to catch the even in a transition. 

I hope that helps.

Regards,
Danté Vitulano
Hosted Solutions Engineer

[url=http://www.voxeo.com/university/home.jsp]
[img=http://www.voxeo.com/images/logos/VoxeoUnivLogo.png/]
[/url]
[b][color=blue]Interested in Training? Visit the Voxeo University Page to Learn More![/color][/b]
careprad_v
5/1/2012 9:28 PM (EDT)
Yes, now I am using voicexml not ccxml, so I want to  send an event to the session while it is running like what I do in tropo, do you mean that I can't catch the customer event in voicexml other than ccxml?
VoxeoGarret
5/2/2012 8:55 PM (EDT)
Hello,

As Dante mentioned earlier, you will not be able to send an event to Vxml directly. You would need to pass a parameter to CCxml in order to do such. If you need to send a custom event in Vxml within the session you can use the throw method. However, if you are looking to use an external event from the API you will need to utilize CCxml.

Regards,
Garrett King

Customer Support Engineer
Voxeo Corporation

login
  Error Event Field Listing  |  TOC  |  D: Dialog Extensions  

© 2012 Voxeo Corporation  |  Voxeo IVR  |  VoiceXML & CCXML IVR Developer Site