Calls coming in via DiD not routing to extensions

Hi there, I wonder if anyone could please help me?

I am trying to route inbound calls from a SIP trunk to extensions using the DiD information. I have created extensions and incoming routes and asscociated one with the other.

I can make calls to the PSTN via the SIP trunk and I can call other extensions.

When I make a call from the PSTN on a DiD number I have set inbound route on however it is not causing the extension to ring. I get a “the number you have dialed is not in service” message from the Asterisk box. This is the output from Asterisk (although I have done a find/replace to change the telephone number)

Thanks in advance!

– Executing [[email protected]:1] NoOp(“SIP/0001121030745-b6d06158”, “Received incoming SIP connection from unknown peer to 441478224422”) in new stack
– Executing [[email protected]:2] Set(“SIP/0001121030745-b6d06158”, “DID=441478224422”) in new stack
– Executing [[email protected]:3] Goto(“SIP/0001121030745-b6d06158”, “s|1”) in new stack
– Goto (from-sip-external,s,1)
– Executing [[email protected]:1] GotoIf(“SIP/0001121030745-b6d06158”, “0?from-trunk|441478224422|1”) in new stack
– Executing [[email protected]:2] Set(“SIP/0001121030745-b6d06158”, “TIMEOUT(absolute)=15”) in new stack
– Channel will hangup at 2009-02-11 15:12:39 UTC.
– Executing [[email protected]:3] Answer(“SIP/0001121030745-b6d06158”, “”) in new stack
– Executing [[email protected]:4] Wait(“SIP/0001121030745-b6d06158”, “2”) in new stack
– Executing [[email protected]:5] Playback(“SIP/0001121030745-b6d06158”, “ss-noservice”) in new stack
– <SIP/0001121030745-b6d06158> Playing ‘ss-noservice’ (language ‘en’)
== Spawn extension (from-sip-external, s, 5) exited non-zero on ‘SIP/0001121030745-b6d06158’

Sorry - Re-reading the message I should have made clear that I meant I have called from extension to extension with no problem. I have called from extension to PSTN with no problem, but I can’t make an extension ring by calling from the PSTN via the SIP trunk although I can see activity in Asterisk as shown above!


looks like you don’t have a mapping of 441478224422 to a given extension so there is no route for it to follow, thus you get the “that number is not in service” message.

Create a inbound route for it and/or if you don’t have any DID’s assigned to the extensions you can put it there.

Nope, tried that already :wink:

well based on the trace above it’s not seeing it…

Here’s the relevent info from Inbound Routes and Branches & Extensions. Everything default other than the bits I’ve changed below… As I say, the other stuff works but I suppose something could be wrong here !

—Inbound Route—

DID NUMBER: 441478224422


OUTBOUND CID: “User Name” <01478224422>
ASSIGNED DID/CID: This has the entry for the DID above in it.
SECRET: *************
DTMF MODE: rfc2833
CONTEXT: from-internal
HOST: dynamic
TYPE: friend
NAT: yes
PORT: 5060
DIAL: SIP/1074
MAILBOX: [email protected]





How to get the DID of a SIP trunk when the provider doesn’t send it (and why some incoming SIP calls fail)

I’m not sure the above is entirely relevant because it does look like you are getting a DID. Does the DID in your inbound route match the DID that the provider is sending EXACTLY?

Also (I get so tired of having to say this, it is such a common problem) try removing all the incoming settings but place the line context=from-trunk (that line ONLY) into your outgoing settings - if the provider is treating you as an extension rather than a peer, that should fix the problem.

You’ll never believe this but that’s what I just tried about 3 seconds before you posted and it worked! Thanks so much anyway!