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 split session.telephone.ani?

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 split session.telephone.ani?

Post by Polad »

Dear support team,

I have one question. I assign variable session.telephone.ani and I see numbers which dial my application. They come with "70" and "77" prefixes. Now I need to assign some property, something like "if number start with 77 goto next hello.vxml else goto next change.vxml". Could you please help me with correct syntax?

Thanks beforehand.

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

Re: How to split session.telephone.ani?

Post by support »

Hi Polad,

The following example below will allow you to direct callers to specific scripts depending on the prefixes of their phone number:

splitnumbers.php:

Code: Select all

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

<form id="splitnumber">

<var name="phonenum" expr="session.telephone.ani"/>
<var name="firsttwo" expr="phonenum.substring(0,2)"/>

<block>
  <if cond="firsttwo==77">
    <goto next="hello.vxml"/>
  <else/>
    <goto next="change.vxml"/>
  </if>
</block>

</form>
</vxml>
From this example, the variable, phonenum, is set to the value of session.telephone.ani (the caller's phone number). Next, the variable, firsttwo, is set to the substring of the first two numbers of the telephone number. From here, the application proceeds to the block and if the user's first two digits of their phone number are 77, they get directed to hello.vxml. If the user's first two digits are a number other than 77, they get directed to change.vxml.

Hope this helps.

Regards,
Plum Support

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

Re: How to split session.telephone.ani?

Post by Polad »

Dear support team,

Thank you very much. I just would like to ask one more question. If I need to assign property for first 3 digits (070), should I make changes in <var name="firsttwo" expr="phonenum.substring(0,2)"/> and change it to <var name="firstthree" expr="phonenum.substring(0,3)"/>. Am I correct?

Thank beforehand.

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

Re: How to split session.telephone.ani?

Post by support »

Hi Polad,

Yes, that is correct.

Regards,
Plum Support

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

Re: How to split session.telephone.ani?

Post by Polad »

Dear support team,

Everything is working correctly. Thank you very much.

Post Reply