Incoming call from SIP trunk failing

hi all,
i have a SIP trunk which is working fine for outgoing calls. however i have problems with incoming calls. for some reason it seems FreePBX rejects the call! i suppose i have just missed some thing somewhere but can figure it out.

i have set a general ‘allow all’ incoming route, as well as a specific incoming route with the given DID.

this is what the log shows:

[2013-05-17 12:50:50] VERBOSE[28487] pbx.c: – Executing [[email protected]:1] NoOp(“SIP/217.XX.XXX.XX-00003757”, “Received incoming SIP connection from unknown peer to +31000000000”) in new stack
[2013-05-17 12:50:50] VERBOSE[28487] pbx.c: – Executing [[email protected]:2] Set(“SIP/217.XX.XXX.XX-00003757”, “DID=+31000000000”) in new stack
[2013-05-17 12:50:50] VERBOSE[28487] pbx.c: – Executing [[email protected]:3] Goto(“SIP/217.XX.XXX.XX-00003757”, “s,1”) in new stack
[2013-05-17 12:50:50] VERBOSE[28487] pbx.c: – Goto (from-sip-external,s,1)
[2013-05-17 12:50:50] VERBOSE[28487] pbx.c: – Executing [[email protected]:1] GotoIf(“SIP/217.XX.XXX.XX-00003757”, “0?checklang:noanonymous”) in new stack
[2013-05-17 12:50:50] VERBOSE[28487] pbx.c: – Goto (from-sip-external,s,5)
[2013-05-17 12:50:50] VERBOSE[28487] pbx.c: – Executing [[email protected]:5] Set(“SIP/217.XX.XXX.XX-00003757”, “TIMEOUT(absolute)=15”) in new stack
[2013-05-17 12:50:50] VERBOSE[28487] func_timeout.c: Channel will hangup at 2013-05-17 12:51:05.257 CEST.
[2013-05-17 12:50:50] VERBOSE[28487] pbx.c: – Executing [[email protected]:6] Answer(“SIP/217.XX.XXX.XX-00003757”, “”) in new stack
[2013-05-17 12:50:50] VERBOSE[28487] pbx.c: – Executing [[email protected]:7] Wait(“SIP/217.XX.XXX.XX-00003757”, “2”) in new stack
[2013-05-17 12:50:52] VERBOSE[28487] pbx.c: – Executing [[email protected]:8] Playback(“SIP/217.XX.XXX.XX-00003757”, “ss-noservice”) in new stack
[2013-05-17 12:50:52] VERBOSE[28487] file.c: – <SIP/217.XX.XXX.XX-00003757> Playing ‘ss-noservice.gsm’ (language ‘en’)
[2013-05-17 12:50:57] VERBOSE[28487] pbx.c: == Spawn extension (from-sip-external, s, 8) exited non-zero on ‘SIP/217.XX.XXX.XX-00003757’
[2013-05-17 12:50:57] VERBOSE[28487] pbx.c: – Executing [[email protected]:1] Hangup(“SIP/217.XX.XXX.XX-00003757”, “”) in new stack
[2013-05-17 12:50:57] VERBOSE[28487] pbx.c: == Spawn extension (from-sip-external, h, 1) exited non-zero on 'SIP/217.XX.XXX.XX-00003757

under SIP setting i had “allow guests” option enabled by default.

About the IP/network settings:

  • my SIP service provider wants me to register with when i look at SIP registration, this DNS resolves to IP 195.XX.XX.XX. The incoming call is coming from IP address 217.XXX.XXX.XX. So this explains part of the problem.

  • i checked my trunk setting with my SIP service provider and everything is as they recommend. SIP trunk is also registering with no problem. However under trunk setting > Incoming Setting > User details everything is left blank (as recommended by provider). i wonder if i do have to enter anything here!

any suggestion?

“Received incoming SIP connection from unknown peer…”

Do you have a trunk set up properly? This error indicates that Asterisk doesn’t recognize your SIP trunk, either by IP address or registration.

You need “Allow anonymous inbound SIP calls”. In General Settings. But i not see where this setting :frowning: Anybody know where this options in FreePBX 2.11.0beta2?

Check the Network setting at the terminal you are registering…

Install Asterisk SIP settings module. The setting is in there. I would not recommend enabling allow anonymous calls though. You shouldn’t have to do that to get a trunk to work. Perhaps you mean allow guests? That one does sometimes need to be enabled to get trunks to work and is not really a security risk. That one is also in Asterisk SIP settings module.

I know about risk. I using this only on test-stand.

If you do not have an inbound route or it’s not set right you will also get this behaviour.

Who is the trunk provider?

I have an inbound route, name is set and the DID in international format +31XXXXXXX. The call is sent to DISA for testing purposes right now!

My provider is VOYS, which is a dutch SIP provider based in the Netherlands.

You probably need to strip the + from the front of the DID, there is a context in /etc/asterisk/extensions called [from-pstn-e164-us] you could perhaps copy that into extensions_custom.conf, modify it for your Dutch stuff, then send the inbound calls to that context.

I have also tried this without the + on fron of DID. the problem remains!

Non the less I suggest you try building


as suggested and try again.

I would also try with no DID on the inbound route.

My main incoming route has a blank DID. So this should also work if that was the problem. this incoming route passes all my incoming calls from my ISDN gateway with no problem!

Yes i will do this!
for now i can confirm that by allowing “inbound anonymous Sip calls” under General Setting, the problem will be resolved. Of course this is not a acceptable fix, just for testing it does work.

I guess there should be a way to force freePBX to accept certain IPs or add them in the trunk setting?!

Guest its guest. Need “Allow Anonymous Inbound SIP Calls” change on “yes”

I dont think its such a good idea to leave this open, or is this common practice?

Very bad idea :slight_smile: but work… and but only practice :slight_smile:

If that is the setting you need to make it work that probably means your trunk is not configured properly. There was another thread here with someone who had the same problem and the solution was his trunk configuration.

thanks mustardman,
i have looked through this forum and found these two posts.

they both have similar issues but no solution has been given. At least not by changing trunk configuration. do you care to share if you know any other post that address this issue?
obviously i would prefer to leave this option closed if possible, so i would prefer somehow fixing this using trunk config.