Multiple vendor interfaces on freepbx

I’m using three NIC cards

eth0 192.168.0.0/24 Intranet
eth1 1.1.1.0/24 TRUNK-1 (default route)
eth2 2.2.2.0/24 TRUNK-2 dedicated

The issue is that each vendor requires their own network to send/receive their SIP communication.
Dedicated TRUNK-2 network is not for general use, but TRUNK-1 is.
General users register their devices using eth0. and eth1.
Routing table shows default to GW 1.1.1.1 on eth1

When placing a call routed to TRUNK-2, the system incorrectly identify the call as coming from TRUNK-1 as originator, however correctly send the packets through TRUNK-2 as expected, the call is placed but a) no signaling (no hangup) b) no audio. Also, incoming call entering through TRUNK-2 are received, you can answer, but no voice nor signaling

Looks like when creating SIP headers, asterisk is not aware of the multiple interfaces and use TRUNK-1 (IP address) as default identification for all the calls.

Yes, I have static IPs and static routes (including each vendor ‘sip’ multiple addresses), and routing, looks ok,however, the asterisk INVITE package, still send the ‘main’ IP address (1.1.1.14 instead of 2.2.2.21) as a the connecting user.
Basically, every reference to 1.1.1.* is incorrect on this package.

Note: 2.2.2.21 and 1.1.1.14 are the PBX IP address.

Retransmitting #4 (no NAT) to 2.2.2.1:5060:
INVITE sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 1.1.1.14:5060;branch=z9hG4bK4747f56e
Max-Forwards: 70
From: "USERNAME" <sip:[email protected]>;tag=as02e3c75e
To: <sip:[email protected]>
Contact: <sip:[email protected]:5060>
Call-ID: [email protected]:5060
CSeq: 102 INVITE
User-Agent: FPBX-2.11.0(11.25.0)
Date: Tue, 21 Aug 2018 16:15:25 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces
Content-Type: application/sdp
Content-Length: 227

v=0
o=root 1940137437 1940137437 IN IP4 1.1.1.14
s=Asterisk PBX 11.25.0
c=IN IP4 1.1.1.14
t=0 0
m=audio 17782 RTP/AVP 0 18
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=ptime:20
a=sendrecv
---

Any ideas?

You probably need to define static routes at the OS network level. That is, if you haven’t done so already.

I was lost when adding additional gateways and only be able to use one gateway at a time.
Designated primary gateway, was always grabbing all the traffic.
I fix my issue with just three settings:
On your favorite sysctl script add the following: (I use /usr/lib/sysctl.d/99-multihome on Centos/Sangoma)

# add forwarding
net.ipv4.ip_forward = 1
# Accept source routing
net.ipv4.conf.default.accept_source_route = 1
net.ipv4.conf.all.accept_source_route = 1

Note, may sure the firewall is up to it’s job whan dealing with this change.