SIP Trunk Problems

My Trunk works when I allow anonymous sip calls, but soon as I turn it off I get:

[2017-10-19 15:12:58] VERBOSE[2096][C-00000064] pbx.c: Executing [[email protected]:6] Log("SIP/", "WARNING,"Rejecting unknown SIP connection from"") in new stack
[2017-10-19 15:12:58] WARNING[2096][C-00000064] Ext. s: "Rejecting unknown SIP connection from"
[2017-10-19 15:12:58] VERBOSE[2096][C-00000064] pbx.c: Executing [[email protected]:7] Answer("SIP/", "") in new stack
[2017-10-19 15:12:58] VERBOSE[2096][C-00000064] pbx.c: Executing [[email protected]:8] Wait("SIP/", "2") in new stack
[2017-10-19 15:13:00] VERBOSE[2096][C-00000064] pbx.c: Executing [[email protected]:9] Playback("SIP/", "ss-noservice") in new stack
[2017-10-19 15:13:00] VERBOSE[2096][C-00000064] file.c: <SIP/> Playing 'ss-noservice.ulaw' (language 'en')
[2017-10-19 15:13:02] VERBOSE[2096][C-00000064] pbx.c: Executing [[email protected]:1] Hangup("SIP/", "") in new stack
[2017-10-19 15:13:02] VERBOSE[2096][C-00000064] pbx.c: Spawn extension (from-sip-external, h, 1) exited non-zero on 'SIP/'

my sip settings are:

Invalid host line. You want two separate trunks, one for each host.

Since this is a “friend” trunk, you have options for both inbound and outbound calling. That’s fine but may not be right for your ITSP.

These are probably fine.

What is this “useragent”? I’m new to FreePBX (I’ve only been using it for a couple decades) and I’ve never seen that.

I before E except after C is the general rule.

This doesn’t work. You need to set up two trunks, one for each hostname.

Hi Thanks for the replies, silly me on the spelling but nicely spotted, thanks.

  • useragent I have removed
  • changed spelling
  • remove IP address in hostname

In regards to the hostname, I probably don’t need both as the hostname is the same as the ip listed, the reason I added the IP directly was because it wasn’t displaying the hostname under the logfile, it looks like it was registering with the IP address.

the error I’m getting now when trying to call the trunk is:

[2017-10-19 16:19:27] NOTICE[21284][C-00000068] chan_sip.c: Failed to authenticate device "************" <sip:**momobilenumber**@>;tag=as17538284

This doesn’t look like a trunk problem. It looks like you are trying to register an extension, which is outside the scope of the trunk definition.

I’ve only registered one extension 101 and that is working fine.
the ip address listed in the error is the sip trunk providers address.
the starred out characters is my mobile number when I try to call the sip trunk number.

OK - time to start troubleshooting.

Start with the extension. Dial “*65” and find out what extension your system thinks you are using.

Next dial “*101” (assuming your extension is 101) and see if you catch the ComedianMail prompts.

If those work, the “local” part of the PBX is probably fine.

If those are working (as I expect they are) you should call SipGate and try to place a call. They should be able to tell you what error you’ve made (I’m going to guess the number format is incorrect or that your connection isn’t right yet). They should be able to troubleshoot this in about 15 seconds.

After that, if they can’t help you, come back and post the 20 lines before and after the error message. The problem is probably something in one of the 20-or-so lines in front of the one you posted.

Hi thanks for your reply, I’m with for my provider and they haven’t really suggested anything.

Dialing *65 on my snom300 phone - women confirms my extension is 101
Dialing “*101” women says your call cannot be completed as dialed please check your number and try again.
dialing “101” on snom300 - you can hear it calling extension.
dialing “*98” you hear comedianmailbox

How are you dialing the cell phone?

I’m not calling from the pbx/snom phone, I’m calling to the trunk/pbx from my mobile phone.


I’m pretty sure you’re doing it wrong, but walk us through the process you are expecting to use.

  • I have a trunk configured, and if I do cli command “sip show registry” it shows that the trunk is registered.
  • I have extension 101 created and setup to a snom 300 phone, this seems to be working fine and connected to the pbx
  • I have an incoming route configured to ring extension 101.
  • this all seems to work fine If I call my trunk phone number with “anonymous sip calls” switched on.
  • soon as I “turn anonymous sip calls off” when I call the trunk phone number from my mobile phone it no longer works.

This step is the one I’m hoping to get information on.

You keep comingling different parts of your system as if they are the same thing. That doesn’t help your understanding of the system. Each of the components you listed is different and in many ways are totally unrelated.

You have a trunk - this allows you to connect to an ITSP and make and receive phone calls through the Public Switched Telephone Network.

OK - so you have a route - this connects the trunk with your PBX so that calls from the ITSP can be routed properly.

This allows your PBX to contact the phone and for the phone to place calls. For outgoing calls, the extension communicates with an outbound route to send your call out over a trunk which is set up as a “user” or “friend”.

Can you call your cell phone from extension 101? The answer to this question will help us understand the problem you are having.

When you call extension 101, how are you dialing it? You should be dialing the phone number for the PBX just like you’d dial your girl friend or mother. The call will arrive at the PBX, be processed through the trunk to the inbound route, and then be sent to the Snom phone.

If you call directly to the PBX through a “SIP/[email protected]” call, you are going to have problems. Anonymous calling allows anyone to use your PBX to make calls to anywhere you can call in the world. Many people have discovered that phone companies don’t care how you messed up, you still owe them for every call that was made.

If you are calling the PBX’s number through the ITSP and are getting that error, it means that your configuration for the trunk is still wrong and your ITSP is not registering with your system to send you calls. Remember - inbound and outbound trunk configuration are unrelated - just because we can combine the configuration into a single stanza doesn’t change the fundamental fact that the inbound and outbound (peer and user) legs of the trunk are independent and may work in one direction and not in the other.

In other words, you shouldn’t use a trunk to try to communicate with a phone. You can set up a SIP extension and use a SIP Phone program on your cell phone (Zoiper, for example) or you can use the PSTN to communicate.


Just to confirm, trunk is now working correctly, I needed to add insecure=invite to my sip settings.