• No results found

GTD Manipulation Sample Scripts

In document Cisco VoiceXML Programmer s Guide (Page 122-125)

Here are some sample scripts you can use to get familiar with GTD Manipulation.

Accessing GTD parameters received during call setup. <vxml version="2.0">

<form>

<var name="X" expr="com.cisco.signal.gtdlist['setup_indication']"/> <var name="rgn1" expr="X.RGN[0].noa"/>

<var name="rgn2" expr="X.RGN[0].npi"/> <var name="rgn3" expr="X.RGN[0].pi"/> <var name="x" expr="X.RGN[0]['#']"/>

<var name="cgn1" expr="X.CGN[0].noa"/> <var name="cgn2" expr="X.CGN[0].npi"/> <var name="cgn3" expr="X.CGN[0].pi"/> <var name="cgn4" expr="X.CGN[0].si"/> <var name="y" expr="X.CGN[0]['#']"/> <var name="cpn1" expr="X.CPN[0].noa"/> <var name="cpn2" expr="X.CPN[0].npi"/> <var name="z" expr="X.CPN[0]['#']"/> <block>

<log> x is:<value expr="x"/>:</log> <log> y is:<value expr="y"/>:</log> <log> z is:<value expr="z"/>:</log> <var name="rc" expr="'passed'"/>

<if cond="x != '9876543210' &amp;&amp; y != '9876543210' &amp;&amp; z != '0123456789'">

<assign name="rc" expr="'failed'"/> </if>

<log> WB_FEAT_GTD_1001:END: <value expr="rc"/> </log> <disconnect/>

</block> </form> </vxml>

Accessing a Valid but Unavailable GTD Parameter <form>

<var name="X" expr="com.cisco.signal.gtdlist['setup_indication']"/> <var name="pcidat" expr="X.PCI[0].dat"/>

<block>

<if cond="pcidat== 'Undefined' || pcidat== 'undefined'">

<log> Got expected value for GTD parameter PCI.dat as <value expr="pcidat"/>:</log>

<else/>

<log> Got UNEXPECTED value for GTD parameter PCI.dat as <value expr="pcidat"/>:</log>

<assign name="test" expr="'failed'"/> </if> <goto next="#printresult"/> </block> </form> <form id="printresult"> <block>

<log> <value expr="testcase"/>:END: <value expr="test" /> </log> </block>

</form> </vxml>

Creating a GTD Message <form>

<var name="my_new_gtd0" expr="new com.cisco.objclass.gtd()"/> <var name="my_new_gtd1" expr="new com.cisco.objclass.gtd()"/> <var name="my_new_gtd2" expr="new com.cisco.objclass.gtd()"/> <var name="my_new_gtd3" expr="new com.cisco.objclass.gtd()"/> <var name = "my_new_gtd0.message_type" expr = "'IAM'"/> <var name = "my_new_gtd1.message_type" expr = "'ACM'"/>

<var name = "my_new_gtd3.message_type" expr = "'REL'"/> <block>

<log> message type for my_new_gtd0 is <value expr="my_new_gtd0.message_type"/></log>

<log> message type for my_new_gtd1 is <value expr="my_new_gtd1.message_type"/></log>

<log> message type for my_new_gtd2 is <value expr="my_new_gtd2.message_type"/></log>

<log> message type for my_new_gtd3 is <value expr="my_new_gtd2.message_type"/></log>

<goto next="#printresult"/> </block>

</form>

<catch event="error.semantic">

<assign name="res" expr="'failed'"/> <goto next="#printresult"/>

</catch>

<form id="printresult"> <block>

<log> <value expr="testcase"/>:END:<value expr="res"/> </log> </block>

</form> </vxml>

Modifying Attributes in a GTD Message <form>

<var name="my_gtd0" expr="new com.cisco.objclass.gtd()"/> <var name = "my_gtd0.message_type" expr = "'IAM'" /> <var name = "my_gtd0.RGN[0].npi" expr = "4" /> <var name = "my_gtd0.RGN[0].pi" expr = "'y'" />

<var name = "my_gtd0.RGN[0]['#']" expr = "'408-527-4800'" />

<!-- Second gtd message use if needed -->

<var name="my_gtd1" expr="new com.cisco.objclass.gtd()"/> <var name = "my_gtd1.message_type" expr = "'CPG'" /> <block>

<log> message type for my_gtd0 is <value expr="my_gtd0.message_type"/></log> <log> rgn.npi for my_gtd0 is <value expr="my_gtd0.RGN[0].npi"/></log> <log> rgn.pi for my_gtd0 is <value expr="my_gtd0.RGN[0].pi"/></log> <log> rgn.# for my_gtd0 is <value expr="my_gtd0.RGN[0]['#']"/></log>

<if cond="my_gtd0.RGN[0].npi== '4' || my_gtd0.RGN[0].pi== 'y' || my_gtd0.RGN[0]['#'] == '408-527-4800'">

<assign name="res" expr="'passed'"/> <else/>

<log> Failed to modify new GTD instance.</log> </if> <goto next="#printresult"/> </block> </form> <form id="printresult"> <block>

<log> <value expr="testcase"/>:END:<value expr="res"/> </log> </block>

</form> </vxml>

Using <transfer> and <disconnect> for GTD Manipulation

The Cisco-specific attribute cisco-gtd is used with the <transfer> element to send GTDs on the outgoing call leg.

<transfer name="gtd_xfer" dest="tel: +1-555-555-0167" bridge="true" ! ! cisco-gtd="my_gtd" ! ! />

It is also used as an attribute of the <disconnect> element to send GTDs during a call release.

<disconnect> cisco-disc_cause=”cause_code” cisco-gtd=”my_gtd” !

/>

In document Cisco VoiceXML Programmer s Guide (Page 122-125)