08-27-2015 10:05 AM - edited 03-14-2019 03:09 PM
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 !!!
08-27-2015 11:41 AM
08-27-2015 06:14 PM
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).
09-14-2015 11:31 AM
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,
09-14-2015 11:56 AM
Hi-
Take a look at the screen shot from my post three days ago. That should get you there.
Thanks,
DJ
09-14-2015 12:05 PM
Hi DJ,
I applied your suggestion. Find below the result:
07332158490 --> 7332158490. The correct result would be (73)32158490
Thanks,
Luis.
09-14-2015 12:09 PM
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
09-11-2015 12:39 PM
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,
09-11-2015 12:46 PM
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.
09-11-2015 12:59 PM
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
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: