Dynamic SetCallerID upon arriving CID

Hello people,
I’m getting confused with the following scenario:
I have several users, who are setting certain irregular CID, which my end point provider are declining, when they are illegal CID.

For exemple:

  1. Some users, just put alfabetical CID, like: asterisk, albert, extension1, home…etc.
  2. Other users, insted of using NX 9 digits, they put E164 with 00, or +, and/o other irregular numebrs, where if the end point is in US, he’s dropping me the call as the CID is illegal, or identified as internationl…etc…
  3. Other users, use ilegitime CID, like 911…etc…

So, I wanted to solve this by doing a dynamic rule to retrive that ilegal CID, and re-write them, before progress the call to the carrier, to avoid problems.

Using the SetCallerID directive it’s my solution, but how can i do it dynamically to retrive all that set of variables, alfabetic, alfanumeric, and/or ilegal??

Thanks for help,

Use Set(CALLERID(num)=…)

Use ${CALLERID(num)} to find out what the incoming value is.

Thanks for your prompt David,
I know, as I have read, how is this… but, as I understod, this is to set the CID… but how can I select and capture the ilegal CID, when I have large variant of that… to re-write it, it’s easy just with the setcallerid, but how can I select/ retrive that ilegal CID?


Use ${CALLERID(num)} to find out what the incoming value is.[/quote]


So in this case I have to make one line for each possiblity as:



That would be horrible… no maner to retrive that dynaically?

${CALLERID(num)} returns the value of the caller ID received. Your examples contain invalid parameters.

Once you have the value, you can use regular expressions, database lookups, feed it into a subroutine as the extension then use extension pattern matching, etc.

You could also google for “asterisk ex-girlfriend logic”, although that won’t help if you want to use an external lookup.

Ok, thanks, will study that,