Jump to: navigation, search

Receive Event From Invoked Session

The invoked SCXML session can communicate with the invoking session by sending an event back to the parent session and passing additional information in the event.

The following sample stores the information passed from the invoked session using an empty finalize element.

<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" 
        initial="initial">
  <state id="initial">
    <transition event="interaction.added" target="invocation"/>
  </state>
  <datamodel>
    <data ID="DN" expr="''" />
  </datamodel>
  <state id="invocation">
    <invoke src="'http://localhost:9090/strategies/01_BASIC/_aux/ReturnDN.xml'" type="scxml">
      <finalize/>
    </invoke>
    <transition event="done.invoke.invocation.*" target="routing"/>
    <transition event="error.invoke.invocation.*" target="error"/>
  </state>
  <state id="routing">
    <onentry>
       <queue:submit priority="5" timeout="20">
        <queue:targets type="dn">
          <queue:target name="_data.DN"/> 
        </queue:targets>
      </queue:submit>
    </onentry>
    
    <transition event="queue.submit.done" target="exit">
      <log expr="'DONE'"/>
      <log expr="_genesys.ixn.interactions[0].voice.ani"/>
      <log expr="'DONE'"/>
      <log expr="_event.data.targetselected"/>
    </transition>
    <transition event="error.queue.submit" target="error"/>
  </state>
  
  <final id="exit"/>
  <final id="error"/>
</scxml>

Here is a sample for ReturnDN.xml, which is invoked above:

<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" 
        initial="initial">
  <state id="initial">
    <transition target="event"/>
  </state>
  <datamodel>
    <data ID="DN" expr="'7102'"/>
  </datamodel>
  <state id="event">
    <onentry>
      <send event="'DN'" target="'_parent'" type="'scxml'" > 
         <param name="DN" expr="_data.DN" />
      </send>
    </onentry>
    
    <transition target="exit"/>
  </state>
  
  <final id="exit"/>
</scxml>

Feedback

Comment on this article:

blog comments powered by Disqus
This page was last modified on September 22, 2017, at 05:06.