Replacing a character in the incomming cid


Is there a way to detect and replace/remove a character in the incoming CID?

From our sip provider we receive calls where the incoming CID look like this 12345678#200. What I would like to do is remove or replace the # with the digit 0. Is this some how possible using the module Add Caller ID?

Best regards

Using the Set CallerID module, you can change the 9th character to a zero for all 12 digit Caller ID numbers using this definition:


Thank you for the quick reply :slight_smile:

My problem is that the incoming cid can vary in lenght, depending on we receive an international call for instance. So I think I need to find the # some how, since I cant depend on its placement. Even the numbers after the # can vary in length.

Here is an even better way, and should solve your problem. This will cut a string of any length into sections separated with a # then assembles section 1 & digit zero & section 2. It stops working if there is more than one # character:


This is Perfect, thank you. I will try it out and see if it Works :slight_smile:


I get this warning in the log file:

“WARNING[2207] func_callerid.c: CALLERPRES is deprecated. Use CALLERID(name-pres) or CALLERID(num-pres) instead.”

I tried to add this line in the Set CallerID module on the relevant trunk, but unfortunately it didnt work. I only get the warning on the first call, so it seems I’m not getting it to trigger the module correctly. I can see the CID number is as expected in the log file with the #


Thanks for the help so far. What would the argument be if I just wanted to remove everything after the # - something like this? :


When I do this i get some waring that says:

Syntax: CUT(,,) - missing argument!

best regards

shouldn’t be missing from the above…please provide the actual extension and console output from test call. Also you need to put a zero between your two CUT() functions there, if you want to replace #.