Incomming calls not working

I have the latest version running on a Raspberry PI. Incoming calls give the dialler a service not available message.
If I connect a snom phone directly to the Sip service provide everything works fine. If I set it up as an extension on FreePBX then outgoing calls work but no incoming.
I set up a second extension which I linked to my smart phone. When dialing the other extension I get a call busy message and can save a message.
Inbound route has both CID and DID set to ANY. At the Aterisk cli I see no activity when inbound call is attempted.
Could this be a router problem even though the Snom phone works?

You did not setup your Inbound route correctly.

The inbound route is set to go to an extension. The snom phone is set up on that extension. If I phone it from a different extension I get a busy message and can leave a message. Not exactly sure why it is busy and does not ring. I have not investigated that. I am still trying to get an external call to work

The log file in /var/log/asterisk/full should give you the full story on why you are not getting the phone to ring. If your inbound calls are failing when sending them to an extension that doesn’t work, you might need to trouble shoot the easier problem first.

I resolved the extension not ringing problem but I still am not able to receive incoming calls.
I am using the pjsip settings.
The logs do not show the incoming calls. I have tried various context settings but the problem is still the same.
As explained above if I put server and login details into a snom phone or softphone such as zoiper it all works as expected.
Any suggestions of what I could try?

If your logfiles are not showing the call getting to your FreePBX installation, you need to start troubleshooting in from the your ITSP.

So, are you using Host Security or are you logging in and registering? Your ITSP will tell you which one they are expecting you to use.

If you are using Host Security, make sure your external router is set up to DISABLE SIP-ALG and any other “SIP Helpers”. Then use “tcpdump” or “wireshark” to scan your network and make sure the external router is sending the packets to the right port and address in your local network.

If you are using the Integrated Firewall, make sure all of the addresses in that part of FreePBX are set up correctly. Be sure to mark your ITSP as a Trusted source (as well as getting all of the Local networks right).

We need logs to get any further. We’ve tried troubleshooting with people that only tell us that stuff doesn’t work before, and it just isn’t a satisfactory solution.

I will check these things. I know that logs would help but as I explained they do not contain any record of the call.
One thing I did notice was if I remove the port setting in Asterisk then when I attempt to phone the Sip number it is just dead. If I leave the port number (as it should be) then I get a message saying that the number dialed does not exist. Not sure if this shines any light on the problem.
When I test with Snom phone or softphone they are on same wifi network that FreePBX board is currently on. This makes me think that the router is working ok but that perhaps I am not setting something in FreePBX that is affecting how router interacts with it.
Perhaps I should try using sip_chan instead of pjsip?

I don’t understand. If you mean “SIP Server Port” for the trunk, that defaults to 5060 if left blank, which is what most providers require. If yours uses a non standard port, then if you leave this blank you won’t be able to register and outbound calls will also fail.

If you mean “Port to Listen On” in Chan PJSIP Settings, setting that blank will disable pjsip altogether and even your extensions won’t work.

If you mean something else, please explain.

To troubleshoot:

Go to Reports -> Asterisk Info -> Registries and confirm that your trunk shows as registered.

It’s possible that the NAT association in your router is timing out. To test, make an outgoing call to your mobile. You need not answer it, but wait for it to start ringing, then hang up. Immediately (within 30 seconds), call in from your mobile. Report exactly what you hear, e.g. “The number you have dialed is not in service. Please check the number and try again.” Go to Reports -> Asterisk Logfiles. You should see the log of your outgoing call. After that, if you see anything related to the incoming call, paste it at and post a link here.

I tried dialing mobile and then dialing back from my mobile. I get the same message…
“The number you have dialed does not exist. Please re-dial carefully or consult directory inquiries”
Reports -> Asterisk Info -> Registries shows trunk as registered.

Using my mobile as an extension allows me to dial the extension (107) which is the one set to be used by the inbound route. The mobile is using wifi -> PBX - >snom phone via router

Would there be any port settings required for FreePBX which are not required when using the phone without FreePBX ?

There is no such announcement in Asterisk, so it was almost certainly played by your mobile carrier because it did not receive a response from your trunking provider. It’s certainly possible that your router has a SIP ALG that is misbehaving when used with Asterisk.

If your router has any settings related to SIP, try turning those off.

In Chan PJSIP Settings, try changing Port to Listen On to a nonstandard value, e.g. 5678. Restart Asterisk for this to take effect. You will have to reconfigure your extensions to match. In the Snom -> Login, set Registrar to e.g.
(replace with the local IP address of the Pi).
Confirm that the extensions still work and trunk is registered and you can call out, then retest incoming.

If you still have trouble, please post:

Modem make/model? Separate router/firewall if any? Any non-default settings in Snom for SIP or NAT? Post any Login settings in Snom when registered directly to ITSP other than Displayname, Account, Password and Authentication Username. Post all settings for your pjsip trunk other than Username, Secret and anything else you consider personal (though identify which settings those are).

The router is a Mikrotik running routerOS. I turned of the Sip setting and it did change what happened. Now when I dial from my mobile I do not get the message. I get nothing and after about 10 seconds the call ends. There is still no record of call in the logs.
Tomorrow I will investigate further

That’s good news, because Mikrotik has a packet capture that lets us easily view what’s happening on the internet side. First, see whether an INVITE appears on an incoming call. If so, we can see whether it’s passed properly to the LAN interface, whether it’s blocked by FreePBX firewall, etc.

If not, we can look at whether REGISTER requests are going out and if they are properly formed.

Please confirm that the Mikrotik gets a public IP address on its WAN interface. If not, an ISP-supplied gateway or ISP NAT could be causing trouble.

I have only recently got the router so I will have to investigate how to do that. Also because the router was provided by my fiber provider they have disabled certain tools such as Torch. (basically I can either use their free router or buy my own - if I do that they will not give me any support if they think it is a router problem :frowning: I can change almost all of the settings apart from those that they think are critical to their service)

The tool you want is called Packet Sniffer, in the WebFig Tools menu, or via command line.

Select whichever interface connects to the fiber ONT (modem). If there is significant other traffic on your network, set a Filter with the IP address of your trunk provider. It’s probably easiest to capture to a file: Start capture, make call attempt, stop capture, download file, open in Wireshark. If you see nothing, test with an outbound call to confirm that the capture is working as expected.

Unfortunately that is one of the tools that I don’t have access to. :frowning: The ISP seems to just allow me to make config changes but not examine data.
I can look at the packets on the wifi port of Linux on the device where FreePBX is installed.

Then likely


on the PBX itself would be a first diagnostic.

Not sure if this helps… this is the register trace from the snom300 when connecting without pbx:

Via: SIP/2.0/UDP;branch=z9hG4bK-6rqu6sua7g3z;rport
From: "YYZZXXXXXXX" <sip:[email protected]>;tag=gcbdd8u5qq
To: "YYZZXXXXXXX" <sip:[email protected]>
Call-ID: XX35XX363938XXXX3736XXXX31XX38-8f9ebangojwk
Max-Forwards: 70
Contact: <sip:[email protected]:5060;line=pijrcu8l>;reg-id=1;q=1.0;+sip.instance="<urn:uuid:a2fdXXXX-d465-XX8c-89da-000XX34909XX>";audio;mobility="fixed";duplex="full";description="snom300";actor="principal";events="dialog";methods="INVITE,ACK,CANCEL,BYE,REFER,OPTIONS,NOTIFY,SUBSCRIBE,PRACK,MESSAGE,INFO"
Allow-Events: dialog
Supported: path, gruu
Expires: 3600
Content-Length: 0

Received from udp:XX.XX.XX.XX:5060 at May 8 14:59:14 (419 bytes):

SIP/2.0 200 OK
Via: SIP/2.0/UDP;received=;branch=z9hG4bK-6rqu6sua7g3z;rport=5060
From: "YYZZXXXXXXX" <sip:[email protected]>;tag=gcbdd8u5qq
To: "YYZZXXXXXXX" <sip:[email protected]>;tag=aprqh79dcj0-68qu71300032c
Call-ID: XX35XX363938XXXX3736XXXX31XX38-8f9ebangojwk
Contact: <sip:[email protected]:5060;line=pijrcu8l;ob>;expires=30

Ok have moved forward a bit. I changed the port as suggested by @Stewart1. Running sngrep now shows up a record when a call comes in. OK the record shows that the call was rejected but I hopefully can figure out why…
OK just found F4 in sngrep nice tool… thanks @dicko :slight_smile:

If the call is coming to Asterisk now, you should be able to see the reject reason in the logs.

IT WORKS :smile:
Thanks to all of you for the help.
So I think the actual problem was the Port to Listen On.
At first I left it blank, later I put 5060 in it and now it is 5678
What should it normally be set to?