Merged revisions 149207 via svnmerge from
authorMark Michelson <mmichelson@digium.com>
Tue, 14 Oct 2008 23:15:04 +0000 (23:15 +0000)
committerMark Michelson <mmichelson@digium.com>
Tue, 14 Oct 2008 23:15:04 +0000 (23:15 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r149207 | mmichelson | 2008-10-14 18:10:26 -0500 (Tue, 14 Oct 2008) | 9 lines

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: https://origsvn.digium.com/svn/asterisk/trunk@149208 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 8573e63..a6bcd7a 100644 (file)
@@ -3798,8 +3798,10 @@ static void register_peer_exten(struct sip_peer *peer, int onoff)
                        context = global_regcontext;
                }
                if (onoff) {
-                       ast_add_extension(context, 1, ext, 1, NULL, NULL, "Noop",
-                                ast_strdup(peer->name), ast_free_ptr, "SIP");
+                       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 if (pbx_find_extension(NULL, NULL, &q, context, ext, 1, NULL, "", E_MATCH)) {
                        ast_context_remove_extension(context, ext, 1, NULL);
                }
@@ -10709,11 +10711,11 @@ static enum parse_register_result parse_register_contact(struct sip_pvt *pvt, st
        manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "ChannelType: SIP\r\nPeer: SIP/%s\r\nPeerStatus: Registered\r\nAddress: %s\r\nPort: %d\r\n", peer->name,  ast_inet_ntoa(peer->addr.sin_addr), ntohs(peer->addr.sin_port));
 
        /* Is this a new IP address for us? */
-       if (inaddrcmp(&peer->addr, &oldsin)) {
-               sip_poke_peer(peer, 0);
-               ast_verb(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), expire);
-               register_peer_exten(peer, TRUE);
+       if (VERBOSITY_ATLEAST(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, 0);
+       register_peer_exten(peer, 1);
        
        /* Save User agent */
        useragent = get_header(req, "User-Agent");