Calls seem to be showing on wrong trunk

I have recently set up a new version of FreePBX and are having some issues where when I look at the calls in CLI mode I can see the calls seem to show on the wrong trunk. (Please see below)

== Using SIP RTP CoS mark 5
– Executing [[email protected]:1] Set(“SIP/072811271-000004cc”, “__DIRECTION=INBOUND”) in new stack
– Executing [[email protected]:2] Gosub(“SIP/072811271-000004cc”, “sub-record-check,s,1(in,079292200,yes)”) in new stack
– Executing [[email protected]:1] GotoIf(“SIP/072811271-000004cc”, “0?initialized”) in new stack
– Executing [[email protected]:2] Set(“SIP/072811271-000004cc”, “__REC_STATUS=INITIALIZED”) in new stack
– Executing [[email protected]:3] Set(“SIP/072811271-000004cc”, “NOW=1474862274”) in new stack
– Executing [[email protected]:4] Set(“SIP/072811271-000004cc”, “__DAY=26”) in new stack
– Executing [[email protected]:5] Set(“SIP/072811271-000004cc”, “__MONTH=09”) in new stack
– Executing [[email protected]:6] Set(“SIP/072811271-000004cc”, “__YEAR=2016”) in new stack

The inbound call was made to 079292200 but it shows on the trunk 0728211271. I have set CallerID’s on both the trunk and inbound route. What am I missing as the call seems to be routing correctly - the issue is that I’m using FOP2 and the call shows up as being on the wrong trunk.

Any ideas??

Did you check your CDRs ?

Are both trunks with the same provider and registering against the same server?

Yes they are

That’s the problem. Asterisk only distinguishes an incoming call via the server IP and port. Since all your trunks are registering against the same server, the incoming calls from different trunks are from the SAME ip and port. So Asterisk will report all the incoming calls are from a trunk from its picking…

This is a limitation of Asterisk and currently, nothing much can be done to resolve it…

However, you can set an inbound route based on DID and not Caller ID to route your calls…