CCXML 1.0 Development Guide Home  |  Frameset Home


<accept>  element

The <accept> element is used to explicitly accept and connect an incoming phone call


usage
<accept connectionid="(ECMAScript Expression)" hints="(ECMAScript Expression)">


attributes
connectionid Data Type: (ECMAScript Expression) Default: Optional
The connectionid attribute allows the developer to specify an ECMAScript expression whose string value serves as the identifier of a connection on which the incoming call is signalled. If this value is unspecified, then the CCXML interpreter will use the id value of the current event being processed. If the attribute value is invalid or there is no valid default value, an error.semantic event will be thrown.
hints Data Type: (ECMAScript Expression) Default: Optional
The hints attribute can be used to specify information used by the platform to configure the event processor. The value of this attribute should equate to an object that contains an array property of "headers"; for instance:


<script>
  var Hints = new Object();
  Hints.headers = new Object();
  Hints.headers['x-mySipHeader'] = 'hello world';
</script>


Note that 'hints.headers' stores what headers to add to the sip request, and that only headers starting with an 'x-' prefix are sent.



parents
none


children
none


code samples
<1.0 accept -connectionid> sample
<?xml version="1.0" encoding="UTF-8"?>
<ccxml version="1.0">

  <var name="initState" expr="'state_1'"/>
  <var name="MyCallID"/>

  <eventprocessor statevariable="initState">


    <transition event="connection.alerting" name="evt" state="state_1">
      <assign name="MyCallID" expr="evt.connectionid"/>
        <log expr="'***** MYCALLID =' + MyCallID + '****' "/>
      <log expr="'*** CALLER ID = ' + evt.connection.remote + '***'"/>
      <log expr="'*** CALLED ID = ' + evt.connection.local + '***'"/>
      <send data="'MyEvent'" target="session.id"/> 
    </transition>


    <transition event="MyEvent" name="evt">
        <accept connectionid="MyCallID"/>     
    </transition>


    <transition event="connection.connected">
      <log expr="'***** CALL WAS ANSWERED *****'"/>
      <dialogstart src="'null://?text=Congratulations, your call was answered. Goodbye.'" type="'application/x-texttospeech'"/> 
    </transition>


    <transition event="dialog.exit">
      <log expr="'***** CALL EXITING *****'"/>
      <exit/>
    </transition>

  </eventprocessor>
</ccxml>

<1.0 accept-hints> sample
<?xml version="1.0" encoding="UTF-8"?>
<ccxml version="1.0" xmlns="http://www.w3.org/2002/09/ccxml">

<eventprocessor>
  <transition event="connection.alerting" name="evt">
  <script>
    var myObj = new Object();
    myObj.value1 = 'result1';
    myObj.value2 = 'result2';
  </script>

  <log expr="'***** MYOBJ = ' + myObj"/>
  <log expr="'***** MYOBJ.VALUE1 = ' + myObj.value1"/>
  <log expr="'***** MYOBJ.VALUE2 = ' + myObj.value2"/>
  <accept hints="myObj"/>

  <log expr="'***** CALL ACCEPTED *****'"/>
  </transition>

  <transition event="connection.connected" name="evt">
  <dialogstart src="'null://?text=Congratulations, your call was accepted. Goodbye.'" type="'application/x-texttospeech'"/> 
  </transition>

  <transition event="dialog.exit">
    <log expr="'***** CALL EXITING *****'"/>
    <exit/>
  </transition>

  <transition event="error.*" name="evt">
  <log expr="'ERROR OCCURRED: '+ evt.name"/>
  <exit/>
  </transition>

</eventprocessor>
</ccxml>



additional links
W3C Specification


  ANNOTATIONS: EXISTING POSTS
0 posts - click the button below to add a note to this page

login



© 2006 Voxeo Corporation  |  Voxeo IVR  |  VoiceXML & CCXML IVR Developer Site