Jump to: navigation, search

Create Call

The following SCXML strategy shows how to create a voice call with extension hints.

<scxml version="1.0" xmlns="http://www.w3.org/2005/07/scxml" 
        xmlns:queue="www.genesyslab.com/modules/queue" 
        xmlns:dialog="www.genesyslab.com/modules/dialog" 
	xmlns:ixn="http://www.genesyslab.com/modules/interaction"
        initial="initial">
  <datamodel>
    <data ID="reqid"/>
    <data ID="ixnid"/>
    <data ID="time_delay" expr="'2s'" />
  </datamodel>
  <state id="initial">
    <transition event="interaction.added" target="calling"/>
  </state>
  <state id="calling">
    <onentry>
      <log expr="'Calling ...'" />
      <ixn:createcall requestid="_data.reqid" type="regular" from="'701'" to="'702'" udata="({key_1:10*10, key_2:20*20, key_3:30*30})" hints="({extensions:{key_1:100*100, key_2:200*200, key_3:300*300}})" />
    </onentry>
    <transition event="error.voice.createcall" cond="_event.data.requestid == _data.reqid" target="error">
      <log expr="'Got createcall error:'" />
      <log expr="uneval( _event )" />
    </transition>
    <transition event="voice.createcall.done" cond="_event.data.requestid == _data.reqid" target="delay">
      <log expr="'Got createcall confirmation:'"/>
      <log expr="'event name = ' + _event.name" />
      <script>
        _data.ixnid = _event.data.interactionid;
      </script>
    </transition>
  </state>
  <state id="delay">
    <onentry>
      <log expr="'======== Inside Delay ========'"/>
      <send event="'SynchroEvent'" delay="_data.time_delay"/>
    </onentry>
    <transition event="SynchroEvent" target="acceptcall" />
  </state>
  <state id="acceptcall">
    <onentry> 
      <ixn:accept requestid="_data.reqid" interactionid="_data.ixnid" resource="'702'" />
    </onentry>
    <transition event="error.interaction.accept" target="error" />
    <transition event="interaction.accept.done" cond="_event.data.requestid == _data.reqid" target="exit" />
  </state>
  <final id="exit"/>
  <final id="error"/>
</scxml>
This page was last edited on August 14, 2014, at 20:21.
Comments or questions about this documentation? Contact us for support!