Since Version 1.8 in Asterisk we have seen some issues with DID calls from some suppliers.
The tell tail sign is that even though you have an inbound route that matches the DID it will still say in the verbose screen that nothing matched it in the inbound context, For example:-
Call from 'USERNAME' (XXX.XX.XXX.XX:5060) to extension '01234123412' rejected because extension not found in context 'from‐trunk'
and if you do “dialplan show 01234123412@from-trunk” sure enough there is one.
After much searching and experimentation below is a working freepbx config that has been tested with 1.8 and 11 and proves to be working with the suppliers above.
[peername] username=USERNAME type=peer trustrpid=yes sendrpid=yes secret=PASSWORD qualify=no outboundproxy=sip.hostname.com nat=yes insecure=very host=sip.hostname.com fromdomain=sip.hostname.com dtmfmode=auto disallow=all context=from-trunk canreinvite=no allow=ulaw allow=alaw
[username] type=peer host=sip.hostname.com dtmfmode=auto disallow=all context=from-trunk canreinvite=no allow=ulaw allow=alaw
;registration string USERNAME:PASSWORD@peername/USERNAME