Inbound SIP trunk - Number Not In Service


I have setup a SIP trunk, it works dialing out but not working for inbound calls. I get the number not in service announcement.

If i change the “Allow Anonymous Inbound SIP Calls” to yes it works fine.

I have read i need to add context=from-pstn to a configuration in my SIP settings. On my SIP Trunk settings, under outgoing settings under PEER Details i have added that but it doesn’t seem to help.

Can anyone point me into the right direction please?

Many Thanks

If you run asterisk r do you see the call come in? If not, check you sip settings and ensure you have the correct external ip set.

The call is coming into asterisk as i say if i change the “Allow Anonymous Inbound SIP Calls” to yes it works fine.


If the call is hitting your server and you have to turn on anonymous your trunk is probably not setup correctly. Post the contents of your trunk And some console output of a call.

have you set up an inbound route for the DID?

Here are the trunk settings

Outgoing Settings > PEER Details


The incoming settings are blank

@oxon88 the inbound route is fine judging from post 3


Can i bump this please?

You can bump to your hearts content, but we need more info to assist you.

Who is your SIP provider?

Provide some console of an inbound call.

“Provide some console of an inbound call.”

What do you mean please?

I have posted some config above is that not enough?

The provider is tIPicall a UK based company.


You need to log into the command line and start the asterisk console, make a call and provide the output.

Have you checked with you SIP provider if the have a sample config.

At the bottom of this page is a link to the wiki. There is a lot of info there for you to read.

I have checked they wont give any more detail other than an IP address and a phone number.

Is this the kind of output you want? -


You need to use an ssh client like putty to log into you system. Run asterisk -r to start the asterisk console. Make a call and post the output.

There are many posts on this type of debugging on the forum you might try a search to find some examples of using the tools asterisk and freepbx provide to assist in troubleshooting.

There could be any number of issues.

  1. firewall
  2. trunk not configured correctly
  3. sip provider
  4. inbound routes not set up

how many DID numbers do you have? just one?

you say it works ok when the ‘accept anon calls’ is on. Have you spoken with your sip provider to establish if this is the norm? It could be that the provider routes calls from more than one i.p. address.


Here is my output, many thanks.

Verbosity is at least 3
== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
– Executing [[email protected]:1] NoOp(“SIP/ 004”, “Received incoming SIP connection from unknown peer to 02035406958”) in ne w stack
– Executing [[email protected]:2] Set(“SIP/ 04”, “DID=02035406958”) in new stack
– Executing [[email protected]:3] Goto(“SIP/ 004”, “s,1”) in new stack
– Goto (from-sip-external,s,1)
– Executing [[email protected]-external:1] GotoIf(“SIP/”, “0 ?checklang:noanonymous”) in new stack
– Goto (from-sip-external,s,5)
– Executing [[email protected]:5] Set(“SIP/”, “TIME OUT(absolute)=15”) in new stack
Channel will hangup at 2013-02-25 08:40:33.432 GMT.
– Executing [[email protected]:6] Answer(“SIP/”, “” ) in new stack
– Executing [[email protected]:7] Wait(“SIP/”, “2”) in new stack
– Executing [[email protected]:8] Playback(“SIP/”, “ss-noservice”) in new stack
– <SIP/> Playing ‘ss-noservice.alaw’ (language ‘en’)
== Spawn extension (from-sip-external, s, 8) exited non-zero on ‘SIP/91.146.11 2.10-00000004’
– Executing [[email protected]:1] Hangup(“SIP/”, “” ) in new stack
== Spawn extension (from-sip-external, h, 1) exited non-zero on ‘SIP/91.146.11 2.10-00000004’

@oxon8 does that output help please?


Oh also the inbound route it set with the phone number 02035406958

I have 1 DID at the moment but will have more when we go live



As I mentioned earlier in the post it looks like your trunk is not configured correctly. This line of the logs is the key. I must get to work this morning so I can help right now.

Executing [0203540695[email protected]:1] NoOp(“SIP/ 004”, “Received incoming SIP connection from unknown peer to 02035406958”) in ne w stack

Thanks, for your time. From that can we gather what is incorrect please?


Can you show your trunk details
(peer/user/registration - all that apply) - note: remove/change passwords
It seems that Asterisk is unable to figure that this is a service you’ve subscribed to so is delivering to context from-sip-external which will not pass the call unless you switch “Allow Anonymous Inbound SIP Calls” on. This is not how you should run of course.
Your trunk setup might give clues as to why this is happening.