Hi,
I would like to set up a system like below:
(172.36.100.11) (172.36.100.12)
enp1s0 ----------------------------------- enp1s0
PC 1 ------ |
|------------ PC 2
enp2s0 ----------------------------------- enp2s0
(172.36.101.11) (172.36.101.12)
I can make a call from PC1 to PC2 via enp2s0 interface (172.36.101.11), but
all the RTP packets are always going through enp1s0 (172.36.100.11) not
enp2s0 (172.36.101.11).
How can I make those RTP packets go through the enp2s0 interface?
I follow this site to config two default gateway:
https://www.thomas-krenn.com/en/wiki/Two_Default_Gateways_on_One_System
On PC1:
route -n
Destination Gateway Genmask Flags Metric Ref
Use Iface
0.0.0.0 172.36.100.1 0.0.0.0 UG 0 0
0 enp1s0
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0
0 enp1s0
172.36.100.0 0.0.0.0 255.255.255.0 U 0 0
0 enp1s0
172.36.101.0 0.0.0.0 255.255.255.0 U 0 0
0 enp2s0
ip route list table rt2
default via 172.36.101.1 dev enp2s0
172.36.101.0/24 dev enp2s0 scope link src 172.36.101.12
ip rule show
0: from all lookup local
32764: from all to 172.36.101.12/24 lookup rt2
32765: from 172.36.101.12/24 lookup rt2
32766: from all lookup main
32767: from all lookup default
When I make a call from PC1 to PC2 via enp2s0, this is the INVITE message:
Internet Protocol Version 4, Src: 172.36.101.11, Dst: 172.36.101.12
User Datagram Protocol, Src Port: 4321, Dst Port: 1234
Session Initiation Protocol (INVITE)
Request-Line: INVITE sip:172.36.101.12:1234 SIP/2.0
Message Header
Via: SIP/2.0/UDP 172.36.100.11:4321
;rport;branch=z9hG4bKPjXPf3YS3e4e6gZ0m4z.oDyeO0KNHwknAE
Max-Forwards: 70
From: sip:172.36.100.11;tag=Fd18S4-WSwPB3bxA7.QstNy.GomS4lSO
To: sip:172.36.101.246
Contact: sip:172.36.101.11:4321;ob
Call-ID: MTqhGS7DmAfQxEvZSlH9gpf3be.UycnQ
[Generated Call-ID: MTqhGS7DmAfQxEvZSlH9gpf3be.UycnQ]
CSeq: 16789 INVITE
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE,
NOTIFY, REFER, MESSAGE, OPTIONS
Supported: replaces, 100rel, timer, norefersub
Session-Expires: 1800
Min-SE: 90
Content-Type: application/sdp
Content-Length: 476
Message Body
As you can observe, my enp1s0 address (172.36.100.11) is in the Via and
From headers.
I can force those headers to use enp2s0 address (172.36.101.11) by adding
this line at the end of pj_gethostip() function:
PJ_DEF(pj_status_t) pj_gethostip(int af, pj_sockaddr *addr)
{
....
....
pj_sockaddr_copy_addr(addr, &cand_addr[selected_cand]);
TRACE_((THIS_FILE, "Candidate %s selected",
pj_sockaddr_print(addr, strip, sizeof(strip), 0)));
}
addr->ipv4.sin_addr.s_addr = inet_addr("172.36.101.11");
return PJ_SUCCESS;
}
But even after that, all the RTP packets still going through enp1s0.
Any advice would be most welcome!
Best Regards,
---==============================
Quy Bui Danh (Mr.)
Hi,
you have to bind the specific IP address to the specific interface:
Best regards
Franz
Von: pjsip pjsip-bounces@lists.pjsip.org im Auftrag von Bui Quy quybd@dicom.com.vn
Gesendet: Freitag, 21. Februar 2020 11:13
An: pjsip@lists.pjsip.org
Betreff: [pjsip] PJSUA with two NICs
Hi,
I would like to set up a system like below:
(172.36.100.11) (172.36.100.12)
enp1s0 ----------------------------------- enp1s0
PC 1 ------ | |------------ PC 2
enp2s0 ----------------------------------- enp2s0
(172.36.101.11) (172.36.101.12)
I can make a call from PC1 to PC2 via enp2s0 interface (172.36.101.11), but all the RTP packets are always going through enp1s0 (172.36.100.11) not enp2s0 (172.36.101.11).
How can I make those RTP packets go through the enp2s0 interface?
I follow this site to config two default gateway:
https://www.thomas-krenn.com/en/wiki/Two_Default_Gateways_on_One_System
On PC1:
route -n
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 172.36.100.1 0.0.0.0 UG 0 0 0 enp1s0
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 enp1s0
172.36.100.0 0.0.0.0 255.255.255.0 U 0 0 0 enp1s0
172.36.101.0 0.0.0.0 255.255.255.0 U 0 0 0 enp2s0
ip route list table rt2
default via 172.36.101.1 dev enp2s0
172.36.101.0/24http://172.36.101.0/24 dev enp2s0 scope link src 172.36.101.12
ip rule show
0: from all lookup local
32764: from all to 172.36.101.12/24http://172.36.101.12/24 lookup rt2
32765: from 172.36.101.12/24http://172.36.101.12/24 lookup rt2
32766: from all lookup main
32767: from all lookup default
When I make a call from PC1 to PC2 via enp2s0, this is the INVITE message:
Internet Protocol Version 4, Src: 172.36.101.11, Dst: 172.36.101.12
User Datagram Protocol, Src Port: 4321, Dst Port: 1234
Session Initiation Protocol (INVITE)
Request-Line: INVITE sip:172.36.101.12:1234http://172.36.101.12:1234 SIP/2.0
Message Header
Via: SIP/2.0/UDP 172.36.100.11:4321;rport;branch=z9hG4bKPjXPf3YS3e4e6gZ0m4z.oDyeO0KNHwknAE
Max-Forwards: 70
From: sip:172.36.100.11;tag=Fd18S4-WSwPB3bxA7.QstNy.GomS4lSO
To: sip:172.36.101.246
Contact: sip:172.36.101.11:4321;ob
Call-ID: MTqhGS7DmAfQxEvZSlH9gpf3be.UycnQ
[Generated Call-ID: MTqhGS7DmAfQxEvZSlH9gpf3be.UycnQ]
CSeq: 16789 INVITE
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Supported: replaces, 100rel, timer, norefersub
Session-Expires: 1800
Min-SE: 90
Content-Type: application/sdp
Content-Length: 476
Message Body
As you can observe, my enp1s0 address (172.36.100.11) is in the Via and From headers.
I can force those headers to use enp2s0 address (172.36.101.11) by adding this line at the end of pj_gethostip() function:
PJ_DEF(pj_status_t) pj_gethostip(int af, pj_sockaddr *addr)
{
....
....
pj_sockaddr_copy_addr(addr, &cand_addr[selected_cand]);
TRACE_((THIS_FILE, "Candidate %s selected",
pj_sockaddr_print(addr, strip, sizeof(strip), 0)));
}
addr->ipv4.sin_addr.s_addr = inet_addr("172.36.101.11");
return PJ_SUCCESS;
}
But even after that, all the RTP packets still going through enp1s0.
Any advice would be most welcome!
Best Regards,
---==============================
Quy Bui Danh (Mr.)
Hi Franz,
Thank you for your reply.
Currently, I face the problem like below:
PC1 and PC2 have two different NICS are enp1s0 and enp2s0.
PC1 call to PC2.
In the PC2, I can bound the local account (pjsua_acc_id) to enp1s0 or
enp2s0, then the PC2 will respond with the corresponding interface:
pjsua_transport_config udp_cfg;
pjsua_transport_config_default(&udp_cfg);
udp_cfg.port = port;
pjsua_transport_id transport_id;
pjsua_transport_create(PJSIP_TRANSPORT_UDP, &udp_cfg, &transport_id);
pjsua_acc_add_local(transport_id, PJ_TRUE, &acc);
pjsua_acc_config acc_cfg;
pjsua_acc_config_default(&acc_cfg);
pjsua_acc_get_config(acc, pool, &acc_cfg);
acc_cfg.rtp_cfg.public_addr = pj_str(my_ip);
acc_cfg.rtp_cfg.bound_addr = pj_str(my_ip);
pjsua_acc_modify(acc, &acc_cfg);
But after added the 1st account, if I add the 2nd local account into the PC
B, with different udp_cfg.port, the PC2 always responds with the interface
which was bounded by the 2nd account, even if the 2nd account listens on a
different port.
pjsua_transport_config udp_cfg_2;
pjsua_transport_config_default(&udp_cfg_2);
udp_cfg.port = port_2;
pjsua_transport_id transport_id_2;
pjsua_transport_create(PJSIP_TRANSPORT_UDP, &udp_cfg_2,
&transport_id_2);
pjsua_acc_add_local(transport_id_2, PJ_TRUE, &acc_2);
pjsua_acc_config acc_cfg_2;
pjsua_acc_config_default(&acc_cfg_2);
pjsua_acc_get_config(acc_2, pool, &acc_cfg_2);
acc_cfg.rtp_cfg.public_addr = pj_str(my_ip_2);
acc_cfg.rtp_cfg.bound_addr = pj_str(my_ip_2);
pjsua_acc_modify(acc_2, &acc_cfg_2);
My goal is to make PC1 able to call to PC2 with two separate calls on the
different interfaces.
Best Regards,
---==============================
Quy Bui Danh (Mr.)
Vào Th 6, 21 thg 2, 2020 vào lúc 17:32 Skale Franz <
franz.skale@citycom-austria.com> đã viết:
Hi,
you have to bind the specific IP address to the specific interface:
Best regards
Von: pjsip pjsip-bounces@lists.pjsip.org im Auftrag von Bui Quy <
quybd@dicom.com.vn>
Gesendet: Freitag, 21. Februar 2020 11:13
An: pjsip@lists.pjsip.org
Betreff: [pjsip] PJSUA with two NICs
Hi,
I would like to set up a system like below:
(172.36.100.11) (172.36.100.12)
enp1s0 ----------------------------------- enp1s0
PC 1 ------ |
|------------ PC 2
enp2s0 ----------------------------------- enp2s0
(172.36.101.11) (172.36.101.12)
I can make a call from PC1 to PC2 via enp2s0 interface (172.36.101.11),
but all the RTP packets are always going through enp1s0 (172.36.100.11) not
enp2s0 (172.36.101.11).
How can I make those RTP packets go through the enp2s0 interface?
I follow this site to config two default gateway:
https://www.thomas-krenn.com/en/wiki/Two_Default_Gateways_on_One_System
On PC1:
route -n
Destination Gateway Genmask Flags Metric Ref
Use Iface
0.0.0.0 172.36.100.1 0.0.0.0 UG 0
0 0 enp1s0
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0
0 enp1s0
172.36.100.0 0.0.0.0 255.255.255.0 U 0 0
0 enp1s0
172.36.101.0 0.0.0.0 255.255.255.0 U 0 0
0 enp2s0
ip route list table rt2
default via 172.36.101.1 dev enp2s0
172.36.101.0/24 dev enp2s0 scope link src 172.36.101.12
ip rule show
0: from all lookup local
32764: from all to 172.36.101.12/24 lookup rt2
32765: from 172.36.101.12/24 lookup rt2
32766: from all lookup main
32767: from all lookup default
When I make a call from PC1 to PC2 via enp2s0, this is the INVITE message:
Internet Protocol Version 4, Src: 172.36.101.11, Dst: 172.36.101.12
User Datagram Protocol, Src Port: 4321, Dst Port: 1234
Session Initiation Protocol (INVITE)
Request-Line: INVITE sip:172.36.101.12:1234 SIP/2.0
Message Header
Via: SIP/2.0/UDP 172.36.100.11:4321
;rport;branch=z9hG4bKPjXPf3YS3e4e6gZ0m4z.oDyeO0KNHwknAE
Max-Forwards: 70
From: sip:172.36.100.11;tag=Fd18S4-WSwPB3bxA7.QstNy.GomS4lSO
To: sip:172.36.101.246
Contact: sip:172.36.101.11:4321;ob
Call-ID: MTqhGS7DmAfQxEvZSlH9gpf3be.UycnQ
[Generated Call-ID: MTqhGS7DmAfQxEvZSlH9gpf3be.UycnQ]
CSeq: 16789 INVITE
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE,
NOTIFY, REFER, MESSAGE, OPTIONS
Supported: replaces, 100rel, timer, norefersub
Session-Expires: 1800
Min-SE: 90
Content-Type: application/sdp
Content-Length: 476
Message Body
As you can observe, my enp1s0 address (172.36.100.11) is in the Via and
From headers.
I can force those headers to use enp2s0 address (172.36.101.11) by adding
this line at the end of pj_gethostip() function:
PJ_DEF(pj_status_t) pj_gethostip(int af, pj_sockaddr *addr)
{
....
....
pj_sockaddr_copy_addr(addr, &cand_addr[selected_cand]);
TRACE_((THIS_FILE, "Candidate %s selected",
pj_sockaddr_print(addr, strip, sizeof(strip), 0)));
}
addr->ipv4.sin_addr.s_addr = inet_addr("172.36.101.11");
return PJ_SUCCESS;
}
But even after that, all the RTP packets still going through enp1s0.
Any advice would be most welcome!
Best Regards,
---==============================
Quy Bui Danh (Mr.)
Visit our blog: http://blog.pjsip.org
pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
Again,
when reading the docs carefully, you have to configure the pjsua_transport_config structure accordingly:
Reference:
https://www.pjsip.org/pjsip/docs/html/structpjsua__transport__config.htm#a76cdb153b60fbbdbfd36ced9494bea0a
Check the docs section for bound_addr and public_addr.
Best regards
Franz
Von: pjsip pjsip-bounces@lists.pjsip.org im Auftrag von Bui Quy quybd@dicom.com.vn
Gesendet: Montag, 24. Februar 2020 12:07
An: pjsip list
Betreff: Re: [pjsip] PJSUA with two NICs
Hi Franz,
Thank you for your reply.
Currently, I face the problem like below:
PC1 and PC2 have two different NICS are enp1s0 and enp2s0.
PC1 call to PC2.
In the PC2, I can bound the local account (pjsua_acc_id) to enp1s0 or enp2s0, then the PC2 will respond with the corresponding interface:
pjsua_transport_config udp_cfg;
pjsua_transport_config_default(&udp_cfg);
udp_cfg.port = port;
pjsua_transport_id transport_id;
pjsua_transport_create(PJSIP_TRANSPORT_UDP, &udp_cfg, &transport_id);
pjsua_acc_add_local(transport_id, PJ_TRUE, &acc);
pjsua_acc_config acc_cfg;
pjsua_acc_config_default(&acc_cfg);
pjsua_acc_get_config(acc, pool, &acc_cfg);
acc_cfg.rtp_cfg.public_addr = pj_str(my_ip);
acc_cfg.rtp_cfg.bound_addr = pj_str(my_ip);
pjsua_acc_modify(acc, &acc_cfg);
But after added the 1st account, if I add the 2nd local account into the PC B, with different udp_cfg.port, the PC2 always responds with the interface which was bounded by the 2nd account, even if the 2nd account listens on a different port.
pjsua_transport_config udp_cfg_2;
pjsua_transport_config_default(&udp_cfg_2);
udp_cfg.port = port_2;
pjsua_transport_id transport_id_2;
pjsua_transport_create(PJSIP_TRANSPORT_UDP, &udp_cfg_2, &transport_id_2);
pjsua_acc_add_local(transport_id_2, PJ_TRUE, &acc_2);
pjsua_acc_config acc_cfg_2;
pjsua_acc_config_default(&acc_cfg_2);
pjsua_acc_get_config(acc_2, pool, &acc_cfg_2);
acc_cfg.rtp_cfg.public_addr = pj_str(my_ip_2);
acc_cfg.rtp_cfg.bound_addr = pj_str(my_ip_2);
pjsua_acc_modify(acc_2, &acc_cfg_2);
My goal is to make PC1 able to call to PC2 with two separate calls on the different interfaces.
Best Regards,
---==============================
Quy Bui Danh (Mr.)
Vào Th 6, 21 thg 2, 2020 vào lúc 17:32 Skale Franz franz.skale@citycom-austria.com đã viết:
Hi,
you have to bind the specific IP address to the specific interface:
https://www.pjsip.org/pjsip/docs/html/structpjsua__transport__config.htm#a672e097722cbc1d4308d1bcd7bb4d911
Best regards
Franz
Von: pjsip pjsip-bounces@lists.pjsip.org im Auftrag von Bui Quy quybd@dicom.com.vn
Gesendet: Freitag, 21. Februar 2020 11:13
An: pjsip@lists.pjsip.org
Betreff: [pjsip] PJSUA with two NICs
Hi,
I would like to set up a system like below:
(172.36.100.11) (172.36.100.12)
enp1s0 ----------------------------------- enp1s0
PC 1 ------ | |------------ PC 2
enp2s0 ----------------------------------- enp2s0
(172.36.101.11) (172.36.101.12)
I can make a call from PC1 to PC2 via enp2s0 interface (172.36.101.11), but all the RTP packets are always going through enp1s0 (172.36.100.11) not enp2s0 (172.36.101.11).
How can I make those RTP packets go through the enp2s0 interface?
I follow this site to config two default gateway:
https://www.thomas-krenn.com/en/wiki/Two_Default_Gateways_on_One_System
On PC1:
route -n
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 172.36.100.1 0.0.0.0 UG 0 0 0 enp1s0
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 enp1s0
172.36.100.0 0.0.0.0 255.255.255.0 U 0 0 0 enp1s0
172.36.101.0 0.0.0.0 255.255.255.0 U 0 0 0 enp2s0
ip route list table rt2
default via 172.36.101.1 dev enp2s0
172.36.101.0/24 dev enp2s0 scope link src 172.36.101.12
ip rule show
0: from all lookup local
32764: from all to 172.36.101.12/24 lookup rt2
32765: from 172.36.101.12/24 lookup rt2
32766: from all lookup main
32767: from all lookup default
When I make a call from PC1 to PC2 via enp2s0, this is the INVITE message:
Internet Protocol Version 4, Src: 172.36.101.11, Dst: 172.36.101.12
User Datagram Protocol, Src Port: 4321, Dst Port: 1234
Session Initiation Protocol (INVITE)
Request-Line: INVITE sip:172.36.101.12:1234 SIP/2.0
Message Header
Via: SIP/2.0/UDP 172.36.100.11:4321;rport;branch=z9hG4bKPjXPf3YS3e4e6gZ0m4z.oDyeO0KNHwknAE
Max-Forwards: 70
From: sip:172.36.100.11;tag=Fd18S4-WSwPB3bxA7.QstNy.GomS4lSO
To: sip:172.36.101.246
Contact: sip:172.36.101.11:4321;ob
Call-ID: MTqhGS7DmAfQxEvZSlH9gpf3be.UycnQ
[Generated Call-ID: MTqhGS7DmAfQxEvZSlH9gpf3be.UycnQ]
CSeq: 16789 INVITE
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Supported: replaces, 100rel, timer, norefersub
Session-Expires: 1800
Min-SE: 90
Content-Type: application/sdp
Content-Length: 476
Message Body
As you can observe, my enp1s0 address (172.36.100.11) is in the Via and From headers.
I can force those headers to use enp2s0 address (172.36.101.11) by adding this line at the end of pj_gethostip() function:
PJ_DEF(pj_status_t) pj_gethostip(int af, pj_sockaddr *addr)
{
....
....
pj_sockaddr_copy_addr(addr, &cand_addr[selected_cand]);
TRACE_((THIS_FILE, "Candidate %s selected",
pj_sockaddr_print(addr, strip, sizeof(strip), 0)));
}
addr->ipv4.sin_addr.s_addr = inet_addr("172.36.101.11");
return PJ_SUCCESS;
}
But even after that, all the RTP packets still going through enp1s0.
Any advice would be most welcome!
Best Regards,
---==============================
Quy Bui Danh (Mr.)
_______________________________________________
Visit our blog: http://blog.pjsip.org
pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
Hi Franz,
I have read this doc but still cannot figure the problem out.
My code sample, log and packet capture are attached.
This sample can make the call and bind the socket to the particular
interface (enp1s0 or enp2s0) but only if I use one account.
When I add the 2nd account, the caller sends the INVITE message but the
called receives nothing.
Can you please point to me which part I'm wrong?
Best Regards,
---==============================
Quy Bui Danh (Mr.)
Vào Th 2, 24 thg 2, 2020 vào lúc 19:35 Skale Franz <
franz.skale@citycom-austria.com> đã viết:
Again,
when reading the docs carefully, you have to configure the
pjsua_transport_config structure accordingly:
Reference:
Check the docs section for bound_addr and public_addr.
Best regards
Franz
Von: pjsip pjsip-bounces@lists.pjsip.org im Auftrag von Bui Quy <
quybd@dicom.com.vn>
Gesendet: Montag, 24. Februar 2020 12:07
An: pjsip list
Betreff: Re: [pjsip] PJSUA with two NICs
Hi Franz,
Thank you for your reply.
Currently, I face the problem like below:
PC1 and PC2 have two different NICS are enp1s0 and enp2s0.
PC1 call to PC2.
In the PC2, I can bound the local account (pjsua_acc_id) to enp1s0 or
enp2s0, then the PC2 will respond with the corresponding interface:
pjsua_transport_config udp_cfg;
pjsua_transport_config_default(&udp_cfg);
udp_cfg.port = port;
pjsua_transport_id transport_id;
pjsua_transport_create(PJSIP_TRANSPORT_UDP, &udp_cfg, &transport_id);
pjsua_acc_add_local(transport_id, PJ_TRUE, &acc);
pjsua_acc_config acc_cfg;
pjsua_acc_config_default(&acc_cfg);
pjsua_acc_get_config(acc, pool, &acc_cfg);
acc_cfg.rtp_cfg.public_addr = pj_str(my_ip);
acc_cfg.rtp_cfg.bound_addr = pj_str(my_ip);
pjsua_acc_modify(acc, &acc_cfg);
But after added the 1st account, if I add the 2nd local account into the
PC B, with different udp_cfg.port, the PC2 always responds with the
interface which was bounded by the 2nd account, even if the 2nd account
listens on a different port.
pjsua_transport_config udp_cfg_2;
pjsua_transport_config_default(&udp_cfg_2);
udp_cfg.port = port_2;
pjsua_transport_id transport_id_2;
pjsua_transport_create(PJSIP_TRANSPORT_UDP, &udp_cfg_2,
&transport_id_2);
pjsua_acc_add_local(transport_id_2, PJ_TRUE, &acc_2);
pjsua_acc_config acc_cfg_2;
pjsua_acc_config_default(&acc_cfg_2);
pjsua_acc_get_config(acc_2, pool, &acc_cfg_2);
acc_cfg.rtp_cfg.public_addr = pj_str(my_ip_2);
acc_cfg.rtp_cfg.bound_addr = pj_str(my_ip_2);
pjsua_acc_modify(acc_2, &acc_cfg_2);
My goal is to make PC1 able to call to PC2 with two separate calls on the
different interfaces.
Best Regards,
---==============================
Quy Bui Danh (Mr.)
Vào Th 6, 21 thg 2, 2020 vào lúc 17:32 Skale Franz <
franz.skale@citycom-austria.com> đã viết:
Hi,
you have to bind the specific IP address to the specific interface:
Best regards
Franz
Von: pjsip pjsip-bounces@lists.pjsip.org im Auftrag von Bui Quy <
quybd@dicom.com.vn>
Gesendet: Freitag, 21. Februar 2020 11:13
An: pjsip@lists.pjsip.org
Betreff: [pjsip] PJSUA with two NICs
Hi,
I would like to set up a system like below:
(172.36.100.11) (172.36.100.12)
enp1s0 ----------------------------------- enp1s0
PC 1 ------ |
|------------ PC 2
enp2s0 ----------------------------------- enp2s0
(172.36.101.11) (172.36.101.12)
I can make a call from PC1 to PC2 via enp2s0 interface (172.36.101.11),
but all the RTP packets are always going through enp1s0 (172.36.100.11) not
enp2s0 (172.36.101.11).
How can I make those RTP packets go through the enp2s0 interface?
I follow this site to config two default gateway:
https://www.thomas-krenn.com/en/wiki/Two_Default_Gateways_on_One_System
On PC1:
route -n
Destination Gateway Genmask Flags Metric Ref
Use Iface
0.0.0.0 172.36.100.1 0.0.0.0 UG 0
0 0 enp1s0
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0
0 enp1s0
172.36.100.0 0.0.0.0 255.255.255.0 U 0 0
0 enp1s0
172.36.101.0 0.0.0.0 255.255.255.0 U 0 0
0 enp2s0
ip route list table rt2
default via 172.36.101.1 dev enp2s0
172.36.101.0/24 dev enp2s0 scope link src 172.36.101.12
ip rule show
0: from all lookup local
32764: from all to 172.36.101.12/24 lookup rt2
32765: from 172.36.101.12/24 lookup rt2
32766: from all lookup main
32767: from all lookup default
When I make a call from PC1 to PC2 via enp2s0, this is the INVITE message:
Internet Protocol Version 4, Src: 172.36.101.11, Dst: 172.36.101.12
User Datagram Protocol, Src Port: 4321, Dst Port: 1234
Session Initiation Protocol (INVITE)
Request-Line: INVITE sip:172.36.101.12:1234 SIP/2.0
Message Header
Via: SIP/2.0/UDP 172.36.100.11:4321
;rport;branch=z9hG4bKPjXPf3YS3e4e6gZ0m4z.oDyeO0KNHwknAE
Max-Forwards: 70
From: sip:172.36.100.11;tag=Fd18S4-WSwPB3bxA7.QstNy.GomS4lSO
To: sip:172.36.101.246
Contact: sip:172.36.101.11:4321;ob
Call-ID: MTqhGS7DmAfQxEvZSlH9gpf3be.UycnQ
[Generated Call-ID: MTqhGS7DmAfQxEvZSlH9gpf3be.UycnQ]
CSeq: 16789 INVITE
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE,
NOTIFY, REFER, MESSAGE, OPTIONS
Supported: replaces, 100rel, timer, norefersub
Session-Expires: 1800
Min-SE: 90
Content-Type: application/sdp
Content-Length: 476
Message Body
As you can observe, my enp1s0 address (172.36.100.11) is in the Via and
From headers.
I can force those headers to use enp2s0 address (172.36.101.11) by adding
this line at the end of pj_gethostip() function:
PJ_DEF(pj_status_t) pj_gethostip(int af, pj_sockaddr *addr)
{
....
....
pj_sockaddr_copy_addr(addr, &cand_addr[selected_cand]);
TRACE_((THIS_FILE, "Candidate %s selected",
pj_sockaddr_print(addr, strip, sizeof(strip), 0)));
}
addr->ipv4.sin_addr.s_addr = inet_addr("172.36.101.11");
return PJ_SUCCESS;
}
But even after that, all the RTP packets still going through enp1s0.
Any advice would be most welcome!
Best Regards,
---==============================
Quy Bui Danh (Mr.)
Visit our blog: http://blog.pjsip.org
pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
Visit our blog: http://blog.pjsip.org
pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org