How to ring correct extenstion based on To: header in SIP INVITE

I was setting up a new PBX for my client and I came to a rather unusual problem. The client was using SIP trunk from Slovak Telecom together with a fresh installation of FreePBX (Linux distro based on CentOS with bundled Asterisk and other candy).

When we rang the extension from the outside using cellphone we noticed, that ST was sending the final destination number (DID) in To: header rather than in INVITE request line. So we needed to extract that number from header and use it in next steps to correctly ring that particular extension.

Just place this config in /etc/asterisk/extensions_custom.conf, assign custom-get-did-from-sip context to your incoming SIP trunk and you’re good to go.

And of course, don’t forget to reload Asterisk 😉

Leave a Reply

Your email address will not be published. Required fields are marked *