Need to format incoming SIP CID

We have a new SIP trunk provider and for some reason when they send the calls into us the format of the sip data looks weird. I’ve looked everywhere trying to find a way to fix this and I haven’t had much luck.

Our Caller ID info looks like this.

“Persons Name” <4035555555;phonecontext=national>

I would like to strip out the ;phonecontect=national

I’m sure this is a dialplan rewrite somewhere, I’ve tried tweaking in a few config files, but have had no luck

Any help would be appreciated.

There are string search, manipulation and regular expression functions.

I’m aware of those in particular the CUT function looks like it’s what I need. I’ve tried using it in Various places but nothing ever changes. I seem to be using it in the wrong config file. If someone could point me in the right direction of the config file that would be great. I would like to cut specifically on the incoming for this particular SIP trunk.

You will need to provide the transitive closure of extensions.conf and everything included from it, before we can answer that for your configuration.

I fixed it by adding this to extensions_custom.conf and then changing the context=from-trunk to the new from-trunk-shaw

[from-trunk-shaw] exten => _X!,1,Set(CALLERID(num)=${CALLERID(num):0:10}) exten => _X!,n,Goto(from-trunk,${EXTEN},1)

Found the hints for how to do this on http://www.freepbx.org/book/export/html/1938

Hopefully this helps someone else out. :smile:

We had a very similar issue with Shaw SIP service, except our inbound DID matching rules were not working.

Our fix which is similar is below:

Add to /etc/asterisk/extensions.conf (For FreePBX: /etc/asterisk/extensions_custom.conf):

[from-trunk-shaw]
exten => _X!,1,Goto(from-trunk,${EXTEN:0:10},1)

In the Shaw SIP trunk settings, add:

context=from-trunk-shaw

It will route the call through from-trunk-shaw and only pass the first 10 digits from that point on to the from-trunk context in the PBX.