DID not recognized in inbound route

I have freepbx based on asterisk 15.0.37.9, a SIP trunk with OVH and 8 SIP-phones yealink. Outbound calls are going fine. Inbound calls on an inbound route with did as “any” are going fine, that means calling a group in which the SIP-phones are. . When I create an inbound route with a valid DID (format 003222152774 checked and OK) linked to a valid extension phone, it is still the the ring-group which rings all the phones. Settings wer made according to Freepbx doc. What could I have done wrong?

Run sngrep and make the inbound call, watch for the number the call comes from and make sure it’s the same. It might contain a + something like a country code in front of the number you already have and that’s likely why it’s not matching.

Hi Eris,

Thanks a lot for the advise. I have already checked via the log of freepx: (unfortunately) the DID in the inbounds routes is correct. So I need to look elsewhere. I also used Wireshark.
Anyway, I did not know sngrep and instelled it. It’s a great tool. Thanks again. Thierry.

What appears in the DID field of the CDRs for an incoming call to this number?
Try putting that value into the DID Number field of the Inbound Route.

Hi Stewart,
I already checked and re-checked. In the CDR, I got 022152774 which is locally correct, then I tried it as DID: nope. Then I tried 003222152774 an d+3222152774, still nope. Could it be related to the fact that the inbound route points to a ring group? Note that the calling number appears as 0032495597104. I tried to have the inbound call routed to a single phone but the groups still rings. Freepbx is well reputed and I doubt it’s a bug. I MUST have done something idiot but what?
Thanks for help. Thierry.

1 Like

Message me for good explanations

As a test, set DID Number to 022152774, leave CallerID Number blank, set the destination to an extension. Make sure that you don’t have another Inbound Route with a pattern that conflicts. If the extension doesn’t ring, paste the Asterisk log for the call at pastebin.com and post the link here.

If the extension does ring, change the destination to point to the ring group and paste the log for that case.

Hi Stewart,
Still the same.
Calling from GSM 0495597104 to freepbx inbound route 022152774 which points to ext 29 phone. After a few seconds, the ringgroup 50 is activated (linke in a catchall) and all group extensions are ringing.
(2[2025-07-29 10:25:39] VERBOSE[9085] pbx_variables.c: Setting global variable 'S - Pastebin.com)

I Made an extra test: removing the catchall (any) inbound route. The caller gets the voice message “the number you have dialed is not in service …”.

The voice seems to be from freepbx.

Here is the corresponding log.
(Asterisk Log FilesFiles (10)LinesRefresh IntervalFilterHighlight (None - Pastebin.com)

Very gratefully
Thierry

Seems that i didnt use pastebin correctly, her is the second key Pz0fJh5R and the first one MwTm7tzm.

Sorry

You didn’t include the SIP INVITE which is all that’s needed here. This line

3[2025-07-29 10:55:37] VERBOSE[4420][C-00000046] pbx.c: Executing [s@from-trunk:1] NoOp("PJSIP/OVH-000001a3", "No DID or CID Match") in new stack

hints at what your issue is, s@from-trunk there’s no DID in the SIP URI, which means it’s probably in the To header. In which case you want to change the trunk context from from-trunk to

from-pstn-toheader

Then test again. Ultimately you need the first log line for an inbound call to show the DID in place of the s character. And when it’s setup correctly, the DID will show in the CDR DID column, instead of the s that shows there now.

Thanks a lot for the tip. Unfortunately, replacing context as suggested did not fix the problem.
Will study “context” more in detail to try to understand. Anyway thanks for the suggestion.Thierry

Sharing a SIP INVITE that the provider sends you will eliminate the guessing.

Hope this is what you need. Thierry

2 OPTIONS [email protected] [email protected] 2 10.0.0.26:5060 10.0.0.226:5060
3 OPTIONS [email protected] [email protected] 2 10.0.0.26:5060 10.0.0.224:5060
4 OPTIONS [email protected] [email protected] 2 10.0.0.26:5060 10.0.0.223:5060
5 OPTIONS [email protected] [email protected] 2 10.0.0.26:5060 10.0.0.222:5060
6 OPTIONS [email protected] [email protected] 2 10.0.0.26:5060 10.0.0.233:5060
7 INVITE [email protected] [email protected] 10 91.121.129.23:5060 10.0.0.26:5060
8 OPTIONS [email protected] [email protected] 2 10.0.0.26:5060 10.0.0.230:5060
9 OPTIONS [email protected] [email protected] 2 10.0.0.26:5060 10.0.0.230:5060
10 INVITE [email protected] [email protected] 7 10.0.0.26:5060 10.0.0.222:5060
11 INVITE [email protected] [email protected] 7 10.0.0.26:5060 10.0.0.227:5060
12 INVITE [email protected] [email protected] 7 10.0.0.26:5060 10.0.0.233:5060
13 INVITE [email protected] [email protected] 7 10.0.0.26:5060 10.0.0.240:5060
14 INVITE [email protected] [email protected] 7 10.0.0.26:5060 10.0.0.230:5060
15 INVITE [email protected] [email protected] 7 10.0.0.26:5060 10.0.0.224:5060
16 INVITE [email protected] [email protected] 7 10.0.0.26:5060 10.0.0.229:5060
17 INVITE [email protected] [email protected] 7 10.0.0.26:5060 10.0.0.231:5060
18 INVITE [email protected] [email protected] 7 10.0.0.26:5060 10.0.0.226:5060
19 INVITE [email protected] [email protected] 7 10.0.0.26:5060 10.0.0.233:5060
20 INVITE [email protected] [email protected] 7 10.0.0.26:5060 10.0.0.223:5060
21 REGISTER [email protected]:5060 [email protected]:5060 6 10.0.0.224:5060 10.0.0.200:5060
22 OPTIONS [email protected] [email protected] 2 10.0.0.26:5060 10.0.0.240:5060
23 OPTIONS [email protected] [email protected] 2 10.0.0.26:5060 10.0.0.231:5060
24 OPTIONS [email protected] [email protected] 2 10.0.0.26:5060 10.0.0.220:5060
25 OPTIONS [email protected] [email protected] 2 10.0.0.26:5060 10.0.0.220:5060
26 REGISTER [email protected]:5060 [email protected]:5060 2 10.0.0.222:5060 10.0.0.26:5060
27 INVITE [email protected] [email protected] 8 91.121.129.23:5060 10.0.0.26:5060
28 OPTIONS [email protected]:5 [email protected] 2 91.121.129.23:5060 10.0.0.26:5060
29 REGISTER 201@1

They are asking for the full contents of the INVITE, which will be about 1,500 characters, just for the one request, and it needs to be an INVITE from the provider.

It looks like there are only internal ones and one to the provider, and it looks like the one to the provider has the wrong From header (external signalling address not set proerly), but I’m guessing what the summary actually contains.

All,

Thank you for your patience.
What I got is on pastebin with code U09BwpYk. The first full invite is at line 1871.
All the best,

Thierry ON5TE

pastebin is sending me to adverts when I try to use the more options button on their cookie question (“we value your privacy” sub-page); more and more sites seem to be insisting that you give them full tracking rights, and it looks like pastebin has gone that way. Could you please try pastebin.freepbx.org, instead.

Line 302 shows that the DID 003222152774 was correctly sent by the trunk.
Line 384 shows that from-pstn-toheader worked correctly, but for some reason no Inbound Route matched and it took the catch-all path.

Please post a screenshot of the Inbound Routes summary page, as well as a shot of the route for 003222152774.

Off topic:
pastebin.freepbx.org used to be great, but a while back Sangoma changed some setting such that non-expiring pastes are no longer allowed. I strongly believe that pasted logs or other info should be a permanent part of the thread, so future readers can follow along and determine whether their situation is similar.

Can someone with appropriate authority please fix this?

I’ll paste that in my own server (synology) and send you the access key in a couple of hours.

You don’t need to paste screenshots – just include them in your post by dragging the image to the edit window.