Skip to main content

Modifing CallerID for inbound calls

Posted by amagurie on Fri, 05/30/2008

Hi,
.
Ouy SIP provider send inbound calls to us in full with Country Code + Area Code + Number. For example, national calls would be 64 4 8976541, mobile 64 2 8976541 etc etc. I live in New Zealand and our country code is 64 by the way.
.
The only problem I have setup outbound routes like _0[34679]XXXXXXX for national calls and if a person uses the CallerID from missed calls then the number would be 644 8976541 and bypass the route (and fail) because it should be (would be dialed) 04 8976541. I could duplicate all routes, adding a _64[34679]XXXXXXX but that seems silly.
.
What I have done is added the following to 'from-outside':
exten => _64X.,1,Wait(1)
exten => _64X.,n,Set(CALLERID(num)=0${CALLERID(num):2})
exten => _64X.,n,Goto(from-outside-redir,${EXTEN},1)

This rewrites the inbound CallerID if it starts with 64 (and ignore anything else) to be the same as what you would dial for outbound calls.
.
Is the best way or place to do this? plus it would also get overwritten anytime a upgrade touched this file.
.
Sorry about all the dots, couldn't get the lines to break.
.
Thanks
Allister Maguire


Submitted by mattdarnell on Fri, 05/30/2008 Permalink

Allister,

I don't have an answer to your main question but I am curious how to make persistent changes to the dial plan. I know trixbox has the sip.additional (or something similar) that allows you to put in custom code that will not be overwritten during an upgrade.

Hopefully someone will have an idea.

-Matt

Submitted by thirdlane on Fri, 05/30/2008 Permalink

To answer Matt's question - you can put custom code in user_extensions.include

To answer Allister - currently there is no good way to do this.

I think of possibly doing something like 1) replacing hardcoded redirects in from-outside with the same but using a macro (similar to what is done when processing calls "from-inside" 2) have the name of the macro specified in a global variable, so that the users could replace the macro we supply with their own.

Best regards,

Alex

Submitted by amagurie on Fri, 05/30/2008 Permalink

Thanks for the reply Alex.

That sounds like a great idea, but you wouldn't even a need a global variable to specify the script, you could add another 'Script can be used for' inbound context or someting with in the script library, and then make it selectable via the 'context' dropdown box in the trunk config, which would allow it to be trunk specific.

For now I can just manually edit the 'from-outside' after any upgrades etc, because at most only calling by missed or call history would be broken if it ever got overwritten.

Regards

Allister