[asterisk-commits] branch 1.2 - r7738
/branches/1.2/channels/chan_sip.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Tue Jan 3 11:00:01 CST 2006
Author: kpfleming
Date: Tue Jan 3 11:00:01 2006
New Revision: 7738
URL: http://svn.digium.com/view/asterisk?rev=7738&view=rev
Log:
backport rport scanning fix from trunk (bug #6071)
Modified:
branches/1.2/channels/chan_sip.c
Modified: branches/1.2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/chan_sip.c?rev=7738&r1=7737&r2=7738&view=diff
==============================================================================
--- branches/1.2/channels/chan_sip.c (original)
+++ branches/1.2/channels/chan_sip.c Tue Jan 3 11:00:01 2006
@@ -6796,7 +6796,7 @@
return -1;
}
-/*! \brief check_via: check Via: headers ---*/
+/*! \brief check Via: header for hostname, port and rport request/answer */
static int check_via(struct sip_pvt *p, struct sip_request *req)
{
char via[256];
@@ -6806,9 +6806,16 @@
struct ast_hostent ahp;
ast_copy_string(via, get_header(req, "Via"), sizeof(via));
+
+ /* Check for rport */
+ c = strstr(via, ";rport");
+ if (c && (c[6] != '=')) /* rport query, not answer */
+ ast_set_flag(p, SIP_NAT_ROUTE);
+
c = strchr(via, ';');
if (c)
*c = '\0';
+
c = strchr(via, ' ');
if (c) {
*c = '\0';
@@ -6829,9 +6836,7 @@
p->sa.sin_family = AF_INET;
memcpy(&p->sa.sin_addr, hp->h_addr, sizeof(p->sa.sin_addr));
p->sa.sin_port = htons(pt ? atoi(pt) : DEFAULT_SIP_PORT);
- c = strstr(via, ";rport");
- if (c && (c[6] != '=')) /* rport query, not answer */
- ast_set_flag(p, SIP_NAT_ROUTE);
+
if (sip_debug_test_pvt(p)) {
c = (ast_test_flag(p, SIP_NAT) & SIP_NAT_ROUTE) ? "NAT" : "non-NAT";
ast_verbose("Sending to %s : %d (%s)\n", ast_inet_ntoa(iabuf, sizeof(iabuf), p->sa.sin_addr), ntohs(p->sa.sin_port), c);
More information about the asterisk-commits
mailing list