]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Make sip show channel display a given callid when only partly specified
authorMark Spencer <markster@digium.com>
Thu, 2 Oct 2003 06:46:19 +0000 (06:46 +0000)
committerMark Spencer <markster@digium.com>
Thu, 2 Oct 2003 06:46:19 +0000 (06:46 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1602 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 1921a0e6486483d9e77a28ec832e8ac9d5d74a47..3fa7a1977b2ba5555b608be72d1c1dd925fe833a 100755 (executable)
@@ -4139,12 +4139,14 @@ static int sip_show_channel(int fd, int argc, char *argv[])
 {
        struct sip_pvt *cur;
        char tmp[256];
+       size_t len;
        if (argc != 4)
                return RESULT_SHOWUSAGE;
+       len = strlen(argv[3]);
        ast_mutex_lock(&iflock);
        cur = iflist;
        while(cur) {
-               if (!strcasecmp(cur->callid, argv[3])) {
+               if (!strncasecmp(cur->callid, argv[3],len)) {
                        ast_cli(fd, "Call-ID: %s\n", cur->callid);
                        ast_cli(fd, "Our Codec Capability: %d\n", cur->capability);
                        ast_cli(fd, "Non-Codec Capability: %d\n", cur->noncodeccapability);
@@ -4162,14 +4164,13 @@ static int sip_show_channel(int fd, int argc, char *argv[])
                                strcat(tmp, "info ");
                        if (cur->dtmfmode & SIP_DTMF_INBAND)
                                strcat(tmp, "inband ");
-                       ast_cli(fd, "DTMF Mode: %s\n", tmp);
-                       break;
+                       ast_cli(fd, "DTMF Mode: %s\n\n", tmp);
                }
                cur = cur->next;
        }
        ast_mutex_unlock(&iflock);
        if (!cur) 
-               ast_cli(fd, "No such SIP Call ID '%s'\n", argv[3]);
+               ast_cli(fd, "No such SIP Call ID starting with '%s'\n", argv[3]);
        return RESULT_SUCCESS;
 }