| CCXML 1.0-W3C Development Guide | Home | Frameset Home |
|
<join> and <unjoin> call legs to the conference <join>, and the <dialogstart> elements<createconference> element for the CCXML 1.0 session<send> element throughout the application; the value of this variable changes depending on what is currently being executed<eventprocessor> state variable
<?xml version="1.0" encoding="UTF-8" ?>
<ccxml version="1.0">
<!-- Connection ID Vars -->
<var name="call_0"/>
<var name="myConfID"/>
<!-- Dialog ID Vars -->
<var name="getConfID_Dlg"/>
<var name="joinTheConf_Dlg"/>
<var name="leftTheConf_Dlg"/>
<var name="noInput_Dlg"/>
<!-- App Vars -->
<var name="nextEvent"/>
<var name="audioPath" expr="'audio/'"/>
<var name="state_0" expr="'init'"/>
<eventprocessor statevariable="state_0">
</eventprocessor>
</ccxml>
<transition> events based on category: connection, conference, dialog, and error. Writing your CCXML 1.0 using this methodology can be really helpful in understanding the correlation between events, and some may feel that this sort of document structure makes the application code easier to read. Others may disagree, but these folks will just have to Lump It for the duration of this tutorial.
<!-- *********************** -->
<!-- Connection Events -->
<!-- *********************** -->
<transition state="init" event="connection.alerting">
<assign name="call_0" expr="event$.connectionid"/>
<accept connectionid="call_0"/>
</transition>
<transition state="init" event="connection.connected">
<log expr="'*** CALL CONNECTED ***'"/>
<assign name="state_0" expr="'connected'"/>
<send name="'getConfID'" target="session.id" targettype="'ccxml'"/>
</transition>
<transition event="connection.disconnected">
<log expr="'*** CALL DISCONNECTED ***'"/>
<exit/>
</transition>
<send> an event to our CCXML 1.0 session, which, upon the success of this event, will launch the initial VXML dialog prompting our caller to provide the application with a code that denotes the conference ID that he or she wishes to join to. And this particular facet of our development, we will cover next, have no fear.<transition> events all have several things in common: they are kicked off when a <send> request completes successfully, and all of these events will in turn, launch a VXML dialog to the caller. In addition to this, astute observers will also notice that all the various dialogs that we spawn consistently denote the "call_0" connectionid, (which indicates that yes, the dialog should play to the current call session), and also that each dialog specifies a particular "dialogid". Each "dialogid" value in question is dependent upon caller actions while within the conference itself, which we will cover shortly. <transition>), will then present a list of options to rejoin, exit, or start a new conference. And of course, should the caller play dumb when asked for input, we present the dialog within the "playNoInput" <transition> to let them know to wake the heck up.<assign> tag. This is done so that we can then handle each dialog.exit event seperately, whichallows us to direct the call flow based on the context of the current event that we are in. These specific "dialog.exit" events are detailed in the next step of the tutorial, of course.
<!-- *********************** -->
<!-- User Defined Events -->
<!-- *********************** -->
<transition event="getConfID">
<assign name="state_0" expr="'getConfID'"/>
<dialogstart src="audioPath + 'enterConferenceID.wav?termdigits=#&maxtime=10000&text=Enter your conference I D followed by the pound key.'"
type="'application/x-fetchdigits'"
dialogid="getConfID_Dlg"
connectionid="call_0"/>
</transition>
<transition event="joinTheConf">
<assign name="state_0" expr="'joinTheConf'"/>
<dialogstart src="audioPath + 'joinTheConference.wav?text=You will now join the conference. Press the pound key to exit without disconnecting.'"
type="'audio/wav'"
dialogid="joinTheConf_Dlg"
connectionid="call_0"/>
</transition>
<transition event="leftTheConf">
<assign name="state_0" expr="'leftTheConf'"/>
<dialogstart src="audioPath + 'leftTheConference.wav?termdigits=123&maxtime=30000&text=You have left the conference. Press one to disconnect. Press two to rejoin, or press three to join a different conference.'"
type="'application/x-fetchdigits'"
dialogid="leftTheConf_Dlg"
connectionid="call_0"/>
</transition>
<transition event="playNoInput">
<assign name="state_0" expr="'playNoInput'"/>
<dialogstart src="audioPath + 'noInput.wav?text=I am sorry. I did not hear anything.'"
type="'audio/wav'"
dialogid="noInput_Dlg"
connectionid="call_0"/>
</transition>
<send> an event to the CCXML 1.0 session that will result in a new dialog getting executed, (with the exception of when we just <join> the caller to the conference. Most of these events also update our "nextEvent" variable with a value as well: This is to make sure that in the event that we need to circle back to our "playNoInput" dialog, and re-enter the current dialog, the app will have clearly defined instructions as to which event to throw and transition our caller to. If our caller gives the app the silent treatment, and doesn't enter anything when asked for a conference ID, (or fails to press the termdigit of dtmf-pound), we then execute the "playNoInput" dialog, and upon exiting, will use the value of the "nextEvent" to execute the correct <transition>.<transition> events specific to dialog.exit events that we will whip out in this section of the tutorial, and we will list these out with a brief description of when each of these comes into play:<transition> defined in Step 2 above, and the CCXML execution will then prompt the caller to re-enter a conference ID, (hopefully a valid one, this time) within the same "getConfID" <transition> that we just executed. If we did recieve a valid conference ID, then a conference is then created with the "confname" value being set to the conference PIN that the caller entered.<transition> will then <join> the caller into the conference after playing a confirmation message to the caller in the "joinTheConf" dialog above. In our dialog.exit, we specify a "voxeo-termdigits" dialog extension attribute that will allow the caller to be unjoined from the conference with the press of the dtmf-pound key, which can, in turn generate an event that can be handled by the "leftTheConf" handlers that we have defined both in this section, and in the "dialog" handlers above.<transition> of the same name in Step 2, the caller may leave the conference, (dtmf-1), rejoin the conference, (dtmf-2), or join a new conference, (dtmf-3). Depending on the keypress, this dialog.exit <transition> contains some conditional logic that will execute the appropriate actions: either to disconnect the caller, programmatically rejoin the conference, or to bring the caller back to the "getConfID" dialog by sending an event back to the CCXML 1.0 session to be handled by, (you guessed it), the aforementioned dialog <transition> handlers that we discussed in Step 2. We base our conditional logic on the value of the digit that the app returns upon a dialog.exit event. For the "application/x-fetchdigits" dialog extension type, the value that will be returned to the CCXML 1.0 application upon a dialog.exit can always be referenced by using the "event$.values.termdigit" syntax.
<!-- *********************** -->
<!-- Dialog Exit Events -->
<!-- *********************** -->
<transition state="getConfID" event="dialog.exit">
<if cond="event$.values.digits == ''">
<log expr="'*** USER DID NOT ENTER CONFERENCE ID ***'"/>
<assign name="nextEvent" expr="'getConfID'"/>
<send name="'playNoInput'" target="session.id" targettype="'ccxml'"/>
<else/>
<log expr="'*** CONFERENCE ID ENTERED: [' + event$.values.digits + '] ***'"/>
<createconference conferenceid="myConfID" confname="event$.values.digits"/>
</if>
</transition>
<transition state="joinTheConf" event="dialog.exit">
<log expr="'*** JOINING CONFERENCE ***'"/>
<join id1="call_0" id2="myConfID" entertone="'true'" exittone="'true'" voxeo-termdigits="'#'"/>
</transition>
<transition state="leftTheConf" event="dialog.exit">
<log expr="'*** USER PRESSED: [' + event$.values.termdigit + '] ***'"/>
<if cond="event$.values.termdigit == 1">
<log expr="'*** USER CHOSE TO DISCONNECT ***'"/>
<disconnect connectionid="call_0"/>
<elseif cond="event$.values.termdigit == 2"/>
<log expr="'*** USER CHOSE TO REJOIN CONFERENCE ***'"/>
<send name="'joinTheConf'" target="session.id" targettype="'ccxml'"/>
<elseif cond="event$.values.termdigit == 3"/>
<log expr="'*** USER CHOSE TO JOIN NEW CONFERENCE ***'"/>
<send name="'getConfID'" target="session.id" targettype="'ccxml'"/>
<else/>
<log expr="'*** USER DID NOT PRESS A TERMDIGIT ***'"/>
<assign name="nextEvent" expr="'leftTheConf'"/>
<send name="'playNoInput'" target="session.id" targettype="'ccxml'"/>
</if>
</transition>
<transition state="playNoInput" event="dialog.exit">
<log expr="'*** NOINPUT DIALOG COMPLETE / THROWING NEXT EVENT: [' + nextEvent + '] ***'"/>
<send name="nextEvent" target="session.id" targettype="'ccxml'"/>
</transition>
<send> an event that will make this happen. The "joinTheConf" event that we send within this <transition> will be trapped within the handler by the same name within our "dialog.exit" event, which you will notice contains the actual <join> directive. And when this occurs, the event will be trapped by the "conference.joined" handler we have below, which will spit out a message in the Logger that confirms when this has completed successfully.<send> a 'leftTheConf' event that allows us to invoke the dialog by the same name where the caller options are clearly listed.
<!-- *********************** -->
<!-- Conference Events -->
<!-- *********************** -->
<transition event="conference.created">
<log expr="'*** CONFERENCE CREATED ***'"/>
<send name="'joinTheConf'" target="session.id" targettype="'ccxml'"/>
</transition>
<transition event="conference.joined">
<log expr="'*** CALL JOINED TO CONFERENCE ***'"/>
</transition>
<transition event="conference.unjoined">
<log expr="'*** CALL UNJOINED FROM CONFERENCE ***'"/>
<send name="'leftTheConf'" target="session.id" targettype="'ccxml'"/>
</transition>
<!-- *********************** -->
<!-- General Exceptions -->
<!-- *********************** -->
<transition event="error.*">
<log expr="'*** AN ERROR HAS OCCURRED: [' + event$.reason + '] ***'"/>
<exit/>
</transition>
<?xml version="1.0" encoding="UTF-8" ?>
<ccxml version="1.0">
<!-- Connection ID Vars -->
<var name="call_0"/>
<var name="myConfID"/>
<!-- Dialog ID Vars -->
<var name="getConfID_Dlg"/>
<var name="joinTheConf_Dlg"/>
<var name="leftTheConf_Dlg"/>
<var name="noInput_Dlg"/>
<!-- App Vars -->
<var name="nextEvent"/>
<var name="audioPath" expr="'audio/'"/>
<var name="state_0" expr="'init'"/>
<eventprocessor statevariable="state_0">
<!-- *********************** -->
<!-- Connection Events -->
<!-- *********************** -->
<transition state="init" event="connection.alerting">
<assign name="call_0" expr="event$.connectionid"/>
<accept connectionid="call_0"/>
</transition>
<transition state="init" event="connection.connected">
<log expr="'*** CALL CONNECTED ***'"/>
<assign name="state_0" expr="'connected'"/>
<send name="'getConfID'" target="session.id" targettype="'ccxml'"/>
</transition>
<transition event="connection.disconnected">
<log expr="'*** CALL DISCONNECTED ***'"/>
<exit/>
</transition>
<!-- *********************** -->
<!-- User Defined Events -->
<!-- *********************** -->
<transition event="getConfID">
<assign name="state_0" expr="'getConfID'"/>
<dialogstart src="audioPath + 'enterConferenceID.wav?termdigits=#&maxtime=10000&text=Enter your conference I D followed by the pound key.'"
type="'application/x-fetchdigits'"
dialogid="getConfID_Dlg"
connectionid="call_0"/>
</transition>
<transition event="joinTheConf">
<assign name="state_0" expr="'joinTheConf'"/>
<dialogstart src="audioPath + 'joinTheConference.wav?text=You will now join the conference. Press the pound key to exit without disconnecting.'"
type="'audio/wav'"
dialogid="joinTheConf_Dlg"
connectionid="call_0"/>
</transition>
<transition event="leftTheConf">
<assign name="state_0" expr="'leftTheConf'"/>
<dialogstart src="audioPath + 'leftTheConference.wav?termdigits=123&maxtime=30000&text=You have left the conference. Press one to disconnect. Press two to rejoin, or press three to join a different conference.'"
type="'application/x-fetchdigits'"
dialogid="leftTheConf_Dlg"
connectionid="call_0"/>
</transition>
<transition event="playNoInput">
<assign name="state_0" expr="'playNoInput'"/>
<dialogstart src="audioPath + 'noInput.wav?text=I am sorry. I did not hear anything.'"
type="'audio/wav'"
dialogid="noInput_Dlg"
connectionid="call_0"/>
</transition>
<!-- *********************** -->
<!-- Dialog Exit Events -->
<!-- *********************** -->
<transition state="getConfID" event="dialog.exit">
<if cond="event$.values.digits == ''">
<log expr="'*** USER DID NOT ENTER CONFERENCE ID ***'"/>
<assign name="nextEvent" expr="'getConfID'"/>
<send name="'playNoInput'" target="session.id" targettype="'ccxml'"/>
<else/>
<log expr="'*** CONFERENCE ID ENTERED: [' + event$.values.digits + '] ***'"/>
<createconference conferenceid="myConfID" confname="event$.values.digits"/>
</if>
</transition>
<transition state="joinTheConf" event="dialog.exit">
<log expr="'*** JOINING CONFERENCE ***'"/>
<join id1="call_0" id2="myConfID" entertone="'true'" exittone="'true'" voxeo-termdigits="'#'"/>
</transition>
<transition state="leftTheConf" event="dialog.exit">
<log expr="'*** USER PRESSED: [' + event$.values.termdigit + '] ***'"/>
<if cond="event$.values.termdigit == 1">
<log expr="'*** USER CHOSE TO DISCONNECT ***'"/>
<disconnect connectionid="call_0"/>
<elseif cond="event$.values.termdigit == 2"/>
<log expr="'*** USER CHOSE TO REJOIN CONFERENCE ***'"/>
<send name="'joinTheConf'" target="session.id" targettype="'ccxml'"/>
<elseif cond="event$.values.termdigit == 3"/>
<log expr="'*** USER CHOSE TO JOIN NEW CONFERENCE ***'"/>
<send name="'getConfID'" target="session.id" targettype="'ccxml'"/>
<else/>
<log expr="'*** USER DID NOT PRESS A TERMDIGIT ***'"/>
<assign name="nextEvent" expr="'leftTheConf'"/>
<send name="'playNoInput'" target="session.id" targettype="'ccxml'"/>
</if>
</transition>
<transition state="playNoInput" event="dialog.exit">
<log expr="'*** NOINPUT DIALOG COMPLETE / THROWING NEXT EVENT: [' + nextEvent + '] ***'"/>
<send name="nextEvent" target="session.id" targettype="'ccxml'"/>
</transition>
<!-- *********************** -->
<!-- Conference Events -->
<!-- *********************** -->
<transition event="conference.created">
<log expr="'*** CONFERENCE CREATED ***'"/>
<send name="'joinTheConf'" target="session.id" targettype="'ccxml'"/>
</transition>
<transition event="conference.joined">
<log expr="'*** CALL JOINED TO CONFERENCE ***'"/>
</transition>
<transition event="conference.unjoined">
<log expr="'*** CALL UNJOINED FROM CONFERENCE ***'"/>
<send name="'leftTheConf'" target="session.id" targettype="'ccxml'"/>
</transition>
<!-- *********************** -->
<!-- General Exceptions -->
<!-- *********************** -->
<transition event="error.*">
<log expr="'*** AN ERROR HAS OCCURRED: [' + event$.reason + '] ***'"/>
<exit/>
</transition>
</eventprocessor>
</ccxml>
| ANNOTATIONS: EXISTING POSTS |
| login |
|