Incoming routing based on DID don't work

Hello,
I start to explain my problem first, I am linking dids to extensions. for the default number of sip account I put any / any DID / CID it works well for the incoming the softphone ring , but when I want to add other dids on inbound route with a custom destination to another extension it doesn’t work for incoming calls. so can you help me to resolve this issue?

username=************
type=friend&friend
srvlookup=yes
secret=*************
qualify=yes
port=5060
nat=force_rport,comedia
insecure=port,invite&port,invite
host=**************
fromdomain=****************
dtmfmode=rfc2833
disallow=all
context=from-trunk
canreinvite=no
allow=gsm&g729&alaw&ulaw&g726&gsm&g723

Look in the CDR reports in the DID column and see what is being delivered by the provider. You must match the DID string in the inbound route exactly as it shows in the CDR.

In my past experiences, not having ‘fromuser=****’ will not work with caller ID and is mostly not used when using multiple DIDs. If you add fromuser=***** in the trunk details with the ***** being the same as the username. Does this solve the issue?

hello,
(picture1) when I create inbound rule with any / any linked to an extention 4003 it works fine for inbound call but all the dids redirects to this extention with any / any,
**(picture2)**even when i try to create DID in |DID Number|| and |CallerID Number| with a destination to a very precise extension it does not work

You should leave the CallerID Number for your Inbound Route blank. That field is used to specially route calls from a specific caller.

@lgaetz explained how to solve the problem. Please report what you find in the CDR for calls to different numbers. If they are all the same, try changing the context from from-trunk to from-pstn-toheader .

Where are you? 329 is not a valid area code in the US; +329 would be Ghent in Belgium, but the numbers aren’t valid there, either.

there is the log after when i leave Caller-id blank
[2020-02-12 17:25:21] VERBOSE[12465][C-0000d6e6] pbx.c: – Executing [s@from-pstn:4] Playback(“SIP/siptrunkname-000000e2”, “ss-noservice”) in new stack
[2020-02-12 17:25:21] VERBOSE[12465][C-0000d6e6] file.c: – <SIP/siptrunkname-000000e2> Playing ‘ss-noservice.gsm’ (language ‘en’)

When you have only the any/any route installed and you call your numbers, what appears in the DID field of the CDR? You can view this at Reports -> CDR Reports and then clicking Search.

Remove the Caller ID Number, this is to change routes depending on the callers caller ID. You should leave caller ID empty and try just the DID number. If the DID number still doesn’t work, change the DID number to _3295840252 with the _ before the current value

There is the CDR and the last configuration of my DIDs when i try to make call to one of my DID i get un playback “this number you dailer is not on service” ss-noservice. and the same message when i try to add underscore before the value of DID


If you remove the caller ID out of the inbound trunk, the inbound route should work. With the caller ID you have made it so that the phone number you are calling must be the same as the phone number you are dialling from, hence the call not connecting.

I didn’t understand what you meant exactly because I already removed the caller-id from inbound route and i try to call one of my did but i get always the message of the playback no service for this number

there is my trunk configuration :

username=*************
type=peer
srvlookup=yes
secret=****************
qualify=yes
port=5060
nat=force_rport,comedia
insecure=port,invite
host=***********
dtmfmode=rfc2833
disallow=all
context=from-pstn-toheader
canreinvite=no
allow=gsm&g729&alaw&ulaw&g726&gsm&g723

Hello there is no solution for my problem ? thank you for your effort please assist me to resolve my situation please

The CDR you have shown is nonsense; please share the unmodified version.

The cdr in freepbx.

there ise the cdr freepbx that i found

You probably need to call Sangoma support because it looks like your database is broken. “D” and “S” in all the fields don’t make any sense.

Not sure this is a case for Support, screen shots above hint this is running an end of life unsupported system.

1 Like

I think I need to change the context in the extensions.conf->extentions-custom.conf file because when I want to reach one of my DID (linked to an extension) after almost 6 seconds a playback says a message this number is not in service
there is the messages console

I think what we need to see here is an actual call that is using the from-pstn-toheader as everything so far shows the calls going to the s extension in the from-trunk/from-pstn contexts. So clearly the calls are not being sent with the DID in the INVITE header (as it has s for that) but in the To Header.