From 77cd778fdc0cb9d74b3c5b60a6710d4304ca6a59 Mon Sep 17 00:00:00 2001 From: mmichelson Date: Tue, 14 Oct 2008 23:10:26 +0000 Subject: Call register_peer_exten even in the case that the peer's IP/port does not change. (closes issue #13309) Reported by: dimas Patches: v2-13309.patch uploaded by dimas (license 88) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@149207 f38db490-d61c-443f-a65b-d21fe96a405b --- channels/chan_sip.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 30550dff3..31751540a 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -2470,11 +2470,14 @@ static void register_peer_exten(struct sip_peer *peer, int onoff) } else { context = global_regcontext; } - if (onoff) - ast_add_extension(context, 1, ext, 1, NULL, NULL, "Noop", - ast_strdup(peer->name), ast_free, "SIP"); - else + if (onoff) { + if (!ast_exists_extension(NULL, context, ext, 1, NULL)) { + ast_add_extension(context, 1, ext, 1, NULL, NULL, "Noop", + ast_strdup(peer->name), ast_free, "SIP"); + } + } else { ast_context_remove_extension(context, ext, 1, NULL); + } } } @@ -8348,12 +8351,11 @@ static enum parse_register_result parse_register_contact(struct sip_pvt *pvt, st manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "Peer: SIP/%s\r\nPeerStatus: Registered\r\n", peer->name); /* Is this a new IP address for us? */ - if (inaddrcmp(&peer->addr, &oldsin)) { - sip_poke_peer(peer); - if (option_verbose > 2) - ast_verbose(VERBOSE_PREFIX_3 "Registered SIP '%s' at %s port %d expires %d\n", peer->name, ast_inet_ntoa(peer->addr.sin_addr), ntohs(peer->addr.sin_port), expiry); - register_peer_exten(peer, 1); + if (option_verbose > 2 && inaddrcmp(&peer->addr, &oldsin)) { + ast_verbose(VERBOSE_PREFIX_3 "Registered SIP '%s' at %s port %d\n", peer->name, ast_inet_ntoa(peer->addr.sin_addr), ntohs(peer->addr.sin_port)); } + sip_poke_peer(peer); + register_peer_exten(peer, 1); /* Save User agent */ useragent = get_header(req, "User-Agent"); -- cgit v1.2.3