Remove digits from start of CallerID

My TSP rather annoyingly insists on providing Caller ID in E.164 format, with the country code prefixed to the number. For example,
“441234567890” (where 44 is UK country code).

That’s what then appears on the phones when they ring, whereas end users would normally expect to see something like
"01234567890" (national numbers begin with ‘0’ in UK)

This also has implications for re-dialling a number from the history list, since not all trunks will accept numbers in that format, so I have to do some outbound route gymnastics to get the numbers into the correct format.

Is there a simple way to edit caller ID on an incoming call? What I need to do is ‘Match 44 and replace it with 0’. This would be no sweat on an outbound route or trunk. I can find any number of ways to edit outgoing CLID but incoming seems to be a bitch.

I found the ‘Set Caller ID’ module but I’m not sure how I can use it to remove digits, it only seems to be able to add digits, not remove/translate them. I’m sure there’s probably a macro or something to do exactly what I want, but finding these things is the hard part. Any suggestions?


There is an e.164 context for inbound calls that does this for you.

Don’t know the name off the top of my head but if you grep e.164 in /etc/asterisk your are bound to find it.