Getting the DID number from a CallCentric SIP trunk for FreePBX

I’ve got a few DDI numbers from CallCentric all around the world (UK, US, Australia) and couldn’t figure our how to setup an ‘Inbound Route’ in FreePBX that used the number that had been dialled to route the call.

It turns out that you need to extract the number from the ‘SIP header’ information and there’s no setting in FreePBX to do this so it means hacking at the Asterisk config files just a little.

There are a few methods for doing this but these instructions should work for FreePBX/Asterisk –

When setting up your ‘SIP trunk’ in FreePBX under ‘PEER DETAILS’ you want to put the line –


then you need to edit the file /etc/asterisk/extensions_custom.conf and add the following lines –

exten => _.,1,Goto(from-trunk,${CUT(CUT(SIP_HEADER(To),@,1),:,2)},1)

This will intercept the incoming call, extract the DDI number from the SIP header, and then pass the call along it’s normal route, passing the DDI number as a parameter.

Now you should be able to setup your “Inbound Route” in FreePBX as normal.

More details can be found here.

6 thoughts on “Getting the DID number from a CallCentric SIP trunk for FreePBX

  1. TexasBio

    I have tried to use this fix with callcentric and still no inbound calls can you please post file

  2. Matt

    Hi TexasBio,

    That’s literally all I’ve got in my /etc/asterisk/extensions_custom.conf – just those 2 lines.

    Have you changed the “context” line for the trunk too in FreePBX?


  3. Michael Masanga

    UKDDI numbers have the same problem do we do the same? However with UKDDI there are no outbound settings so sdo we just ignore those and leave blank? how about the registartion string

Comments are closed.