]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Having more than 255 old messages caused corruption in the new/old count
authorTilghman Lesher <tilghman@meg.abyt.es>
Mon, 13 Nov 2006 20:18:30 +0000 (20:18 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Mon, 13 Nov 2006 20:18:30 +0000 (20:18 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@47580 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 04294afdff6273236567aead0ce8bc31bd4cfd2b..a461e7133b7fcad2cab60c89d9f5e3010d877a18 100644 (file)
@@ -8133,7 +8133,7 @@ static int _sip_show_peer(int type, int fd, struct mansession *s, struct message
                print_group(fd, peer->pickupgroup, 0);
                ast_cli(fd, "  Mailbox      : %s\n", peer->mailbox);
                ast_cli(fd, "  VM Extension : %s\n", peer->vmexten);
-               ast_cli(fd, "  LastMsgsSent : %d\n", peer->lastmsgssent);
+               ast_cli(fd, "  LastMsgsSent : %d/%d\n", (peer->lastmsgssent & 0x7fff0000) >> 16, peer->lastmsgssent & 0xffff);
                ast_cli(fd, "  Call limit   : %d\n", peer->call_limit);
                ast_cli(fd, "  Dynamic      : %s\n", (ast_test_flag(&peer->flags_page2, SIP_PAGE2_DYNAMIC)?"Yes":"No"));
                ast_cli(fd, "  Callerid     : %s\n", ast_callerid_merge(cbuf, sizeof(cbuf), peer->cid_name, peer->cid_num, "<unspecified>"));
@@ -11451,7 +11451,7 @@ static int sip_send_mwi_to_peer(struct sip_peer *peer)
        time(&peer->lastmsgcheck);
        
        /* Return now if it's the same thing we told them last time */
-       if (((newmsgs << 8) | (oldmsgs)) == peer->lastmsgssent) {
+       if (((newmsgs > 0x7fff ? 0x7fff0000 : (newmsgs << 16)) | (oldmsgs > 0xffff ? 0xffff : oldmsgs)) == peer->lastmsgssent) {
                return 0;
        }
        
@@ -11460,7 +11460,7 @@ static int sip_send_mwi_to_peer(struct sip_peer *peer)
                ast_log(LOG_WARNING, "Unable to build sip pvt data for MWI\n");
                return -1;
        }
-       peer->lastmsgssent = ((newmsgs << 8) | (oldmsgs));
+       peer->lastmsgssent = ((newmsgs > 0x7fff ? 0x7fff0000 : (newmsgs << 16)) | (oldmsgs > 0xffff ? 0xffff : oldmsgs));
        if (create_addr_from_peer(p, peer)) {
                /* Maybe they're not registered, etc. */
                sip_destroy(p);