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 223e227..fed98d4 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]);
        }