[asterisk-commits] russell: branch 1.4 r61427 - in /branches/1.4: ./ channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Apr 11 08:09:39 MST 2007


Author: russell
Date: Wed Apr 11 10:09:39 2007
New Revision: 61427

URL: http://svn.digium.com/view/asterisk?view=rev&rev=61427
Log:
Merged revisions 61426 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r61426 | russell | 2007-04-11 10:05:36 -0500 (Wed, 11 Apr 2007) | 6 lines

Fix a bug with switching between host=dynamic and using specific hosts for
peers.  The code would only reset the peer's address when it is dynamic if
it was a new peer structure.  Now, it will also reset the address if it was
already in the peer list, but before the reload, it was not dynamic.
(issue #9515, reported by caio1982, fixed by me)

........

Modified:
    branches/1.4/   (props changed)
    branches/1.4/channels/chan_sip.c

Propchange: branches/1.4/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Modified: branches/1.4/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=61427&r1=61426&r2=61427
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Wed Apr 11 10:09:39 2007
@@ -15940,7 +15940,7 @@
 
 	if (peer) {
 		/* Already in the list, remove it and it will be added back (or FREE'd)  */
-		found++;
+		found = 1;
 		if (!(peer->objflags & ASTOBJ_FLAG_MARKED))
 			firstpass = 0;
  	} else {
@@ -16009,10 +16009,9 @@
 					ast_log(LOG_WARNING, "You can't have a dynamic outbound proxy, you big silly head at line %d.\n", v->lineno);
 				} else {
 					/* They'll register with us */
-					ast_set_flag(&peer->flags[1], SIP_PAGE2_DYNAMIC);
-					if (!found) {
-						/* Initialize stuff iff we're not found, otherwise
-						   we keep going with what we had */
+					if (!found || !ast_test_flag(&peer->flags[1], SIP_PAGE2_DYNAMIC)) {
+						/* Initialize stuff if this is a new peer, or if it used to be
+						 * non-dynamic before the reload. */
 						memset(&peer->addr.sin_addr, 0, 4);
 						if (peer->addr.sin_port) {
 							/* If we've already got a port, make it the default rather than absolute */
@@ -16020,6 +16019,7 @@
 							peer->addr.sin_port = 0;
 						}
 					}
+					ast_set_flag(&peer->flags[1], SIP_PAGE2_DYNAMIC);
 				}
 			} else {
 				/* Non-dynamic.  Make sure we become that way if we're not */



More information about the asterisk-commits mailing list