Inbound SIP trunk going straight to "Number not in service"

I’ve got a SIP line.

I’ve configured it and it dials OUT correctly. I can use it to successfully make outbound calls.

However, when I dial IN, I get a “This number is not in service” announcement. Traditionally we’ve been using ZAP channels and POTS for our system and that all works correctly when somebody dials IN to the ZAP channel as well as OUTBOUND working too.

Here’s some of the logs from the asterisk cli when I dial the SIP number from my cell phone into the system. ‘philglau’ is part of the Register String provided by the carrier.

asterisk*CLI>
– Executing [[email protected]:1] GotoIf(“SIP/philglau-086e3f90”, “0?from-trunk||1”) in new stack
– Executing [[email protected]:2] Set(“SIP/philglau-086e3f90”, “TIMEOUT(absolute)=15”) in new stack
– Channel will hangup at 2012-09-25 23:19:47 UTC.
– Executing [[email protected]:3] Answer(“SIP/philglau-086e3f90”, “”) in new stack
– Executing [[email protected]:4] Wait(“SIP/philglau-086e3f90”, “2”) in new stack
– Executing [[email protected]:5] Playback(“SIP/philglau-086e3f90”, “ss-noservice”) in new stack
– <SIP/philglau-086e3f90> Playing ‘ss-noservice’ (language ‘en’)
– Executing [[email protected]:6] PlayTones(“SIP/philglau-086e3f90”, “congestion”) in new stack
– Executing [[email protected]:7] Congestion(“SIP/philglau-086e3f90”, “5”) in new stack
== Spawn extension (from-sip-external, s, 7) exited non-zero on ‘SIP/philglau-086e3f90’
– Executing [[email protected]:1] NoOp(“SIP/philglau-086e3f90”, “Hangup”) in new stack
– Executing [[email protected]:2] Set(“SIP/philglau-086e3f90”, “DID=s”) in new stack
– Executing [[email protected]:3] Goto(“SIP/philglau-086e3f90”, “s|1”) in new stack
– Goto (from-sip-external,s,1)
– Executing [[email protected]:1] GotoIf(“SIP/philglau-086e3f90”, “0?from-trunk|s|1”) in new stack
– Executing [[email protected]:2] Set(“SIP/philglau-086e3f90”, “TIMEOUT(absolute)=15”) in new stack
– Channel will hangup at 2012-09-25 23:19:59 UTC.
– Executing [[email protected]:3] Answer(“SIP/philglau-086e3f90”, “”) in new stack
== Spawn extension (from-sip-external, s, 3) exited non-zero on ‘SIP/philglau-086e3f90’

Here’s what I have set up in the Trunk:

Outgoing Settings

disallow=all
allow=g729&ulaw
dtmfmode=inband
canreinvite=no
host=.net
type=peer&friend
insecure=invite
nat=yes
qualify=yes
username=

secret=
****

User Context: sip_in

User Detail:

disallow=all
allow=g729&ulaw
dtmfmode=inband
canreinvite=no
context=from-pstn
insecure=invite
secret=*****
type=friend
username=*****

What am I doing incorrectly?

— Edit — System Info ----
FreePBX Base Version: 2.4.0
FreePBX Framework Version: 2.4.1.9
FreePBX Core Version: 2.4.1.6

Asterisk 1.4.18.1-2 RPM

If I set allow Allow Anonymous Inbound SIP Calls? to “Yes”, then it works and I can receive an INBOUND call on the SIP line.

When it’s set to “No”, I get the “Number Not in Service”.

???

Until today I’ve had it set to “No”.

Seems like it should remain set to “No” for security reasons and that I only need to change some other thing, but not sure what ???
Or is it necessary to allow Anonymous Inbound SIP calls?

Looks like I was missing the:

context=from-pstn

in my Peer Details.

I’d bet that you’re using Callcentric. If so, you need to allow anonymous inbound calls to get inbound calls working reliably. If you make the changes that they recommend to sip_general_custom.conf, it has the same effect as allowing anonymous inbound routes.