| CCXML Voxeo 1.0 Development Guide | Home | Frameset Home |
|
<?xml version="1.0" encoding="UTF-8"?>
<ccxml version="1.0">
</ccxml>
<?xml version="1.0" encoding="UTF-8"?>
<ccxml version="1.0">
<eventhandler>
</eventhandler>
</ccxml>
<eventhandler> block is critical -- CCXML will search sequentially through your document and trigger on the first match (even if there is a subsequent match that would be more accurate). <transition> takes care of virtually every event signaling an incoming call. Since many of your CCXML applications will want to answer the phone, let's see how that works:
<?xml version="1.0" encoding="UTF-8"?>
<ccxml version="1.0">
<eventhandler>
<transition event="connection.CONNECTION_ALERTING" name="evt">
<log expr="'The called ID is ' + evt.calledid + '.'"/>
</transition>
</eventhandler>
</ccxml>
<?xml version="1.0" encoding="UTF-8"?>
<ccxml version="1.0">
<eventhandler>
<transition event="connection.CONNECTION_ALERTING" name="evt">
<log expr="'The called ID is ' + evt.calledid + '.'"/>
<if cond="evt.calledid == '8315551234'">
<reject/>
<elseif cond="evt.calledid == '8315557890'"/>
<reject callid="evt.callid"/>
<else/>
<accept/>
</if>
</transition>
</eventhandler>
</ccxml>
<reject> and second: you are able to specify the call leg to operate against. If the event came from the call leg itself, no specifier is needed -- the first <reject> works for this reason. The <accept> element fires an asynchronous event (as do most CCXML triggers), and will communicate to us later the result. If you are uncomfortable with the concept of asynchronous events, please poke the fat guy coding C++ in the cube next to you for an explanation.
<?xml version="1.0" encoding="UTF-8"?>
<ccxml version="1.0">
<eventhandler>
<transition event="connection.CONNECTION_ALERTING" name="evt">
<log expr="'The called ID is ' + evt.calledid + '.'"/>
<if cond="evt.calledid == '8315551234'">
<reject/>
<elseif cond="evt.calledid == '8315557890'"/>
<reject callid="evt.callid"/>
<else/>
<accept/>
</if>
</transition>
<transition event="connection.CONNECTION_CONNECTED">
<log expr="'Call was answered.'"/>
<disconnect/>
</transition>
</eventhandler>
</ccxml>
<voxeo:sendemail tag into the mix; also check out the fact that we have specified the voxeo 'xmlns' attribute in the initial ccxml declartion. This is important, as otherwise, we will get a nasty parsing error.. Assuming that we fill in all the blanks so that we have a valid email address, we will then get an email notification whenever the 'call.CALL_INVALID' event is executed. Tres` cool, eh?
<?xml version="1.0" encoding="UTF-8"?>
<!-- NOTE THAT WE *MUST* DECLARE THE xmlns ATTRIBUTE -->
<ccxml version="1.0" xmlns:voxeo="http://community.voxeo.com/xmlns/ccxml">
<eventhandler>
<transition event="connection.CONNECTION_ALERTING" name="evt">
<log expr="'The called ID is ' + evt.calledid + '.'"/>
<if cond="evt.calledid == '8315551234'">
<reject/>
<elseif cond="evt.calledid == '8315557890'"/>
<reject callid="evt.callid"/>
<else/>
<accept/>
</if>
</transition>
<transition event="connection.CONNECTION_CONNECTED">
<log expr="'Call was answered.'"/>
<disconnect/>
</transition>
<transition event="call.CALL_INVALID">
<voxeo:sendemail to="'yourEmail@there.com'"
from="'myApp@here.com'"
type="'debug'"
body="'We had an error! \n Time to panic! \n
Flee the cities, abandon all hope! \n
Or, just send this email to the support
folks.'"/>
<exit/>
</transition>
</eventhandler>
<log expr="'Application is starting ...'"/>
</ccxml>
<log> element at the very end of the application is outside the scope of our <eventhandler>. CCXML will initially execute all code in the application not contained in an eventhandler (thus, we would always see our "Application is starting..." message). Why you ask? Because events are fired asynchronously, code within an <eventhandler> block will not be executed until that specific event occurs; however, other CCXML elements are handled, and executed, sequentially. As we move forward, grasping this difference will become easier. For clarity, it is usually best to include your <eventhandler> block at the end of the document, but it is not a requirement (as shown above). <voxeo:sendmail> extension element| ANNOTATIONS: EXISTING POSTS |
bigfun
|
|
| Funnier and funnier...
best-reading tutorial I have ever come acrosss.... poke the fat guy in the cube next to you -- indeeed!!!! |
|
yliuvoxeo
|
|
| What CCXML standard or which version of CCXML are you following?
Your example codes are well formed but not valid by CCXML v1.0 -- as I am using a syntax validating editor. For example, <eventhandler/> is not even defined in CCXML DTD; it can not be used directly under <ccxml/>! |
|
steve.sax
|
|
|
Hi there, The documentation guide is based off of the specification from October 2002. Our Prophecy platform is indeed more compliant to the recent specification, should that be more to your taste. We have not gotten a chance to fully document the Prophecy CCXML platform as of this date, but it is forthcoming sometime this year. Hope that this helps to clarify! Steve Sax |
|
sumitmaniktala
|
|
| Greetings,
I have a confusion, at some places in the code blocks on this page you have used evt.calledid and evt.callid. Are they same or different? Regards, Sumit Maniktala |
|
MattHenry
|
|
|
Sumit, These are indeed different. 'callid' is the line itself that we are accepting or rejecting in this case, and 'calledid' designates the DNIS, (number that was dield to access the application). Hope this helps to clear up the confusion, ~Matthew Henry |
|
ravimalpani
|
|
| Hi there
i am using a ccxml parser n i m facing problem using it. How can i set event variables at real-time. consider example <if cond="evt.calledid == '8315551234'"> <reject/> <elseif cond="evt.calledid == '8315557890'"/> <reject callid="evt.callid"/> <else/> <accept/> </if> How can i set evt.calledid at real-time.Is there any method to pass arguments to parser at run time???!!! |
|
VoxeoTony
|
|
| Hi,
Can you give us more information on the parser you are using? I would like to be sure that you are not talking about processing to a server-side environment. In the case of the Voxeo browser the evt.calledid will be reached real time when the value (8315551234) is detected by the CCXML interpreter. Looking forward to hearing from you. Regards, Tony |
|
kave
|
|
| hi there,
this is about .... <transition event="connection.CONNECTION_ALERTING" name="evt"> <log expr="'The called ID is ' + evt.calledid + '.'"/> and you wrote... "...So far, we are only logging the Caller ID..." ?????? thanks, kave |
|
mikethompson
|
|
| Hi Kave,
Just to clarify, the reason we said "so far, we are only logging the calledID..." is because this is only the 2nd tutorial in our documentation set, and logging callerID had not yet been illustrated. You should still be able to log the callerID within alerting if you really want to. :) Best, Mike Thompson Voxeo Corporation |
|
kave
|
|
| hi Mike!
You wanted to mean "CalledID" and in this tutorial said "CallerID", you have a typo mistake on the sentence "So far, we are only logging the CallerID..." check it out above , that was my confusion :P. thanks pal, like always, you have been so kind to me! Best, Kave |
|
voxeo.benb
|
|
| Thank you for pointing that out. I will pass this on to the Docs Maintainer, and he will update it for the next docs release.
-Ben Bohn Voxeo Support |
| login |
|