Call Control XML and the Voice Conference Manager

by Moshe Yudkowsky





Listing One



(a)

<?xml version="1.0" encoding="UTF-8"?>

<ccxml version="1.0">

<!-- list of symbolic substate names: -->

<var name="s_init"                  expr="'s_init'"/>

<var name="s_welcomeBase"           expr="'s_welcomeBase'"/>

<var name="s_findUserRequest"       expr="'s_findUserRequest'"/>

<!-- user event names -->

<var name="info"                    expr="'info'"/>

<var name="nextstate"               expr="'nextstate'"/>

<!-- Vars used throughout -->

<var name="callState" expr="s_init"/>

<!-- URLs of VoiceXML scripts -->

<var name="vxml_prefix" expr="''"/>

<var name="vxml_type" expr="'application/xml+vxml'"/>

<var name="vxml_greeting" expr=" vxml_prefix + 'greeting.vxml'"/>

<!-- URLs of CGI scripts -->

<var name="url_prefix" expr="'http://www.example.com/cgi-bin/vcm/'"/>



(b)

<eventprocessor statevariable="callState">

<transition state="s_init" event="connection.alerting" name="evt">

    <accept/>

    <send event="url_event" target="url_CheckCallerID" 

                     name="'checkCallerID'" namelist="evt.callerid"/>

    <send event="'checkCallerID_timeout'" target="session.id" 

                       delay="20000" name="'checkCallerID_timeout'"/>

    <assign name="callState" expr="s_welcomeBase"/>

</transition>

<!-- If call disconnects -->

<transition state="s_init" event="connection.disconnected">

    <log expr="'Base call disconnected, exiting, state=' + callState"/>

    <exit/>

</transition>   



(c)

<transition state="s_welcomeBase" event="connection.connected" name="evt">

    <log expr="'Base call connected'"/>

    <dialogstart src="vxml_greeting" type="vxml_type"/>

</transition>



(d)

<transition state="s_welcomeBase" event="dialog.exit" name="evt">

    <if cond="s_welcomeBase_gotdata == 1">

        <assign name="callState" expr="s_getConfereeList"/>

        <send event="nextstate" target="session.id" name="'nextstate_2'"/>

    </if>

    <assign name="s_welcomeBase_finishedgreeting" expr="1"/>

</transition>



(e)

<transition state="s_welcomeBase" event="user.calleriddata" name="evt">

    <if cond="evt.valid != 'True'">

        <exit/>

    </if>

    <var name="grammar_menu" expr="evt.grammar_menu"/>

    <if cond="s_welcomeBase_finishedgreeting == 1">

        <assign name="callState" expr="s_getConfereeList"/>

        <send event="nextstate" target="session.id" name="'nextstate_1'"/>

    </if>

    <assign name="s_welcomeBase_gotdata" expr="1"/>

</transition>



(f)

<transition state="s_welcomeBase" event="error.send.*" name="evt">

    <log expr="'ERROR: ' + evt.error + ' eventid: ' + evt.eventid"/>

    <exit/>

</transition>

<transition state="s_welcomeBase"event="user.checkCallerID_timeout"name="evt">

    <exit/>

</transition>



(g)

<transition state="s_findUserRequest" event="user.nextstate" name="evt">

   <dialogstart src="vxml_menu" type="vxml_type" 

         connectionid="base_connectionid" namelist=

            "grammar_menu s_findUserRequest_count"/>

</transition>



(h)

<transition state="s_makeConfObject" event="user.nextstate" name="evt">

    <fetch next="ccxml_conf_main" fetchid="foo"/> 

</transition>

<transition state="s_makeConfObject" event="fetch.done" name="evt">

    <createccxml fetchid="evt.fetchid" sessionid="conf_session" />

    <send event="info" target="conf_session" 

                              namelist="phoneList phoneListCount"/>

    <dialogstart src="vxml_confstarted" type="vxml_type" 

                                  connectionid="base_connectionid"/>

</transition>





Listing Two



calleriddata

valid=True

grammar_menu=grammar.xml





Listing Three



<?xml version="1.0"?>

<vxml version="2.0">

<menu>

    <prompt>

        Please choose from the following options: <enumerate/>

    </prompt>

    <choice event="choice" message="conference">

        Start conference call

    </choice>

    <choice event="choice" message="add">

        Add new users

    </choice>

    <choice event="choice" message="edit">

        Edit list of users

    </choice>

    <noinput>

        Please choose from the following options: <enumerate/>

    </noinput>

    <nomatch>

        Please choose from the following options: <enumerate/>

    </nomatch>

</menu>

<!-- find choice by catching event -->

<catch event="choice">

    <var name="menu_choice" expr="_message"/>

    <exit namelist="menu_choice"/>

</catch>

</vxml>





Listing Four



(a)

<transition state="cm_makeConfObject" event="user.nextstate">

    <createconference conferenceid="confID"/>

</transition>



(b)

<transition state="cm_addConferees" event="user.addconferee">

    <!-- Check to see if more to add -->

    <if cond="cm_addConfeerecm_listPtr &lt; phoneListCount" >

        <!-- Yes. get phone number (work around lack of ECMAScript array) -->

        <assign name="currentPhone" 

                    expr="phoneList.substr(11*cm_addConfeerecm_listPtr,10)"/>

        <fetch next="ccxml_conf_legs" fetchid="foo"/> 

                                      <!-- get ready to create call leg -->

    <else/>

        <!-- No, all added, next state -->

        <assign name="cm_callState" expr="cm_confInProgress"/>

        <send event="nextstate" target="session.id"/>

    </if>

</transition>

<!-- after fetch, start instance -->

<transition state="cm_addConferees" event="fetch.done">

    <createccxml fetchid="evt.fetchid" sessionid="singleCallLegSessionID" />

    <!-- send phone number, conference object to instance just started -->

    <send event="info" target="singleCallLegSessionID" 

                                         namelist="currentPhone confID home"/>

    <!-- check if more calls to add. -->

    <send event="addconferee" target="session.id"/>

</transition>





Listing Five



(a)

<transition state="cl_init" event="user.info" name="evt">

    <assign name="destPhone" expr="evt.currentPhone"/>

    <assign name="conf" expr="evt.confID"/>

    <assign name="home" expr="evt.home"/>

    <createcall dest="destPhone"/> 

</transition>



(b)

<!-- play welcome message -->

<transition state="cl_init" event="connection.connected" name="evt">

    <!-- play an annoucement as each is connected -->

    <dialogstart src="vxml_youarejoining" type="vxml_type"/>

    <assign name="cl_callState" expr="cl_callInProgress"/>

    <assign name="thisCall" expr="evt.callid"/><!--should be "connectionid"-->

</transition>

<!-- join into the conference -->

<transition state="cl_callInProgress" event="dialog.exit">

    <join id1="thisCall" id2="conf"/>

</transition>



(c)

<transition state="cl_dropout_start" event="user.dropout">

    <unjoin id1="thisCall" id2="conf"/>

</transition>











 



4



