cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1087
Views
10
Helpful
9
Replies

UCCX 10.6 - Looking for script that transforms callerid before check it against a database

lcubero
Level 1
Level 1

I am looking to do a script that takes the callerid of the inbound caller and check it against a database before to route the calls to any CSQ. My problem is 
the callerid is presented in a regular format, area code + phone number, and the dabatase is configured with (area code) + phone number. i.e: 1133189999 received  
from PSTN, and configured at the database as (11)33139999. 
How can i use set step on the script to include () to the area code before consult the database ?

Thanks !!!

9 Replies 9

djlundberg
Level 5
Level 5

Hi-

 

You should be able to use a set step using the below value to accomplish this assuming you are not in a region with a variable length dial plan:

 

"("+ callingNumber .substring(0,2)+")"+callingNumber .substring(3,10)

 

Thanks,

DJ

You may also want to check that the number is 10 digits long before applying your manipulation and checking it against the DB (If callingNumber.length() == 10).

Hi Guys,

Thank you very much for your help, again. The calling number is always 11 digits. I receive the calling number from PSTN as 0+citycode+extension number,

ie: 07332158490. I need to have this number transformed to (73)32158490.

 

Regards,

 

Hi-

 

Take a look at the screen shot from my post three days ago. That should get you there.

 

Thanks,

DJ

Hi DJ,

I applied your suggestion. Find below the result:

 

07332158490 --> 7332158490. The correct result would be (73)32158490

 

Thanks,

Luis.

Hi Luis-

 

Sorry, perhaps I should have been a bit more clear.  You'll need to start with stripping the 0 and then from there you can format the number using the other set step.  

 

Does that make sense?

 

DJ

Hi Guys,

Thanks for help but it seems which is not working fine yet. Find below the results from set step.

calling number - 07332158490

after set step - (07)3215849 

The correct translation should result in (73)32158490.

 

Thanks,

In your original example, you have a 10-digit calling number (1133189999); now you have an 11-digit calling number (07332158490), so the callingNumber.substring(3,10) is chopping off the last digit.

You could change it to callingNumber.substring(3,11) or you could use callingNumber.substring(3) and it should take the rest of the digits starting with the third one, independent of how many digits are in the string.

Hi

 

You would need to provide more detail on the possible inbound numbers, but my method for dealing with calls that come in with a '+' or leading '0' can be seen in the screenshot. 

 

EDIT:  This assumes that 0 is not a valid start for an area code in your corner of the world. 

 

Thanks,

DJ

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: