]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Don't try to unregister a peer using the sip unregister CLI command if they are not...
authorJoshua Colp <jcolp@digium.com>
Mon, 28 May 2007 23:28:52 +0000 (23:28 +0000)
committerJoshua Colp <jcolp@digium.com>
Mon, 28 May 2007 23:28:52 +0000 (23:28 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@66315 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 223e2276cbd4683d707fb477156fec588cd25c8a..fed98d48665823ef064d7b36cf97bc918b0afd97 100644 (file)
@@ -11121,8 +11121,12 @@ static int sip_unregister(int fd, int argc, char *argv[])
                return RESULT_SHOWUSAGE;
        
        if ((peer = find_peer(argv[2], NULL, load_realtime))) {
-               expire_register(peer);
-               ast_cli(fd, "Unregistered peer \'%s\'\n\n", argv[2]);
+               if (peer->expire > 0) {
+                       expire_register(peer);
+                       ast_cli(fd, "Unregistered peer \'%s\'\n\n", argv[2]);
+               } else {
+                       ast_cli(fd, "Peer %s not registered\n", argv[2]);
+               }
        } else {
                ast_cli(fd, "Peer unknown: \'%s\'. Not unregistered.\n", argv[2]);
        }