From 8a6da320650009b8b42e3303eccecb3ff6497dbb Mon Sep 17 00:00:00 2001 From: Thomas Ries Date: Tue, 15 Dec 2009 21:11:33 +0000 Subject: [PATCH] 15-Dec-2009: - Better handling for SIP redirecting with newer kernels --- ChangeLog | 3 ++- src/sip_utils.c | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index fb62d44..0c55ab1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,7 +2,8 @@ ===== 28-Oct-2009: - Make local UA to local UA calls work better with UAs that blindly practice symmetric RTP and ignore the SDP media - description completely (did anyone shout X-Lite?) + description completely. + 15-Dec-2009: - Better handling for SIP redirecting with newer kernels 0.7.2 ===== diff --git a/src/sip_utils.c b/src/sip_utils.c index 97ec5b3..1fd7c5e 100644 --- a/src/sip_utils.c +++ b/src/sip_utils.c @@ -970,7 +970,7 @@ int sip_find_direction(sip_ticket_t *ticket, int *urlidx) { struct sockaddr_in *from; osip_message_t *request; osip_message_t *response; - struct in_addr tmp_addr; + struct in_addr tmp_addr, tmp_addr2; from=&ticket->from; request=ticket->sipmsg; @@ -1113,14 +1113,17 @@ int sip_find_direction(sip_ticket_t *ticket, int *urlidx) { * if the telegram is received from 127.0.0.1 use my inbound IP as sender, * this likely is a locally REDIRECTED/DNATed (by iptables) packet. * So it is a local UA. + * Also, my own outbound address is considered to be redirected traffic * Example Scenario: * Softphone(or PBX) running on the same host as siproxd is running. * Using iptables, you do a REDIRECT of outgoping SIP traffix of the * PBX to be passed to siproxd. */ sts=get_interface_ip(IF_INBOUND, &tmp_addr); + sts=get_interface_ip(IF_OUTBOUND, &tmp_addr2); if ((htonl(from->sin_addr.s_addr) == INADDR_LOOPBACK) || - (from->sin_addr.s_addr == tmp_addr.s_addr)) { + (from->sin_addr.s_addr == tmp_addr.s_addr) || + (from->sin_addr.s_addr == tmp_addr2.s_addr)) { if (MSG_IS_REQUEST(ticket->sipmsg)) { type=REQTYP_OUTGOING; } else {