FreePBX/Asterisk missing DID; how to force DID on trunk

If you get a SIP account from a provider which isn’t really a trunk it can be configured as a trunk in FreePBX but DID on incoming calls is set to “s” so it is impossible to get an inbound route working.

The trunk in this case will only have one DID so a workaround is to set the DID “hardcoded” on the trunk in order to get the inbound route working.

Edit extensions_custom.conf and add something like this, but replace “123456789” with the DID you wish to set:

[custom-123456789]
exten => s,1,Noop(Setting DID to 123456789)
exten => s,n,Goto(from-trunk,123456789,1)

Now edit the trunk and go to the pjsip tab and enter custom-123456789 (replacing “123456789” with your DID) in the Context field.

Now all incoming calls in this trunk will get your desired DID and your inbound route will be able to catch them by the DID.

FreePBX extension receives call from wrong queue

It turned out that the extension earlier had been a dynamic agent for the queue, and it was logged in as an active agent for the queue when the extension was removed from the queue. This caused calls in the queue being sent to the extension still.

Solution: Edit the Queue, add the extension as a dynamic agent, call *45 from the extension (“agent logged off”), dial *45 again (“agent logged in”) and finally dial *45 one more time (“agent logged off”). Now edit the Queue again and remove the extension from dynamic agents.