Created
November 3, 2010 20:35
-
-
Save mheadd/661666 to your computer and use it in GitHub Desktop.
CCXML script to answer a Phono call, send an IM screen pop and connect to a predefined number.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <ccxml version="1.0" xmlns:voxeo="http://community.voxeo.com/xmlns/ccxml"> | |
| <var name="inboundID"/> | |
| <var name="outboundID"/> | |
| <var name="initState" expr="'state1'" /> | |
| <!-- Tropo API information --> | |
| <var name="tropoAPIToken" expr="'your-tropo-session-token'"/> | |
| <var name="tropoAPIEndPoint" expr="'http://api-internal.tropo.com/1.0/sessions?action=create&token=' + tropoAPIToken"/> | |
| <var name="TropoSendURL"/> | |
| <var name="screenPopMessage" expr="encodeURIComponent('This is a screen pop!')"/> | |
| <!-- Any valid IM network name such as AIM, GTALK, MSN, JABBER, TWITTER and YAHOO. --> | |
| <var name="network" expr="'JABBER'"/> | |
| <var name="sendTo" expr="'your-im-user-name'"/> | |
| <eventprocessor statevariable="initState"> | |
| <transition state="state1" event="connection.alerting"> | |
| <log expr="'*** INBOUND CONNECTION ALERTING ***'"/> | |
| <assign name="inboundID" expr="event$.connectionid" /> | |
| <assign name="initState" expr="'state2'"/> | |
| <assign name="TropoSendURL" expr="tropoAPIEndPoint + '&screenPopMessage=' + screenPopMessage"/> | |
| <assign name="TropoSendURL" expr="TropoSendURL + '&network=' + network"/> | |
| <assign name="TropoSendURL" expr="TropoSendURL + '&sendTo=' + sendTo"/> | |
| <send name="'http.get'" target="TropoSendURL" targettype="'basichttp'"/> | |
| </transition> | |
| <transition event="send.successful" state="state2"> | |
| <log expr="'*** Screen pop information sent to Tropo. Accept inbound call. ***'"/> | |
| <assign name="initState" expr="'state3'"/> | |
| <accept connectionid="inboundID" /> | |
| </transition> | |
| <transition event="error.send.failed" state="state2"> | |
| <log expr="'*** ERROR: Could not send screen pop information. ***'"/> | |
| <assign name="initState" expr="'state3'"/> | |
| <accept connectionid="inboundID" /> | |
| </transition> | |
| <transition state="state3" event="connection.connected"> | |
| <assign name="initState" expr="'state4'"/> | |
| <!-- 4079651112 is Voxeo Sales line --> | |
| <createcall dest="'tel:4079651112'" callerid="'1112223333'" connectionid="outboundID" timeout="'30s'"/> | |
| </transition> | |
| <transition state="state4" event="connection.progressing"> | |
| <log expr="'*** CONNECTION.PROGRESSING ***'"/> | |
| <assign name="initState" expr="'state5'"/> | |
| </transition> | |
| <transition state="state5" event="connection.connected"> | |
| <assign name="initState" expr="'state6'"/> | |
| <log expr="'*** CONNECTION.CONNECTED: INBOUND ***'"/> | |
| <join id1="inboundID" id2="outboundID" duplex="'full'"/> | |
| </transition> | |
| <transition state="state6" event="conference.joined"> | |
| <log expr="'*** CONFERENCE JOINED: INBOUND LEG TO OUTBOUND LEG ***'"/> | |
| </transition> | |
| <transition event="connection.disconnected"> | |
| <log expr="'*** CONNECTION.DISCONNECTED ***'"/> | |
| <exit/> | |
| </transition> | |
| <transition event="error.*"> | |
| <log expr="'*** AN ERROR HAS OCCURED: ' + event$.reason + ' ***'"/> | |
| <exit/> | |
| </transition> | |
| </eventprocessor> | |
| </ccxml> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| message($screenPopMessage, array('network'=>$network, 'to'=>$sendTo)); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment