×

Warning message

  • Cisco Support Forums is in Read Only mode while the site is being migrated.
  • Cisco Support Forums is in Read Only mode while the site is being migrated.

Check calling number start with +1 and second digit is not 8 in CCX

Answered Question
Apr 10th, 2014
User Badges:
  • Silver, 250 points or more

Hi,

Is it possible to check if the ANI that is seen by the CCX script start with for example +1 and the second digit isn't an 8? We have today a section that looks like this with in an if statement.

 

ANI.startsWith("+10") || ANI.startsWith("+12")

 

What I'd like to achieve is something similar to what can be done in CM, aka match +1[^8] on for example TPs.

 

I'd also like to get input to if you can do this check in a more effective way or more to the point nicer looking from a script perspective. Today we have quite a large block of numbers within many different if statements that map to separate language sections later on in the script.

 

/Roger

Correct Answer by Gergely Szabo about 3 years 4 months ago

Hi,

on second thought, this would be even better:

ANI.matches("\\+1[^8].*")

This would return true if the number starts with anything but +18, otherwise false.

G.

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (2 ratings)
Loading.
Gergely Szabo Thu, 04/10/2014 - 07:41
User Badges:
  • Green, 3000 points or more
  • Community Spotlight Award,

    Member's Choice, December 2015

Hi,

try

!ANI.startsWith("+18")

G.

roger.kallberg Thu, 04/10/2014 - 08:00
User Badges:
  • Silver, 250 points or more

Thanks Gergely,

Super fast as ever. yes

Just to be clear, will that match all numbers that start with +1, but not +18?

 

/Roger

Correct Answer
Gergely Szabo Thu, 04/10/2014 - 08:30
User Badges:
  • Green, 3000 points or more
  • Community Spotlight Award,

    Member's Choice, December 2015

Hi,

on second thought, this would be even better:

ANI.matches("\\+1[^8].*")

This would return true if the number starts with anything but +18, otherwise false.

G.

roger.kallberg Fri, 04/11/2014 - 01:03
User Badges:
  • Silver, 250 points or more

Thank you Gergerly,

This sounds exactly as what I'm looking for. I will test it out on a test version of the production script and get back to you.

R

Samuel Womack Fri, 04/11/2014 - 04:22
User Badges:
  • Silver, 250 points or more

Greg does that Regular Expression actually work for you with the 2 Back slashes (in the version of CCX you are using)?..if so then in CCX 9.0.2SU1 that expression doesn't work..but it's not too far away from being "correct" (apparently as I read what you have there..you are "escaping the escape character").

ANI.matches("\+1[^8].*")

Just seeking clarification..

Samuel Womack Thu, 04/10/2014 - 09:07
User Badges:
  • Silver, 250 points or more

The image demonstrates another method you could use..but if you ever have an ANI that looks like the following: +1754+18xxx then the logic breaks on this function..however, I don't know of any numbering plans that do things like the above...

Actions

This Discussion