We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics

How to insert sessionid and session.telephone.ani into URL

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
Polad
Posts: 21
Joined: Wed Dec 15, 2010 3:50 am

How to insert sessionid and session.telephone.ani into URL

Post by Polad »

Dear support team,
I need your advice. I'm trying to implement dynamic IVR via VoiceXML in our company. At the moment I have a direct URL to write logs into database. The URL is: http://XXX.XXX.XXX.XXX:9090/Rotocell/in ... word=12345. I need to create 2 variables: sessionid and session.telephone.ani and replace with ani= var for session.telephone.ani and sid=var for sessionid. Could you please help with correct path to perform it. I just need correct syntax. My code is below. I have marked ani and sid sections in subdialog URL in bold. Thanks beforehand.

<?xml version="1.0" ?>
<vxml version="2.1" xmlns="http://www.w3.org/2001/vxml" xml:lang="en-US" >

<var name="v_msisdn" expr="session.telephone.ani"/>
<var name="v_id" expr="sessionid"/>

<filled>
<goto next="#sub"/>
</filled>


<form id="sub">
<subdialog name ="sub" src="http://XXX.XXX.XXX.XXX:9090/Rotocell/in ... ="v_msisdn"[/b]&sid=v_id&dtmfcode=NAR&password=12345">
<filled>
<if cond="sub.ret == 0">

<goto next="start.vxml"/>

<elseif cond="sub.ret == 1" />

<goto next="start.vxml"/>

<elseif cond="sub.ret == 2" />
<prompt>
<audio src="black.wav"/>
</prompt>
<exit/>

<elseif cond="sub.ret == 3" />
<prompt>
<audio src="insuf.wav"/>
</prompt>
<exit/>

</if>
</filled>
</subdialog>
</form>
</vxml>

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

Re: How to insert sessionid and session.telephone.ani into U

Post by support »

Hi Polad,

You would want to utilize the namelist attribute of the subdialog tag. For example:

Code: Select all

<var name="ani" expr="session.telephone.ani"/>
<var name="sid" expr="session.id"/>
<var name="dtmfcode" expr="'NAR'"/>
<var name="password" expr="'12345'"/>

<subdialog name ="sub" src="http://XXX.XXX.XXX.XXX:9090/Rotocell/index.php" namelist="ani sid dtmfcode password" method="get">
This will send the data to your internal script as GET variables with the names supplied within the namelist.

Hope this helps.

Regards,
Plum Support

Polad
Posts: 21
Joined: Wed Dec 15, 2010 3:50 am

Re: How to insert sessionid and session.telephone.ani into U

Post by Polad »

Dear support team,

Thank you for quick response. Now everything work correctly except "session.id". Unfortunately it came with empty value. Could you please help me with this. May be I forgot to add something in my code.

Thanks beforehand.

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

Re: How to insert sessionid and session.telephone.ani into U

Post by support »

Hi Polad,

We're unsure of how you're referencing the session ID value so that it actually failed for you. This is what your current application would look like:

Code: Select all

<?php
header("Content-type: text/xml");
echo "<?xml version=\"1.0\"?>";
?>

<vxml version="2.1" xmlns="http://www.w3.org/2001/vxml" xml:lang="en-US" >

  <var name="ani" expr="session.telephone.ani"/>
  <var name="sid" expr="session.id"/>
  <var name="dtmfcode" expr="'NAR'"/>
  <var name="password" expr="'12345'"/>

  <form id="sub">
    <subdialog name ="sub" src="output.php" namelist="ani sid dtmfcode password" method="get">
      <filled>
	<if cond="sub.ret == 0">
	  <goto next="start.vxml"/>
	<elseif cond="sub.ret == 1" />
	  <goto next="start.vxml"/>
	<elseif cond="sub.ret == 2" />
	  <prompt>
	    <audio src="black.wav"/>
	  </prompt>
	  <exit/>
	<elseif cond="sub.ret == 3" />
	  <prompt>
	    <audio src="insuf.wav"/>
	  </prompt>
	  <exit/>
	</if>
      </filled>
    </subdialog>
  </form>
</vxml>
For our testing, we submitted the values to a different script: output.php.

Output.php was a basic return script:

Code: Select all

<?php
header("Content-type: text/xml");
echo "<?xml version=\"1.0\"?>\n";
echo "<vxml version=\"2.1\">\n";

foreach ($_GET as $k=>$v) {
  echo "<!-- $k: $v -->\n";
}
?>

  <form>
    <block>
      <var name="ret" expr="'2'"/>
      <return namelist="ret"/>
    </block>
  </form>
</vxml>
When we put a test call into the main script we found that the black.wav audio file attempted to play in the log file. When we viewed the return VXML for output.wav we found this:

Code: Select all

<?xml version="1.0"?>
<vxml version="2.1">
<!-- ani: 6177123000 -->
<!-- dtmfcode: NAR -->
<!-- password: 12345 -->
<!-- sid: 000028;002;1328040556 -->

  <form>
    <block>
      <var name="ret" expr="'2'"/>
      <return namelist="ret"/>
    </block>
  </form>
</vxml>
Hope this helps.

Regards,
Plum Support

Polad
Posts: 21
Joined: Wed Dec 15, 2010 3:50 am

Re: How to insert sessionid and session.telephone.ani into U

Post by Polad »

Dear support team,

Thank you very much. Now everything OK.

Post Reply