asterisk: 15.2.0 w/ pjsip bundled
OS: ubuntu 16.04
phone: soft-phone or a D80, doesn’t matter
I’m experiencing a problem with Asterisk running on a node with two network interfaces.
In the first set-up only one interface is used, i.e. the router (behind which the ITSP is located, NAT in use) and the phones are found on the same network.
ITSP <–internet–> router/NAT <–net_a–> asterisk, phone
Both incoming and outgoing calls do work in this set-up.
Now, the node’s interfaces should instead be used the following way:
ITSP <–internet–> router/NAT <–net_a–> asterisk <–net_b–> phone
The 1st interface is wired to the router within network A.
Asterisk registers with the ITSP going through this interface and the router’s NAT into the internet; this still seems to work fine.
The 2nd interface has an IP within network B, where also the phone is located.
The phone is registered with asterisk; this is still working fine.
When a call comes in using the two interface set-up, everything still works.
However, outgoing calls are not established.
The reason AFAIS is that the OK send from Asterisk / PJSIP shows a contact URL with an IP of network A (see screenshot with wireshark’s protocol).
The phone then sends its ACK accordingly to the IP of the 1st interface which, of course, cannot be reached because it belongs to the wrong network (see second screenshot w/ OK packet details).
There’re 2 transports, of course:
Don’t know whether the Contact header actually cause the problem. However, IMHO Asterisk / PJSIP has to send the IP of the 2nd interface within network B anyway. It has to respect the interface through which packets to the phone are routed, because the response packets will presumably arrive on that interface, too.
Perhaps I just have missed a configuration thing. On the other hand, Asterisk/PJSIP is already in a dialog with the phone, so they should know each other …
Thanks for help.
(Wording is edited due to the comments of david551 below.)