| CCXML 1.0-W3C 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.
hello
test=123
more=is that it
<?xml version="1.0" encoding="UTF-8"?>
<ccxml version="1.0" xmlns="http://www.w3.org/2002/09/ccxml">
<var name="myVar" expr="'some cool value'"/>
<var name="statevar" expr="'init'"/>
<var name="what_i_sent"/>
<eventprocessor statevariable="statevar">
<transition state="init" event="ccxml.loaded">
<send target="'sendTarget.php'" name="what_i_sent" namelist="myVar" delay="'1s'" targettype="'basichttp'"/>
<assign name="statevar" expr="'state1'"/>
</transition>
<transition event="myEvent" state="state1">
<var name="myObj" expr="JSON.parse(event$.myVar)"/>
<log expr="'***** DATA RECIEVED FROM SERVER *****'"/>
<log expr="'***** myObj = ' + myVar"/>
</transition>
<transition event="error.send">
<log expr=" ' ** Problem: ' + event$.reason + ' (eventid = ' + event$.eventid + ') **' "/>
</transition>
</eventprocessor>
</ccxml>
<?php
echo "myEvent\n"
?>
<?php
header('Cache-Control: no-cache');
foreach($_REQUEST as $key => $value )
{
echo $key , "=", $value, "\n";
}
?>
| 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(); } } |
|
jbuehring
|
|
| On our test-bed installation of Prophecy 8.0.x, it appears to be the default behavior of the send element when using basichttp to transmit namelist data as base64-encoded HTTP POST. In this case, the target's server-side logic needs to process it accordingly before the data can be meaningful to it.
The way around this appears to be to specify 'http.get' as the name attribute, which transmits the namelist in plain-text via the HTTP GET method. Needless to say, this caveat should be documented, both in the send element's page, and in Appendix G! |
|
VoxeoBrian
|
|
| Hello,
You are correct, it is possible to specify the name attribute as http.get, which will transmit your parameters as plain text via GET. This however is not valid per the CCXMl specification and is a "hack", if you will that was created for our specific platform implementation. Allowing CCXML sends via GET is not something provided by the specification and as such was not included in the documentation. I will however make note of this, as I believe this should be documented for future use. Please let us know if you have any additional questions, we are always happy to help. Regards, Brian |
|
ScapeLogic
|
|
| I think it'd be useful for this example to be updated with the following:
First, the example output above has an event called 'hello', whereas the code example uses an event called 'myEvent'. Second, <log expr='***** myObj = ' + myVar"/> shouldnt that be + myObj instead of + myVar? Third, I think it'd be useful for people to understand they can get access to the actual key/value pairs like event$.keynamehere |
|
mikethompson
|
|
| Good eye there! I will need to follow up with the keepers of our documentation and see if we can get this changed.
Thanks, Mike Thompson Voxeo Corporation |
|
samo.jst
|
|
| Hi,
I've noticed that the link to 'complete code' zip file is not available. Could you please send it to me by email or republish it on the web site... ... I would really like to try the example, becouse I can see the PHP http response in the ccxml log file: <parameter name="content" value="clir=1" /> , but the expected new variable 'clir' can not be accessed - it remains undefined: <log expr="'CLIR:'+ clir"/> <log expr="'CLIR:'+ evt.clir"/> ==> <log>CLIR:undefined</log> <log>CLIR:undefined</log> br, Samo |
|
voxeodamonic
|
|
| Hello,
We apologize for the broken link. I will do some investigation and find out why this link is broken and get the page republished. Thank, Damonic Voxeo Support |
|
voxeojeff
|
|
| Hi Samo,
My apologies for the delayed update here. This issue has been rectified, and all links should now be fully functional. :-) Best regards, Jeff |
| login |
|