Inbound call problem

Hello guys.
I am having trouble receiving call to the freepbx. I have set up trunk (using 1 trunk) and extensions. Extensions can register on freepbx without any problem and can make a call.
Unfortunately, I can’t receive call. There is no log in asterisk log.
I suspect that I must have missed some ports to forward. Here is the list of the ports I’ve forwarded.
Hope you guys help me. If you need more info, just tell me.

In Asterisk SIP Settings, confirm that External Address and Local Networks are correctly set. If you change these, after Submit and Apply Config you must restart Asterisk.

I assume that you are using a pjsip trunk and Qualify Frequency is set to a reasonable value (such as the default of 60).

If the trunk uses registration, confirm that it shows registered. If it uses IP auth, check that you correctly entered your public IP address on the provider’s portal.

If you still have trouble, run sngrep and see whether anything appears there on an attempted inbound call. If so, FreePBX Firewall is blocking the call (but with default settings it shouldn’t).

If nothing in sngrep, does the Mikrotik have a public IP address on its WAN interface? If not, please explain (behind ISP gateway, ISP does NAT, etc.) If yes, capture traffic on the WAN to see whether the incoming INVITE is received. If yes, there is something wrong with the router config. If no, use pjsip logger to see whether the REGISTER request has a proper Contact header. If ok, there is likely a wrong configuration on the provider’s portal. What if anything gets logged at the provider?

Hi @Stewart1
Thank you for the suggestion. I will check the things you’ve provided when I get to work.
Mikrotik has static IP address. Also, on report section, trunk uses registration and is registered.

Thanks again.

In Asterisk SIP Settings, External address and Local Networks are correctly set.

In pjsip trunk advanced settings, Qualify Frequency is set to 60.

Trunk uses registration and it’s registered. Can make a call from extension to external number.

As for the Mikrotik, it’s WAN interface has external IP address. Forwarded required ports (added 1 port to forward list)

Contacted SIP provider and waiting for the log on their side.

This is the first time I’ve heard about sngrep. I will post report here after watching tutorial. :smiley:

I’ve checked sngrep.
There is no INVITE from the sip provider.

When I call to the phone number (trunk sip), it just gives hangup signal (short, fast paced signal).

Does this mean Mikrotik is blocking incoming calls?

Using pjsip logger or sngrep, look at the Contact header of the REGISTER request and confirm correct transport, IP address and port.

If that’s good, use the Packet Sniffer in Mikrotik to capture e.g. UDP port 5060 traffic on the WAN interface. If you see the incoming INVITE there, the Mikrotik is indeed blocking it, though from what you have told us so far, I don’t see why that may be happening.

If the INVITE doesn’t appear on the WAN interface, you may not have set up the provider portal correctly. For example, many providers require you to set a ‘routing’ for each number you have with them. Also, most providers have call history visible from their portal.

Otherwise, you may need to contact the provider. If you recently ported this number from another carrier, it’s possible that the carrier you are using for the test call has not updated their routing tables and you may need to contact them for help.


This looks very wrong; it looks like there has been a quoting error in an expression.

Just an attempted SQL injection by an attacker. Properly blocked by FreePBX firewall, so no biggie.

I’ve checked Mikrotik. There are packets coming from the SIP provider’s IP address. But I couldn’t differentiate INVITE or REGISTER or any other type. Here is the packet sniffer result. First and third log’s destination is WAN IP
Second log’s destination is ip phone and last one is to the freePbx.

Just in case I’ve written rule for udp and tcp protocol from SIP provider’s IP address.

I’ve added Server and outbound proxy IP addresses to the Freepbx’s firewall as trusted. In my opinion there shouldn’t be any problem, but I must be missing something.

This number is not ported from another provider. We have been using this number at least a year. How do I differentiate INVITE or REGISTER requests on Mikrotik? Did I miss something? Can I contact you privately?

I can’t tell from what you posted, but when you run Packet Sniffer on the Mikrotik, the complete packets get written to a file on the device, which you can then download to your workstation and open in Wireshark. Wireshark will parse the SIP nicely for you and show what is happening.

Just guessing, based on the relatively small sizes, the packets you are seeing are responses to REGISTER and/or OPTIONS requests and there is no INVITE present. But if that is true, you can at least confirm that the Contact headers are correct.

Checked the file using wireshark. There is indeed INVITE request.

But I couldn’t understand what s stand for. Can you help on this one?

The ‘s’ is Asterisk’s default Contact username. Usually, you want the DID number there. On the Advanced page for the trunk, set Contact User to the number, matching exactly what your Inbound Route has in DID Number.

If you still have trouble, at the Asterisk command prompt type
pjsip set logger on
make a failing inbound call, paste the Asterisk log for the call at and post the link here.

s is the default contact user contact user value for Asterisk pjsip registrations. I think it stands for start, as it is the extension used by analogue lines when the caller goes offhook and the dialplan is given immediate control. You should either have an s as the DID for the route, or you should set the expected DID as the contact user.

If the actual DID is elsewhere, you should be extracting that before you get to the from-pstn (from-trunk) context. In the case of using the To header user, there is a supplied context for doing that.

Here is the log
I’ve set up DID in trunk’s advanced tab and inbound route.

Still no luck on receiving call

What do the various addresses represent? You seem to have INVITEs sent to two different addresses.

It’s scripted attack from others. My provider’s ip is
I’ve got freepbx at (local network) and real ip on WAN (

If these are the same request before and after NAT:

you have a SIP ALG (application level gateway) changing headers (the request URI should not have reflected the address change). The general advice is to disable SIP ALGs, as they are normally more trouble than they are worth.

Moreover, there is no sign that Asterisk actually received these.

1 Like

IP->Firewall->Service Ports->sip (uncheck Enabled)
If you still have trouble, post screenshot of the dstnat for udp port 5060.

I couldn’t find SIP ALG in freepbx config. Could you direct me?

Disabled service ports

Here is the screenshot of dstnat



What device, if any, is at Could this be left over from an old PBX?