OS: debian 10 (virtual machine) Asterisk 16 (PJSIP channel driver) Asterisk was install from standard repositories ( apt install asterisk)
ast1*CLI> core show version Asterisk 16.2.1~dfsg-1+deb10u1 built by nobody @ buildd.debian.org on a unknown running Linux on 2019-08-20 20:31:36 UTC
Virtual machine has 3 virtual network card:
ens18 192.168.129.33/24 – internal network , connect 1 IP phone for test purposes, default route ens19 10.16.6.2/30 – connect to sip provider №1 , sip trunk by IP address ens20 10.26.2.2/30 – connect to sip provider №2 , sip trunk by IP address
root@ast1:~# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever 2: ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether c2:cc:da:c8:6a:24 brd ff:ff:ff:ff:ff:ff inet 192.168.129.33/24 brd 192.168.129.255 scope global ens18 valid_lft forever preferred_lft forever 3: ens19: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 3e:1f:7c:7e:a6:a2 brd ff:ff:ff:ff:ff:ff inet 10.16.6.2/30 brd 10.16.6.3 scope global ens19 valid_lft forever preferred_lft forever 4: ens20: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 7a:90:cd:94:28:fb brd ff:ff:ff:ff:ff:ff inet 10.26.2.2/30 brd 10.26.2.3 scope global ens20 valid_lft forever preferred_lft forever
root@ast1:~# ip route default via 192.168.129.1 dev ens18 onlink 10.16.6.0/30 dev ens19 proto kernel scope link src 10.16.6.2 10.26.2.0/30 dev ens20 proto kernel scope link src 10.26.2.2 172.27.240.192/30 via 10.16.6.1 dev ens19 192.168.129.0/24 dev ens18 proto kernel scope link src 192.168.129.33
I have 2 problems:
1 Problem . Asterisk was receive OPTIONS package from 10.26.2.1 to interface ens20 10.26.2.2 . Asterisk should respond with the same interface ens20 , but transmit package from another interface ens18 192.168.129.33 to 10.26.2.1 . This is not correct. Screenshots was attached.
Where the condition is configured that, for example, the OPTIONS request came from the address 10.26.2.1 to the address 10.26.2.2, so you need to respond 200 OK from the address 10.26.2.2 to the address 10.26.2.1, but not from the address 192.168.129.33 to the address 10.26.2.1 , through another network card?
- Problem. INVITE are not correct . When I try to make send call from 10.26.2.2 to 10.26.2.1 - call working (SIP & RTP) , but in INVITE pcap not all correct. IP addresses in fields FROM and TO is correct. But IP addresses in fields VIA and Contact are not correct , for some reason, IP addresses are not substituted from the transport interface , they are substituted from the another interface , from 1-st network card (default route). This is not correct. Also, when call was end , final packet 200 OK was transmit from wrong interface , from 1-st network card (default route).
Screenshots was attached.
I try to repeat instruction https://wiki.asterisk.org/wiki/display/AST/PJSIP+Transport+Selection (Section IPv4 Only (Multiple Interfaces)) . But it seems to me that either I configured something incorrectly, or it’s some kind of bug .
At the same time, the routes are configured correctly, the vast majority of packets go through the necessary interfaces.