Direct Inbound Sip Calling Failing

When making a call to SIP/[email protected] it is not going direct to the extension, but is checking the inbound routes for a matching DID/CLID. It seems that this is not the correct way, as I would need to set one up for every extension, but maybe I’m misunderstanding something. Some insight would be great.

Thanks

If you are saying that you are making an anonymous call from the outside and it is not automatically going to your extension, this is correct behavior. It is still an outside call that requires a DID to be properly delivered. If you are not using the directdid field in the extensions for anything else, then you could just put the extension number in that field and that would be your easiest solution. Alternatively you could put an inbound route for each extension. Or, you could could put a pattern matching inbound route (e.g. _1XXX to match all 1XXX extensions) and then as a destination you could choose the custom app option and then put in something for the custom app like: “from-did-direct,${EXTEN},1” which should get you there in a single inbound route.

Philippe Lindheimer - FreePBX Project Lead
http//freepbx.org - IRC #freepbx

Can I ask a follow-up question? Thanks :slight_smile:
I just want to understand how this works…

The inbound routes are implimented in the [ext-did] context.
That is where the [from-sip-external] call is ultimately being matched to the ‘anyDID/anyCID’ route, and sent to the specified ‘default’ extension, as observed.

If we add additional inbound routes for the extensions as suggested, the GUI seems to re-order the routes, aways placing ‘anyDID/anyCID’ at the top of the context. Will this not cause the ‘anyDID/anyCID’ route to intercept any call BEFORE it gets to any specified extension routes?

Or does it work on the basis of ‘closest match’ rather than ‘first-match’ within the context?

Thanks for any explanation.

Ron

The context is actually the following:

[from-pstn]
include => from-pstn-custom 
include => ext-did
include => ext-did-catchall
include => from-did-direct
exten => fax,1,Goto(ext-fax,in_fax,1)

Which means if there is a did (in ext-did) that will come first. If you have defined a ANY/ANY route, then ext-did-catchall will exist and it will take everything else never hitting from-did-direct. If you have not, then you would have had the external calls routed to your extension.

So - one could probably consider this a bug, that from-did-direct should come before ext-did-catchall and you would not have had the issue. Or one might consider it an issue that fom-did-direct is in there at all. You are welcome to file a bug report against this for our consideration. I will need to think about it and talk it over. The real bug is the un-predictable behavior. Things might work until you create a catch-all route and then they stop.

As far as pattern matching once you are in a context, Asterisk will match the closest match. If no match exists, it will move on to the next included context if there is one.

Philippe Lindheimer - FreePBX Project Lead
http//freepbx.org - IRC #freepbx

No, IMHO this behaviour is not buggy, it just needs to be understood.
And I now understand it, thanks for the explanation.
It has cleared up a lot of my mis-understanding.
I have inbound routing now working as expected.

For anyone following this, here’s the crux of it:

  1. There are essentially 2 different entry points into the dial plan: [from-internal], and [from-trunk]. ( [from-sip-external] just goes to [from-trunk] if anon inbound SIP is permitted. )They follow different routes through the dial-plan. [from-trunk] hits the DID logic, which [from-internal] does not.

  2. We need to understand the DID logic.
    Let’s look at how a sip- or trunk- inbound call is handled…
    If there’s an any/any route, ( which there may well be to pick up PSTN and pass it to a default extn ) then here’s what happens:
    we hit [from-pstn],
    which then includes [ext-did]. --> no match.
    falls through to [ext-did-catchall] --> match, is sent back to [ext-did] default route. Bah!
    We never fall through to [from-did-direct] ( where the call would be matched ) if the ‘any/any’ route is set.

  3. In order to DID, we need to match the call in [ext-did].
    We do this by either:
    a) Setting explicit inbound routes ‘per extn’ on the Inbound Routes GUI;
    b) Setting the DID option for each extn in ‘extensions’ GUI;
    ( These seem to do the same thing: create matches in [ext-did] )
    c) Setting a generic pattern-matching inbound rule pointing to a custom command that passes the call to a contect where the extn is matched;
    d) Not having an ‘any/any’ route. ( Untested! ) Catchall does not exist in this case and we fall through to [from-did-direct] and the call is correctly handled. Incoming PSTN now broken.

I have used 3b, and it works well.
Simply enter the extn number in the DID field on the extension (assuming it’s not used already. ).
Then it all works.

Blimey. My Asterisk install is only a week old! I feel I’ve learned a lot in a week.

Ron

hmm - I’m still thinking it is somewhat of a bug to have the following scenario.

You setup a system with no Any/Any route and you have anonymous sip calls working fine to your extensions (having setup no did). You then realize that you should have an any/any route and all of a sudden, your anonymous calls stop working. You are stumped, why? they worked before.

If you remove from-did-direct it will break some people. If you modify it and put it in front of the catchall route, you may have a few broken system’s here and there but overall it probably does more good then harm. If you leave it as it is, you continue to have the scenario as described above.

hmm - which to do?

Philippe Lindheimer - FreePBX Project Lead
http//freepbx.org - IRC #freepbx

Hello,

I created 2 trunks:zap/1 and zap/2.Than I created “Inbound Route” with “Zaptel Channel” option which is “OR” option, destined to a SIP extension (I put the extension number in the DID field). It does not look like a rocket science but I am getting the dreaded “ss_noservice” message. As a matter of fact I get this message no matter what I specify as the destination… even straight forward “hangup” :frowning:
I installed freePBX 2.3 on top of Asterisk 1.4 running on Debian “etch” machine helping myself with the instructions which “Dirk” posted here few weeks ago.
Wold you have any suggestions what should I check… or should I dump everything and do a fresh installation? I messed with the system a bit before “everything” started to work 90% :).

Best regards
"Jersey"

The any/any rule is an “ELSE” rule and must be ALWAYS at the end of the rules list to parse.
I fixed this. Look my post here:

http://www.freepbx.org/forum/freepbx/development/inbound-routing-to-prioritize-cid-matching-over-did-matching#comment-12881

I hope this can help…

Cheers!