Jump to content


< Back to Forum


 

Split Callerid Information Into Components


  • Please log in to reply

#1 SupportTeam 05 February 2003 - 10:35 AM

My telephone service (Vonage) is sending 11 digits (1-XXX-XXX-XXXX) as the calling number in the callerid string.

I would like to be able to split the calling number into it's North American fields (NPA, NXX, Station) for database queries.

I beleive the evaluate module may be the way to go here, but I'm not familiar with it's expressions.

#2 SupportTeam 05 February 2003 - 10:35 AM

You'll need to write a VB Script in th eRun VBS module and in it use the right(), left() and mid() functions to extract the 3 fields - then you can seave them in the results file so that they will be available as "result variables" throughout the rest of the script.

#3 SupportTeam 05 February 2003 - 10:36 AM

Thanks for pointing me in the right direction.


I'm more of a Unix guy, so I used some cygwin utilities to do virtually the same thing.

This example just strips the leading "1".

In the run program module I use this command:
C:\splitdn.bat $RV_CIDNUMBER > c:\shlreslt.txt

The splitdn.bat file looks like this:
@echo %1 | c:\cygwin\bin\gawk '{print "[dn]{"substr($0,2,3) substr($0,5,3) substr($0,8,4)"}"}'

The output in the shlreslt.txt file looks like this:
[dn]{6123625800}

#4 greiner 13 February 2003 - 08:58 AM

If you are using VB there is a better function than right, left, mid. It's called split.

Example:


Dim x() as string
dim y as string


y="1-888-555-1212"

x = split(y,"-")


Results:

x(0) = "1"
x(1) = "888"
x(2) = "555"
x(3) = "1212"