Cisco Support Community
Showing results for 
Search instead for 
Did you mean: 

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. If you'd prefer to explore, try our test area to get started. And see here for current known issues.

New Member

UCCX Call Routing Based on ANI

I hope so you all are doing well.

I'm looking to write a script that can route calls based on the calling number. E.g. If Calling number 0455666777 call to the ICD trigger the script check the Calling number and route that call to the same agent every time this client call, if the agent is not available queue it in the default queue. I know how to get the calling number for the inbound call, but I have no idea how to match it with some xml or database to know to which CSQ or Agent route the call.

Thanks everyone in advanced.


UCCX Call Routing Based on ANI


I have a solution for you and i hope that will meet your requirements.Lets do steps for our script:-

1- You need to match ANI, So please create a new variable "String" and type your ANI number between "Your ANI" , which will be 0455666777 and name it as Caller id . Your new variable will be as the below




You have also to create other string which will match your agent number for example

2-After Accept a call ,you have to collect information about incoming call. So you will use from Call contact - Get Call contact info ,then right click  properities and on  calling number and from variables select "callerid" as the below:-

name                        variabele

calling number          callerid

3-You have to use IF (If your selected agent is avilable , call should go to hi, other go to your queue) after your welcome prompt . So you have to add  IF condition as the below


4- under IF


choose call redirect  "4004" where 4004 your selected ext.


select resource , to go on your queue

I think these steps will meet your requirements.


Please rate all useful information

UCCX Call Routing Based on ANI


Please find the below script based on the above steps

Thank you

Please rate all useful information

New Member



     Quick question, the step above lists how to do it for an individual number; what if you have about 160,000 + numbers that needds to be looked up, how would this be done?

Cisco Employee

You can try something like

You can try something like below where in you are actually checking the area code and not one specific number

if called_number.startsWith("123")

In case these 160,000 + numbers are distributed among various other area codes, then you can use multiple if statements

Please note called_number here is the variable that is storing the value of called number that you get using the Get Call Contact Info step in the script, in your case it could be something different so choose accordingly.



- Rate Helpful Posts-

New Member

UCCX Call Routing Based on ANI

Thanks for the reply Islam.

I forgot to explain the Calling number can be any calling number from any client.I'm looking to do something like this:

With the XML or Database. After get the calling number information, look for that number in the XML and send the call to an Internal number, if the user is not available queue it in the default queue.

Hope so this time is clear enough.


UCCX Call Routing Based on ANI


by checking the the link and your requirement.

I can summerize that you need when some call the call center, let us say the caller is 0455666777 for the first time and agent1 answer the call. the 2nd time when the same number call, you need to route him to the same agent "agent1". If agent1 is not available, route him to any available one.

I don't know if this is applicable, the script should check the ANI with UCCX historical data. the only step I found is "Get Reporting Statistics", is used to check the call statistics.



please rate all helpful posts

New Member

UCCX Call Routing Based on ANI


The script don't need to remember the agent, I'm planning to have a database or an update XML file with the Client ANI information match to the number the script should forward the client. So, the logic is this...

  1. Accept Inbound Call
  2. Get ANI information
    1. ANI=0418555777
  3. Check the ANI of the inbound call with a Database or XML file
    1. Look for 0418555777 in the DB/XML file and get the forward number for that ANI
  4. Forward number found
    1. Forward 0418555777 to 5657
    2. If this user is not available the DN is going to redirect the call to an internal basic hunt group

As far I understand for this scripts I don't even need to be log in any queue. I just basic forwards base on ANI. I just struggling in the Step 3.

Thanks in advanced for the help