From 6b033eea0460d76f39f1838704a871b402d9898a Mon Sep 17 00:00:00 2001 From: Russell Bryant <russell@russellbryant.com> Date: Wed, 11 Apr 2007 15:13:12 +0000 Subject: [PATCH] Merged revisions 61427 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ................ r61427 | russell | 2007-04-11 10:09:39 -0500 (Wed, 11 Apr 2007) | 14 lines 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) ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@61428 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_sip.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 5e3898f014..ed5d994955 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -16727,10 +16727,9 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str } else if (!strcasecmp(v->name, "host")) { if (!strcasecmp(v->value, "dynamic")) { /* 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 + * not be 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 */ @@ -16738,6 +16737,7 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str 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 */ if (peer->expire > -1) -- GitLab