| CCXML Voxeo 1.0 Development Guide | Home | Frameset Home |
|
<send> element is used for one main purposes: to send events to a separate CCXML session. The Voxeo implementation adds to this by allowing the developer to trigger a HTTP request.<send> is used to reach a HTTP server, then the resulting document will be examined. This document, or the HTTP body, can be empty, leading to a silent send without any feedback. Notice that it still will be transactional, since errors are always reported.<send> element as to perform a HTTP request. For more details on this element, it is suggested that you view the CCXML element guide.http.post / http.get
hello
test=123
more=is that it
<?xml version="1.0" encoding="UTF-8"?>
<ccxml version="1.0">
<assign name="test_1" expr=" 'this goes out' "/>
<assign name="test_2" expr=" 'and so is this one' "/>
<eventhandler>
<transition event="ccxml.loaded" name="evt">
<!--
we are sending a GET request to our imaginary server,
passing two variables (as URL parameters), and we're
expecting an HTTP '200' reponse with the document shown
above; also note that this request will be delayed for 1 second
-->
<send event=" 'http.get' " target=" ' http://MySever.com/MyCode.asp' "
name="what_i_sent"
namelist="test_1 test_2"
delay=" '1000' "/>
<log expr=" 'event ID = [ ' +what_I_sent + ' ] ' "/>
<!--
this common timeout even t brings down our session,
regardless of whether or not we got an answer
-->
<send event=" 'My_Cool_Event' " target="session.id" delay=" '20000' "/>
</transition>
<transition event="error.send" name="evt">
<log expr=" ' ** Problem: ' + evt.error + ' (eventid = ' + evt.eventid + ') **' "/>
</transition>
<transition event="user.hello">
<!-- We now examine the return values from the HTTP request -->
<log expr=" 'count on ' + evt.test + ' - ' + evt.more"/>
</transition>
</eventhandler>
</ccxml>
| ANNOTATIONS: EXISTING POSTS |
amitsood
|
|
| Here is the sample ASP.net code that will return the values as expected by CCXML,
in this case EventFromAspPage is the event name that will handeled by CCXML set content type to plain text public class MyForm: System.Web.UI.Page { private void Page_Load(object sender, System.EventArgs e) { string callId = string.Empty; string outputStr = string.Empty; try { this.Context.Response.ContentType = "text/plain"; //Needs for CCXML version 1.0 callId = FormatInputParam("callID"); string InputParam1= FormatInputParam("param1"); string InputParam2= FormatInputParam ("param2"); string InputParam3= FormatInputParam ("param3"); //Do your processing outputStr = CreateCCXMLResponse("EventFromAspPage", "Value1", "Value2"); } } catch(Exception ex) { // Handle the errors outputStr = CreateCCXMLResponse( "EventFromAspPage", "Value1", "Value2"); } this.Context.Response.Write(outputStr); } private string FormatInputParam(string paramName) { string retString = this.Context.Request[paramName]; if (null == retString) { retString = string.Empty; } return retString; } private string CreateCCXMLResponse(string eventName, string value1, string value2) { StringBuilder returnStringBuilder = new StringBuilder(eventName); returnStringBuilder.Append("\n"); returnStringBuilder.Append("Key1"); returnStringBuilder.Append("="); returnStringBuilder.Append(value1); returnStringBuilder.Append("\n"); returnStringBuilder.Append("Key2"); returnStringBuilder.Append("="); returnStringBuilder.Append(value2); return returnStringBuilder.ToString(); } } CCXML will see the following text output from the web page call EventFromAspPage Key1=Value1 Key2=-Value2 |
| login |
|