Author Topic: SCXML Dialog Stop  (Read 5621 times)

Offline guides

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
SCXML Dialog Stop
« on: January 16, 2015, 07:03:25 PM »
Hi,

I`m developing a Routing Strategies that starts a vxml application. I have a route point linked with the attached scxml code and this scxml code start a vxml dialog on specific event. I want to use user data to control each transition in the SCXML.  One specific user data
will trigger the transition that will start the vxml application.

In the attached scxml code, I call the function dialog:stop to stop the vxml that was started previously with dialog:start, however, in the ors log, I get the following error:

15:44:38.362 METRIC <event_processed sid='00HDG57QBOA8J5FI8IODE2LAES0003OC' name='dialog.stop.requestid' disposition='no transition' current_states='globalstate,STOP_RECORD' />
15:44:38.362 ors:~OrsEvent[0x4afdcd60]:name=dialog.stop.requestid
15:44:38.389 ORSURS::HandleREvent: <<
event 1000000102
refID -1
call
message {"name":"error.dialog.stop","data":{"requestid":11935430,"error":13,"description":"0053 Invalid attribute"}}
object 0
<<
15:44:38.389 ors:+OrsEvent[0x4afdcd60]:name=error.dialog.stop
15:44:38.389 ors:+IORSSessionTask[0x4b674ba0]

I was able to map this error with the URS logs and it seems the dialog:start behaves like a dialog:play in which case it doesn't support
TreatmentCancelCall.  Is that possible?  Since I'm using the record block in the vxml, is there any limitation when stopping the dialog?

15:44:38.624 Trc 36002 Request rejected: error code 53(Invalid attribute)
@15:44:38.6244 [0] 8.1.001.11 send_to_client: message EventError
        (Invalid attribute)
        AttributeEventSequenceNumber    0000000000012099
        AttributeTimeinuSecs    624458
        AttributeTimeinSecs    1421175078 (15:44:38)
        AttributeErrorCode      53
        AttributeErrorMessage  'Invalid attribute'
        AttributeReferenceID    230186
        AttributeTreatmentParms [2] 00 00..
        AttributeTreatmentType  12 (TreatmentCancelCall)
        AttributeConnID 0088025ae0d29172
        AttributeThisDN '05142813919'
        AttributeClientID      20
15:44:38.624 Int 04545 Interaction message "EventError" sent to 35 ("URS")
15:44:38.624 Trc 04542 EventError sent to [35] (00000014 URS 10.231.189.69:32864)

Is there a way to start / stop a vxml inside a scxml?  Any sample code about a scxml that controls a vxml would be very helpful.

Thanks and best regards,
Guy

----------------test.scxml
<scxml version="1.0" xmlns="http://www.w3.org/2005/07/scxml"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:ws="http://www.genesyslab.com/modules/ws"
xmlns:queue="http://www.genesyslab.com/modules/queue"
xmlns:dialog="http://www.genesyslab.com/modules/dialog"
xmlns:session="http://www.genesyslab.com/modules/session"
xmlns:ixn="http://www.genesyslab.com/modules/interaction"
xmlns:classification="http://www.genesyslab.com/modules/classification"
initial="waitForInteraction">

<datamodel>
<data id="idInteraction" />
<data id="idRequeteRvi" />
<data id="ixnid" />
<data id="thisDN" />
</datamodel>

<script>
var userdata = ({});
var gTarget = '0';
var gDialogID = new Object();
var gInteractionID = new Object();
var gBackup = null;
var HANG_UP = '0';
var RECORD = '1';
var STOP_RECORD = '2';
var PLAY = '3';
var STOP_PLAY = '4';
var PLAY_FILE = '5';
var STOP_PLAY_FILE = '6';
var RECORD_FILE = '7';
var STOP_RECORD_FILE = '8';
var App_ForceRoute1 = new Object();

__Log( 'GD Version 92' );
// __Log( 'GD _genesys' + JSON.stringify(_genesys) );


function ValidateState(command)
{
var lTarget  = _genesys.ixn.interactions[_data.ixnid].udata.USER_OPERATION;
var lFilename = _genesys.ixn.interactions[_data.ixnid].udata.FILENAME;
var lReturn  = false;
var lCommand = command;

if ( lCommand != null &amp;&amp; lTarget != null )
{
lReturn = lTarget == command;
}
if ( lCommand == '2' &amp;&amp; lFilename != null )
{
lReturn = lTarget == command;
}
if ( lCommand == '5' &amp;&amp; lFilename != null )
{
lReturn = lTarget == command;
}
return lReturn;
}
</script>

<state id="waitForInteraction">
<onentry>
<script>
__Log('GD waitForInteraction event = ' + JSON.stringify(_event) );
</script>
</onentry>
<transition event="interaction.added" target="firststate">
<script>
_data.ixnid = _genesys.ixn.interactions[0].g_uid;
__Log('GD waitForInteraction event = ' + JSON.stringify(_event) );
_data.thisDN = _event.data.focusdeviceid;
</script>
</transition>
<transition event="interaction.udata.changed" target="firststate">
<script>
__Log('GD waitForInteraction event = ' + JSON.stringify(_event) );
_data.thisDN = _event.data.focusdeviceid;
</script>
</transition>
<transition event="interaction.ondivert" target="firststate">
<script>
__Log('GD waitForInteraction event = ' + JSON.stringify(_event) );
_data.thisDN = _event.data.focusdeviceid;
</script>
</transition>
</state>
<state id="firststate">
<onentry>
<script>
userdata = _genesys.ixn.interactions[0].udata;
__Log('GD firststate ' + JSON.stringify( _event ) );
</script>
<dialog:playsound type="'silence'" duration="1" />
</onentry>
<initial>
<transition target="globalstate" />
</initial>


<state id="globalstate">
<onentry>
<log expr="'GD Entering globalstate'" />
</onentry>

<transition event="interaction.udata.changed" cond="ValidateState(HANG_UP)" target="HANG_UP">
<log expr="'GD Target HANG UP'" />
</transition>

<transition event="interaction.udata.changed" cond="ValidateState(RECORD)" target="RECORD">
<log expr="'GD Target RECORD'" />
</transition>

<transition event="interaction.udata.changed" cond="ValidateState(STOP_RECORD)" target="STOP_RECORD">
<log expr="'GD Target STOP_RECORD'" />
</transition>

<transition event="interaction.udata.changed" cond="ValidateState(RECORD_FILE)" target="RECORD_FILE">
<log expr="'GD Target RECORD_FILE'" />
</transition>

<transition event="interaction.udata.changed" cond="ValidateState(STOP_RECORD_FILE)" target="STOP_RECORD_FILE">
<log expr="'GD Target STOP_RECORD_FILE'" />
</transition>

</state>

<state id="HANG_UP">
<onentry>
<log expr="'GD State id HANG UP'" />

</onentry>
<transition target="exit" />
</state>

<state id="RECORD">
<onentry>
<script>

</script>

<dialog:start requestid="_data.idRequeteRvi" type="'vxml'">
    <param name="APP_URI"  expr="'http://10.199.99.169:8080/POC/src/test.vxml'" />
    <param name="LANGUAGE" expr="'English (US)'" />
    <param name="myfilename" expr="'toto'" />   
    <param name="X-Genesys-CustomerName" expr="'toto'" /> 
    <param name="X-Genesys-CustomerParam" expr="'toto'" />
</dialog:start>
<log expr="'GD Dialog ID: ' + gDialogID['requestid']" />
<log expr="'GD Dialog ID: ' + JSON.stringify(gDialogID)" />
</onentry>
<transition event="dialog.start.requestid">
<log expr="'GD dialog.start.requestid: ' + JSON.stringify(gDialogID)" />
<log expr="'GD dialog.start.requestid: ' + JSON.stringify(_event)" />
<script>
gBackup = parseInt(gDialogID.requestid);
</script>
</transition>
<transition event="dialog.start.done">
<log expr="'GD Event dialog.start.done: ' + JSON.stringify(_event)" />
</transition>
<transition event="error.dialog.start">
<log expr="'GD Event error.dialog.start: ' + JSON.stringify(_event)" />
</transition>
<transition event="interaction.udata.changed" cond="ValidateState(HANG_UP)" target="HANG_UP">
<log expr="'GD Target HANG UP'" />
</transition>

<transition event="interaction.udata.changed" cond="ValidateState(STOP_RECORD)" target="STOP_RECORD">
<log expr="'GD Target STOP_RECORD'" />
</transition>

<transition event="interaction.udata.changed" cond="ValidateState(STOP_RECORD_FILE)" target="STOP_RECORD_FILE">
<log expr="'GD Target STOP_RECORD_FILE'" />
</transition>
</state>

<state id="RECORD_FILE">
<onentry>
<log expr="'GD State id RECORD_FILE'" />
</onentry>
<transition event="interaction.udata.changed" cond="ValidateState(HANG_UP)" target="HANG_UP">
<log expr="'GD Target HANG UP'" />
</transition>
<transition event="interaction.udata.changed" cond="ValidateState(STOP_RECORD)" target="STOP_RECORD">
<log expr="'GD Target STOP_RECORD'" />
</transition>
<transition event="interaction.udata.changed" cond="ValidateState(STOP_RECORD_FILE)" target="STOP_RECORD_FILE">
<log expr="'GD Target STOP_RECORD_FILE'" />
</transition>
</state>

    <state id="STOP_RECORD">
<onentry>
<dialog:stop requestid="_data.reqid" /> 
</onentry>
<transition event="dialog.stop.done" target="firststate" >
<log expr="'GD Event dialog.stop.done: ' + JSON.stringify(_event)" />
</transition>
<transition event="error.dialog.stop" target="firststate" >
<log expr="'GD Event error.dialog.stop: ' + JSON.stringify(_event)" />
</transition>
    </state>
    <state id="STOP_RECORD_FILE">
        <datamodel>
        <data id="reqid" />
    </datamodel>
<onentry>
<log expr="'GD State id STOP_RECORD_FILE'" />
<log expr="'GD Dialog ID: ' + gDialogID['requestid']" />
<log expr="'GD Dialog ID: ' + gDialogID" />
</onentry>
<transition event="interaction.udata.changed" cond="ValidateState(HANG_UP)" target="HANG_UP">
<log expr="'GD Target HANG UP'" />
</transition>

<transition event="interaction.udata.changed" cond="ValidateState(RECORD)" target="RECORD">
<log expr="'GD Target RECORD'" />
</transition>

<transition event="interaction.udata.changed" cond="ValidateState(RECORD_FILE)" target="RECORD_FILE">
<log expr="'GD Target RECORD_FILE'" />
</transition>
</state>

</state>
<state id="terminate">
<onentry>
<script>
__Log('GD Exit hangup in 5s');
</script>
<send delay="'5s'" event="'xyz'" />
    </onentry>
    <transition event="xyz" target="exit" />
</state>
<final id="exit" >
<onentry>
<script>
__Log('GD Exit normally');
</script>

<ixn:terminate interactionid="_data.ixnid" />

</onentry>
</final>
<final id="error" >
<onentry>
<script>
__Log('GD Exit on error');
</script>
<ixn:terminate interactionid="_data.ixnid" />
</onentry>
</final>
</scxml>
----------------test.scxml--

----------------test.vxml
<?xml version="1.0" encoding="utf-8"?>
<vxml version="2.1" xml:lang="en-US"
xmlns="http://www.w3.org/2001/vxml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:gvp="http://www.genesyslab.com/2006/vxml21-extension">

<!-- Auto Generated by Composer 8.1.201.52-->
<!-- Application Author:  Version: 1.0 CreatedOn:  -->

<!-- Global Scripts includes -->
<script src="../include/common.js" />
<script src="../include/ctic.js" />
<script src="../include/json.js" />
<script src="../include/DataAccess.js" />

<!-- Global Vars declarations -->
<script>
var AppState=new Object();
AppState.System=new Object();
AppState.System.RetainInputTypeVariableDefaultValue = false;

AppState.CallUUID = session.connection.uuid;
AppState.ANI = getANI();
AppState.DNIS = getDNIS();
AppState.USE_LCASE_USERDATAKEY = initSystemTypeVariable('USE_LCASE_USERDATAKEY',0);
AppState.USE_LCASE_USERDATAKEY = 1;
if (session.com.genesyslab.userdata != undefined)  {
AppState.GVPSessionID = getUserDataVariable('GVP-Session-ID');
} else {
AppState.GVPSessionID = 'undefined';
}
AppState.APP_LANGUAGE = initSystemTypeVariable('APP_LANGUAGE','en-US');
AppState.APP_ASR_LANGUAGE = initSystemTypeVariable('APP_ASR_LANGUAGE','en-US');
AppState.PREV_APP_LANGUAGE = initSystemTypeVariable('PREV_APP_LANGUAGE','undefined');
AppState.PREV_APP_ASR_LANGUAGE = initSystemTypeVariable('PREV_APP_ASR_LANGUAGE','undefined');
AppState.GRAMMARFILEDIR = initSystemTypeVariable('GRAMMARFILEDIR','../Resources/Grammars');
AppState.VOXFILEDIR = initSystemTypeVariable('VOXFILEDIR','../Resources/Prompts');
AppState.SCRIPTSDIR = initSystemTypeVariable('SCRIPTSDIR','../Scripts');
AppState.EnableReports = initSystemTypeVariable('EnableReports',false);
AppState.EnableSNMP = initSystemTypeVariable('EnableSNMP',false);
AppState.LAST_EVENT_NAME = initSystemTypeVariable('LAST_EVENT_NAME','undefined');
AppState.LAST_EVENT_MSG = initSystemTypeVariable('LAST_EVENT_MSG','undefined');
AppState.LAST_EVENT_URL = initSystemTypeVariable('LAST_EVENT_URL','undefined');
AppState.LAST_EVENT_ELEMENT = initSystemTypeVariable('LAST_EVENT_ELEMENT','undefined');
AppState.LAST_EVENT_LINE = initSystemTypeVariable('LAST_EVENT_LINE','undefined');
AppState.EnableFCR = initSystemTypeVariable('EnableFCR',true);
AppState.COMPOSER_WSSTUBBING = initSystemTypeVariable('COMPOSER_WSSTUBBING','0');
AppState.APP_OPM = initSystemTypeVariable('APP_OPM',eval('('+session.connection.protocol.sip.requesturi['parameters']+')'));
AppState.OCS_RecordURI = initSystemTypeVariable('OCS_RecordURI',getCallflowRecordURI());
AppState.OCS_URI = initSystemTypeVariable('OCS_URI',getCallflowOCSURI());
AppState.OCS_Record = initSystemTypeVariable('OCS_Record',getCallflowOCSRecord());
AppState.vLogEntry = 'Enter Value';
AppState.vLogResult = 'Enter Value';
AppState.vChoice = '123';
AppState.vInput = 'Enter Value';
AppState.vTest = 'Enter Value';

            AppState.filename = 'default_filename';
            AppState.useroperation = 'default_operation';
           
</script>

<!-- Global Scripts -->
<script srcexpr="AppState.VOXFILEDIR + '/PromptSwitch.js'" />
<script srcexpr="AppState.VOXFILEDIR + '/en-US/en-US.js'" />
<script>var f = new Format();</script>


<script srcexpr="AppState.VOXFILEDIR + '/en-US/customprompts.js'" />

<!-- Global Properties declarations -->
<property name="com.genesyslab.logtoasr" value="false" /> 
<property name="com.genesyslab.loglevel" value="5" />

<!-- This is the Record block -->
<form id="Record1">
       
        <script srcexpr="AppState.VOXFILEDIR + '/' + 'en-US' + '/' + 'en-US' + '.js'" />
        <script srcexpr="AppState.VOXFILEDIR + '/PromptSwitch.js'" />
        <block>
        <script>
            AppState.PREV_APP_LANGUAGE = AppState.APP_LANGUAGE;
            AppState.PREV_APP_ASR_LANGUAGE = AppState.APP_ASR_LANGUAGE;
            AppState.APP_LANGUAGE = 'en-US';
            AppState.APP_ASR_LANGUAGE = 'en-US';
        </script>        
        </block>
       
<!--
<block name="Record1P0">
  <prompt bargein="false"  gvp:langexpr="AppState.APP_LANGUAGE">
<audio expr="'../Resources/2sec.wav'"></audio>
    </prompt>
</block>
-->
    <var name="captureLocation" expr="getCaptureLocation('C:\\tmp', '')"/>
    <var name="recFileName" expr="AppState.filename"/>

    <property name="termchar" value="D"/>
    <record beep="false" dtmfterm="false" name="Record1RECORD" type="audio/wav;codec=ulaw" gvp:mintime="1s" maxtime="90s" gvp:timeout="90s" finalsilence="75s">
<grammar mode="dtmf" version="1.0" root="Record1_dtmfSettings">
<rule scope="public" id="Record1_dtmfSettings">
<one-of>
  <item>#</item>
  </one-of>
  </rule>
  </grammar> 
  </record>
<block>
<data name="Record1Result" enctype="multipart/form-data" src="../include/Capture.jsp" namelist="recFileName captureLocation Record1RECORD$.dest Record1RECORD" method="post"/>
<var name="recordResult" expr="Record1Result.documentElement.getElementsByTagName('status').item(0).firstChild.data"/>
<log expr="'Record Result:'+recordResult"/>
<if cond="!recordResult.match('SaveFile:Success')">
        <script>resetLanguage()</script>
<throw event="error.com.genesyslab.composer.recordCapture.failure" messageexpr="recordResult"/>
</if>
<assign name="AppState.vLogResult" expr="'file://' + Record1RECORD$.dest" />
        <script>resetLanguage()</script>

</block>
<catch event="noinput" count="1">
        <script>resetLanguage()</script>
  <throw event="com.genesyslab.composer.toomanynoinputs" message="exceeded the number of noinput retries" />
  </catch>
    <catch event="connection.disconnect.hangup">
    <!-- Post the recording to Web Server so that it does not get lost -->
   
    <data name="Record1Result" enctype="multipart/form-data" src="../include/Capture.jsp" namelist="recFileName captureLocation Record1RECORD$.dest Record1RECORD" method="post"/>
<log expr="'Record Result:'+Record1Result.documentElement.getElementsByTagName('status').item(0).firstChild.data"/>
<exit namelist="AppState.filename AppState.useroperation" />
</catch>
<catch >
    <!-- Post the recording to Web Server so that it does not get lost -->
   
    <data name="Record1Result" enctype="multipart/form-data" src="../include/Capture.jsp" namelist="recFileName captureLocation Record1RECORD$.dest Record1RECORD" method="post"/>
<log expr="'Record Result:'+Record1Result.documentElement.getElementsByTagName('status').item(0).firstChild.data"/>

<exit namelist="AppState.filename AppState.useroperation" />
</catch>
<error>
  <log expr="'Record Error:'+ JSON.stringify(_event)"/>
  <log expr="'Record Message:'+ JSON.stringify(_message)"/>
</error> 
    </form>
</vxml>
----------------test.vxml--

Offline Kevin S

  • Full Member
  • ***
  • Posts: 145
  • Karma: 4
Re: SCXML Dialog Stop
« Reply #1 on: July 22, 2016, 12:21:30 PM »
Did you ever work through this? I'm encountering the same issue.

In the SCXML documentation, it indicates that the <dialog:start> maps to PlayApplication (which the documentation says can be stopped with a <dialog:stop>), but that the <dialog:play> ALSO maps to the PlayApplication, but this cannot be stopped with a <dialog:stop>

Offline Kubig

  • Hero Member
  • *****
  • Posts: 2752
  • Karma: 44
Re: SCXML Dialog Stop
« Reply #2 on: July 22, 2016, 12:37:07 PM »
What say Genesys support on that (I assume that anybody have this solved with support and not only posting to the forum)<