External IP at Trunk level?

As many of you might have gathered from previous posts I am running an ancient 2.11 install that I am slowly (almost complete) migrating to FPBX 16

One of my last stumbling blocks is the trunks. As the web interface between the two systems is completely different it’s taking a bit of time to suss things out.

My main concern is that the new server will have two Gamma sip trunks available to it however Gamma authenticates based on IP address (no user/pass involved). The sip trunks are on different DSL circuits for redundancy so will have a different outward facing public IP.

To get the existing live SIP trunk to work on 2.11 I had to define our ‘External IP’ under Asterisk SIP Settings. This works fine as we only have the one trunk at the moment (the other is an old ISDN line). Thinking ahead to when we have two I’m not sure how I then go about assigning an external IP on a per trunk basis. If I followed the config based on the old server then I can only define one external IP.

Can I ignore the ‘External IP’ section in SIP settings and define this on a individual trunk level?

chan_pjsip allows you to bind to multiple interfaces, so outbound should not be a problem. The problem you will have is within inbound, as the provider IP address will determine the endpoint. Do they send distinct DID values, so you can separate them at the inbound route level?

Where do I configure this and then link the trunk to that particular interface?

Inbound should be fine as each inbound has a unique DID so inbound routes handles this

I don’t know if it can be done through the GUI, but you create a type=transport section for each interface and include that in the type=register and type=endpoint sections.

There is a procedure here(it starts by saying no, then amends that), but it might be worth checking to see if there is now a GUI way:

Thank you. I can’t do anything with the primary SIP trunk just now as that’s on the old server. I’m just waiting for the second trunk to be set up. When it’s live I’ll do a bit of experimenting with the custom conf files.

Unless anyone is able to jump in and detail how it can be done via the GUI?

I now have the SIP trunk available to me and have been running some tests however my initial problem still remains. For example, incoming worked but not 100%. Signalling didn’t route correctly until I defined ‘External IP Address’ under PJSIP in Advanced Settings. I was bogged down with fiddling about with Trunk settings until I realised that Incoming doesn’t go near that however the issue would remain for outbound as well? - Fine for one trunk but we want two trunks that will be routing through two separate internet connections. As mentioned earlier our supplier (Gamma) authenticates and routes based on external IP, surely others do to?

Is it possible to define ‘External IP Address’ some other way. Obviously incoming does not go near a trunk as such but surely there must be systems out there that have more than one trunk linked to their system?

I also noticed that under Advanced SIP settings the SIP page allows for multiple local networks to be defined. The PJSIP page only allows for one.

Is what I am trying to achieve possible?

Another option - As I am running this as a VM, could an option be to set up another fpbx, all that it does is link to the second trunk with an IAX link between the two?

Most people only have one external IP. This should only really become a problem if you have multiple accounts on one ITSP but it is generally better to have one account and apportion costs internally.

As I already said, chan_psjip does support multiple transports, which can have different internal addresses, but you will have to hand code some of the configuration.

I have gone through the earlier posts about hand coding which sort of makes sense but doesn’t cover the ‘External IP’ side of things and even if it did how would it differentiate on how a call came in. The more I think about it, I think the simplest option is to set up another fpbx vm that has nothing on it apart from the second trunk link. Then link the two servers

How do I add more ‘Local Networks’ to pjsip when the GUI only allows for one (multiple are available against SIP)?

External IP is part of the transport settings.

The source IP of the incoming call would be used to identify it to the channel, regardless of the transport. The DID (by default request URI user field) is used to identify it to the core of FreePBX.

I’m struggling to get my head around how it would work. For example, looking at incoming only, a test just now with no defined external IP, the call came in, audio played back but one way and it didnt detect the hangup. I define an external IP and it all works. I can’t get my head around if we had both lines set up and a call came in via each. How does it handle which IP to route via? - I can understand the setting up of a second unit and routing through that.

In a NAT environment, the FreePBX machine can only control which local IP is used. It is up to your routers to ensure that that distinction is preserved in the public IPs.

The local IP is determined by the interface to which you bind,

The interface and port are determined by the transport.

Not having tried it myself, I can’t 100% guarantee that chan_pjsip will use the correct transport for responses to incoming traffic.

In addition, at the Linux level, you can set specific routes to particular destination addresses, which result in the use of an interface other than the normal default one, for just that address.

I shall experiment as it sounds like what I’m trying to do if not the norm. Failing this I’ll experiment with the second VM which may be the simpler option although a tad more work to set up

Pulling my hair out with this today. So I’ve not even managed to get onto the multi trunk yet. I’m still only trying to get this new sip trunk working on the new system. Not doing anything fancy, purely done through the GUI at this stage, I thought i had it sussed.

Operation is WAN > Router > pfsense > FPBX

I’ve set up the trunk and I can ring in and out but there’s only one way audio. I have my NAT settings under SIP settings set to my external IP and defined my local network. To add a further complication if I ring an existing company number which goes out and comes back in the other connection to the live server (also no the same subnet) I don’t get any local ringing at the handset and when answered one way audio. I’m pretty sure it’s NAT but not sure where. FPBX, pfsense or the router.

A paste bin of a call with verbose 10 is below. Does the Strict RTP lines suggest it’s Asterisk that’s tagging them wrong?


This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.