External Softphone Dialing Internal Softphone

Hello, I am using softphones over pjsip. Currently on the local network, everything works, the voice and video calls.
I can also dial onto a softphone that is external and is one of the extensions.
My issue is that I cannot dial any extensions when using a softphone external to my network.
I don’t have any trunks setup, I am very new to this stuff but I have spent a lot of time trying to set up this.
I have 5060, 10000-20000 ports open.
I would appreciate if someone could assist me or say if this is even possible.

There is nothing special about soft phones, except maybe that they are likely to have weaker SIP implementations, and poorer NAT support.

You haven’t mentioned NAT, but I assume that Asterisk is behind NAT. Are the external soft phones also behind different NAT. What have you configured in the routers at the soft phone sites to ensure that inbound SIP and RTP can reach the soft phone?

Assuming the above, what have you done to make Asterisk aware of its public address, and what have you done to make the external soft phones aware of their public addresses?

Do calls to Asterisk extensions work before the point where an outgoing leg is being set up (for example to the Playback and Echo applications)?

At what point in the SIP dialogue does anything go wrong and what exactly goes wrong in protocol terms?

Which version of Asterisk, and which soft phone? Which routers?

The best solution is to use VPNs to handle the NAT mess.

The next best thing is to have the soft phones use a fixed SIP port and fixed RTP range, and to set up port forwarding for those, on the remote site, and also to configure the remote soft phones to present their public address in SIP and SDP, rather their LAN address (these should also all be done at the Asterisk end, for the Asterisk system, as well.

Failing that you may have to rely on dynamic rules being added by the remote router, as the result of seeing traffic and possibly also as the result of inspecting packet contents (although SIP ALG features normally break things). You may also have to rely on enabling the Asterisk options that cause it to ignore addresses in SIP and SDP and use addresses actually used, instead.

That is a lot of information, I will try to understand it.

I haven’t actually looked into NAT, could that be an issue? When I login on an external soft phone using the asterisk extension details, it does say that it is connected, and I can dial it from a local softphone.

Currently, I am testing using mobile data as the external network for softphones.
I am not aware that I have done anything to make Asterisk or softphones aware of their public ip.

Sorry for not being clear, I am not sure what the difference between Asterisk extension and softphone extension is, I set up extensions under the connectivity tab.
Not 100% sure what you mean by “an outgoing leg”. I checked echo, externally it doesn’t work, locally it does.

How could I check the SIP dialogue?

Current Asterisk Version: 16.20.0

Yeah the VPN would make external issues fixed, I would prefer to not use a VPN for my use case, I am not knowledgeable enough about SIP stuff and that’s why I am having issues. I would be grateful if I could get assistance with this issue.

With my end goal use case, it would have to work with dynamic ip’s.

My only issue is that an external softphone using local extension credentials cannot initiate anything. If I initiate a call locally to an external softphone then it works. Even enabling the camera only works if the local softphone initiates it first, the external softphone cannot enable camera requests for local softphone.

I will also talk to my friend who might be able to understand this a bit more. If you do see the flaw in what I have told you please let me know.

That is potentially close to worst case as the network may introduce NAT processing that is out of your control and may even deliberately block VoIP.

Sorry, I got confused as about which forum I was on. Asterisk uses a much narrower definition of extension than FreePBX does.

The incoming leg is from the originating phone to the PABX and the outgoing leg is from the PABX to the called phone.

Sorry, PBX and PABX big difference?

No difference in the current context. The A stands for automatic, but no-one uses PMBXes these days (human operator with jack plugs). PBX is a term that covers both.

Do I need to set up inbound, outbound and trunk things, to use the system with softphones that are using extension credentials externally?

No. Any solution will lie in the pjsip configuration. and outside of FreePBX/Asterisk (routers and firewalls), not at the higher abstraction levels of routes and trunks. Again, there is no fundamental difference between soft phones and hard phones. If you are using a softphone on a mobile phone, it is the mobile network that will be the issue, not the fact that the mobile might not provide the access needed to actually use a hard phone.

Are you aware of the push server issue for VoIP calls going towards mobile devices?

Use the “pjsip set logger on” CLI command, then look as the logs.

If there would be an issue with using mobile data, wouldn’t I not be able to receive calls from local network?
I am able to receive a call from local network while on mobile data, and I can communicate both ways.
The problem is that I cannot initiate the call from mobile network, I haven’t yet tested with another network that isn’t mobile.

Without logs showing how the call is failing, it is too much guesswork to try and identify a specific cause. However the fact that you can register does hint that the mobile network may not be the main problem.

You may also want to take note of: Providing Great Debug - Support Services - Documentation

This looks like something of interest, what do you think?

Oh sorry, this is me locally using external IP

Ok I don’t remember doing anything… it seems that i can now initiate a call from an external device, but now there is no sound…

I have this error

[2022-01-17 18:07:35] WARNING[18063][C-0000000d] chan_sip.c: This function can only be used on SIP channels.

It isn’t an error, but rather a warning, and it is incomplete. I think it is probably the expected diagnostic when making outgoing PJSIP calls on FreePBX. FreePBX sets some additional SIP headers using both the chan_sip and chan_pjsip methods, rather than determining which one to use first.

Lack of audio is generally a NAT or firewall issue.

Generally people prefer plain text, not images, for logs, etc. Fpr large ones, use pastebin.freepbx.org

On boot I get errors for modules, are these important? pastebin.freepbx org/view/48220fe5

Unlikely to be and it is too much trouble to check in detail. What we need is the failing call. If an important module is missing, that should give a clue as to which.

The failing calls doesn’t even show on the log,
When I say connect I mean the programme I am using says that it is connected using the extension credentials.
I can establish the connection. It seems to be an issue when I’m using the public IP. Somehow I managed to connect on my local network using the public IP and it wont Dial any extensions. I can dial from an extension using local IP onto the extension using public IP.
This used to be the case when using mobile data, but now I might have messed up some settings and cant use mobile data to even connect using the credentials for the extension

Should I even be able to use public IP locally?
My current setup is, I am using an all in one router provided by isp, I borrowed a tp link router from a friend to have more control. The PBX is connected to the borrowed router which is connected to the provided router.

You need to enable NAT Mode : Yes (force_rport, comedia)