[asterisk-commits] oej: branch group/pine-multiple-externip-1.4 r334681 - /team/group/pine-multi...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Sep 7 08:07:07 CDT 2011


Author: oej
Date: Wed Sep  7 08:07:02 2011
New Revision: 334681

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=334681
Log:
Add the missing user part

Modified:
    team/group/pine-multiple-externip-1.4/channels/chan_sip.c

Modified: team/group/pine-multiple-externip-1.4/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pine-multiple-externip-1.4/channels/chan_sip.c?view=diff&rev=334681&r1=334680&r2=334681
==============================================================================
--- team/group/pine-multiple-externip-1.4/channels/chan_sip.c (original)
+++ team/group/pine-multiple-externip-1.4/channels/chan_sip.c Wed Sep  7 08:07:02 2011
@@ -11011,6 +11011,22 @@
 				if (global_shrinkcallerid && ast_is_shrinkable_phonenumber(tmp))
 					ast_shrink_phone_number(tmp);
 				ast_string_field_set(p, cid_num, tmp);
+			}
+			/* Set extern IP properly for the contact and via headers */
+			if (user->externip.sin_addr.s_addr) {
+				memcpy(&p->externip.sin_addr, &user->externip.sin_addr, sizeof(p->sa.sin_addr));
+				/* If the user had an externip setting, recalculate our side, and recalculate Call ID */
+				if (ast_sip_ouraddrfor(p, &p->sa.sin_addr, &p->ourip)) {
+					p->ourip = __ourip;
+				}
+				if (option_debug > 2) {
+					ast_log(LOG_DEBUG, "user %s has externip defined. Recalulating our IP. Now %s \n", user->name, ast_inet_ntoa(p->ourip));
+				}
+			} else {
+				memcpy(&p->externip.sin_addr, &externip.sin_addr, sizeof(p->sa.sin_addr));
+				if (option_debug > 2) {
+					ast_log(LOG_DEBUG, "user %s has no externip defined\n", user->name);
+				}
 			}
 			/* Set extern IP properly for the contact and via headers */
 			if (user->externip.sin_addr.s_addr) {




More information about the asterisk-commits mailing list