| CCXML Voxeo 1.0 Development Guide | Home | Frameset Home |
|
<dialogstart> element.
<title>CCXML Token Trigger</title>
<form name="SampleForm"
action="http://api.voxeo.net/SessionControl/CCXML.start" method="POST">
<input type="hidden" name="tokenid" value="***YOUR TOKEN HERE***">
<input type="hidden" name="resulturl" value="http://***YOUR RESULT URL HERE***">
Enter your phone number:<br>
<input type="text" name="num1" size="10" maxlength="10" value=""><br><br>
Enter the PBX phone number:<br>
<input type="text" name="num2" size="10" maxlength="10" value=""><br><br>
Enter the PBX extension number:<br>
<input type="text" name="ext" size="5" maxlength="5" value=""><br><br>
<br><br>
<input type="reset" value="Clear">
<input type="submit" name="submit" value="Give me a call!">
</form>
<?xml version="1.0" encoding="UTF-8" ?>
<ccxml version="1.0">
<%
<!-- sample code by Michael 'Topflite' Book, Voxeo Corporation -->
'*******************************************************
' Grab the "num" and "ext" var from the querystring
'*******************************************************
Num_1 = request.querystring("num1")
Num_2 = request.querystring("num2")
Ext = request.querystring("ext")
'*******************************************************
' Now we must assign those values to CCXML variables
'*******************************************************
response.write "<var name=""phoneNum_1"" expr=""" & Num_1 & """/>"
response.write "<var name=""phoneNum_2"" expr=""" & Num_2 & """/>"
response.write "<var name=""pbxExt"" expr=""" & Ext & """/>"
%>
<var name="state0" expr="'init'"/>
<eventhandler statevariable="state0">
<transition state="'init'" event="ccxml.loaded">
<log expr="'-- Application Starting --'"/>
<log expr="'-- Making Outbound Call #1 --'"/>
<assign name="state0" expr="'calling_1'"/>
<createcall dest="phoneNum_1"/>
</transition>
<transition state="'calling_1'" event="connection.CONNECTION_CONNECTED" name="evt">
<log expr="'-- Call #1 Answered --'"/>
<var name="callid_1" expr="evt.callid"/>
<assign name="state0" expr="'play_1_hldmsc'"/>
<dialogstart src="'holdmusic.vxml'" dialogid="holdMusicDlg_1"/>
</transition>
<transition state="'play_1_hldmsc'" event="dialog.started">
<log expr="'-- Caller #1 Hold Music Started --'"/>
<assign name="state0" expr="'calling_2'"/>
<createcall dest="phoneNum_2"/>
</transition>
<transition state="'calling_2'" event="connection.CONNECTION_CONNECTED" name="evt">
<log expr="'-- Call #2 Answered --'"/>
<var name="callid_2" expr="evt.callid"/>
<assign name="state0" expr="'createDelay_2'"/>
<send event="'continue'" target="session.id" delay="'3000'"/>
</transition>
<transition state="'createDelay_2'" event="user.continue" name="evt">
<log expr="'-- *Continue* Event Received --'"/>
<assign name="state0" expr="'playExt_2'"/>
<dialogstart src="'dtmf://'+ pbxExt +'#?pause=200&duration=200'"
type="'application/x-senddtmf'"
callid="callid_2"
dialogid="dialExtDlg_2"/>
</transition>
<transition state="'playExt_2'" event="dialog.exit">
<log expr="'-- Extension Dialed On Call #2 --'"/>
<assign name="state0" expr="'stopHoldMusic_1'"/>
<dialogterminate dialogid="holdMusicDlg_1"/>
</transition>
<transition state="'stopHoldMusic_1'" event="dialog.exit">
<log expr="'-- Call #1 Hold Music Stopped --'"/>
<log expr="'-- Now Connecting Call Legs --'"/>
<assign name="state0" expr="'bridging'"/>
<join sessionid1="callid_1" sessionid2="callid_2"/>
</transition>
<!-- ************************ -->
<!-- *** If call #1 fails *** -->
<transition state="'calling_1'" event="connection.CONNECTION_FAILED">
<log expr="'-- Call #1 Failed --'"/>
<exit/>
</transition>
<!-- ************************ -->
<!-- ************************ -->
<!-- *** If call #2 fails *** -->
<transition state="'calling_2'" event="connection.CONNECTION_FAILED">
<log expr="'-- Call #2 Failed --'"/>
<assign name="state0" expr="'call_2_failed'"/>
<dialogterminate dialogid="holdMusicDlg_1"/>
</transition>
<transition state="'call_2_failed'" event="dialog.exit">
<log expr="'-- Hold Music Stopped --'"/>
<assign name="state0" expr="'playingCallFailed_1'"/>
<dialogstart src="'callfailed.vxml'"/>
</transition>
<transition state="'playingCallFailed'" event="dialog.exit">
<log expr="'-- Call Failed Dialog Played --'"/>
<log expr="'-- So Sad... Bye Bye --'"/>
<disconnect/>
<exit/>
</transition>
<!-- ************************ -->
<!-- ******************************************* -->
<!-- *** If we just generally mess things up *** -->
<transition event="call.CALL_INVALID" name="evt">
<if cond="callid_1 == evt.callid">
<exit/>
</if>
</transition>
<transition event="error.*" name="evt">
<log expr="' AN ERROR HAS OCCURED: (' + evt.error + ')'"/>
<exit/>
</transition>
</eventhandler>
<!-- ******************************************* -->
</ccxml>
| ANNOTATIONS: EXISTING POSTS |
esirkin
|
|
| The syntax on <dialogstart> is not consistent with your documentation for the element. Should name="holdMusicDlg_1", be namelist="holdMusicDlg_1" ? | |
Michael.Book
|
|
| Hello,
Actually, "name" is a deprecated attribute. Its replacement/equivalent is the "dialogid" attribute. Our apologies for the confusion, and thank you for bringing this to our attention. Our documentation admins have been notified, and will update this example. Best, ~ Michael |
|
alexey.timofeev
|
|
| Hi!
I'm really need to pass variables to my ccxml scripts. Can I do that just by using method GET? How can I get this variables in my ccxml script? Do I need to write separate php-script or it can be done directly in the ccxml? The example of GET form: <html><head><title>Run</title></head><body> <form action="http://session.voxeo.net/CCXML.start" method="get" target="_blank"> <table align="left" border="0" cellpadding="0" cellspacing="5"> <tr> <td>TokenID </td> <td><input name="tokenid" value="**My token here**" type="text"></td></tr> <tr> <td>variable1 </td> <td><input name="variable1" value="1" type="text"></td></tr> <tr> <td>variable2 </td> <td><input name="variable2" value="2" type="text"></td></tr> <tr> <td><input value="GO!" type="submit"> </td> </tr> </table><br> </form> </body></html> CCXML script. <?xml version="1.0" encoding="UTF-8"?> <ccxml version="1.0" xmlns:voxeo="http://community.voxeo.com/xmlns/ccxml"> <var name="state0" expr="'init'"/> <!-- When I used vxml I've got the variable by the next way: <var name="variable1" expr="session.connection.ccxml.values.variable1"/> <var name="variable2" expr="session.connection.ccxml.values.variable2"/> --> <eventhandler statevariable="state0"> <!-- events --> </eventhandler> </ccxml> Thanks in advance. |
|
voxeojeff
|
|
| Hi Alexey,
In CCXML Voxeo, you'll need to use server-side to grab the parameters passed to CCXML. This is because CCXML Voxeo is based on the older 2002 specification. The newer CCXML 1.0 W3C mark up actually has a session variable (session.values.*) to reference parameters passed into CCXML. However, as I said, for CCXML Voxeo, you'll need to use server-side, or in this case, your php script. Hope this helps, Jeff |
|
alexey.timofeev
|
|
| Hi Jeff!
Thanks for your answer. I have one more problem. I've written the php script in order to grab the variables. I've made it initial application on my ccxml voxeo account. I've used the next POST form to pass the variables: <title>CCXML Token Trigger</title> <form name="SampleForm" action="http://session.voxeo.net/CCXML.start" method="POST"> <input type="hidden" name="tokenid" value="**my token**"> template<br> <input type="text" name="tmpl" size="10" maxlength="10" value="test.vxml"><br><br> <input type="reset" value="Clear"> <input type="submit" name="submit" value="Give me a call!"> </form> And my php-script is simply as following: <?xml version="1.0" encoding="UTF-8"?> <ccxml version="1.0" xmlns:voxeo="http://community.voxeo.com/xmlns/ccxml"> <var name="tmpl" expr="'<?=$_REQUEST['tmpl']?>'"/>" <var name="state0" expr="'init'"/> <eventhandler statevariable="state0"> <transition state="'init'" event="ccxml.loaded"> <assign name="state0" expr="'dialing'"/> <createcall dest="'tel:**my phone number**'"/> </transition> <transition state="'dialing'" event="connection.CONNECTION_CONNECTED"> <assign name="state0" expr="'connected'"/> </transition> <transition state="'dialing'" event="connection.CALL_CREATED"> <log expr="'Call is created'"/> <exit/> </transition> <transition state="'dialing'" event="connection.CONNECTION_FAILED"> <exit/> </transition> <transition state="'connected'" event="dialog.exit"> <log expr="'Thats all for now folks.'"/> <exit/> </transition> </eventhandler> </ccxml> But the debugger threw the script away - as the matter of fact the script was not even loaded: 'session terminated (document conversion analysis failed)' Then I've tried the example from ccxml_postdial.zip This time I've made Start.asp initial application on my ccxml voxeo account. This time the script was successfully loaded but the next error occurred: 'error: first script failure (error (3, 2) "Expected an element name")' Is this something with my account or I've done something wrong? Could you please make this issue more clear for me? Thanks in advance. |
|
voxeojeff
|
|
| Hello again Alexey,
I see that the start URL for your application is a PHP document. Our hosted server will only accept static XML documents, so this is why it is 'rejecting' your PHP script. You'll want to host your PHP document on a PHP-capable webserver, and point the Start URL to that location. Then the application should work as intended. Hope this helps, Jeff |
| login |
|