cancel
Community Member

## How to get the first 3 digits from Calling number?

Customer has UCCX v8.5 Standard license.

How can I get the first 3 digits from Calling number to be able to do a search in xml with area codes?

I have done some reading and finding this statement

``SET area_code = calling_number.substring(0, 3)The problem is this does not work with standard license. `Is there another method that will give me the first 3 digits of the calling number?Thanks,Solomon`
1 ACCEPTED SOLUTION

Accepted Solutions
Hall of Fame Super Silver

## How to get the first 3 digits from Calling number?

You should be able to simply use set step to convert string to integer, here is snippet of an example,

ANI is the string varaibale and calling_number is the integer.

12 REPLIES
Community Member

## How to get the first 3 digits from Calling number?

Any one out there that can point me in the right direction?

Thanks,

Solomon

Hall of Fame Super Silver

## How to get the first 3 digits from Calling number?

Solomon,

The syntax you posted is normally what one would use, but since Java is not available in Standard I suppose this may not work though this surprises me.  I don't have any other solution except for perhaps trying some math on it, i.e. calling_number / 10000000 (assuming this is US and all calls come in as 10 digits), if the calling_number is an integer it should work, one thing you may need to verify is to ensure it rounds it down and not up, i.e. 847-888-1234 is 847 not 848.

HTH,

Chris

Community Member

## How to get the first 3 digits from Calling number?

Chris,

So I should convert the calling_number to an integer and then do some math?

Can you provide me with an example syntax?

Thanks,

Solomon

Hall of Fame Super Silver

## How to get the first 3 digits from Calling number?

You should be able to simply use set step to convert string to integer, here is snippet of an example,

ANI is the string varaibale and calling_number is the integer.

Community Member

## How to get the first 3 digits from Calling number?

Chris,

Your method works perfect up to 9 digits of ANI. As soon as the ANI = 10 digits I get the following error. Do you you why?

Hall of Fame Super Silver

## How to get the first 3 digits from Calling number?

Hmm, must be some limitation, you can try converting it first to float or long and then to integer.

Chris

Silver

## How to get the first 3 digits from Calling number?

max range for an int is 2147483647

Brian

Community Member

## How to get the first 3 digits from Calling number?

I thought I was close! Since I cannot use the integer because of the max range, any other ideas?

Thanks,

Solomon

Hall of Fame Super Silver

## Re: How to get the first 3 digits from Calling number?

did you try long or float per my previous suggestion.

Sent from Cisco Technical Support iPhone App

Community Member

## How to get the first 3 digits from Calling number?

Yes, it changes the ANI completely.

Hall of Fame Super Silver

## How to get the first 3 digits from Calling number?

So, looks like float is the same value with period, so not to get the final area code instead of dividing it by 10000000 simply multiple it by 100.

Chris

Community Member

## How to get the first 3 digits from Calling number?

Thanks Chris, Got it working using the long variable.

Thanks,

Solomon

740
Views
0