[asterisk-dev] [Code Review] Update a peer's lastmsgssent value appropriately

Mark Michelson reviewboard at asterisk.org
Tue May 22 15:30:05 CDT 2012


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1939/#review6294
-----------------------------------------------------------

Ship it!


A couple of minor suggestions below. Feel free to ignore if you want.


/branches/1.8/channels/chan_sip.c
<https://reviewboard.asterisk.org/r/1939/#comment11744>

    You may as well just wait to unlock the peer after the call to update_peer_lastmsgsent() and just pass 1 as the final parameter.



/branches/1.8/channels/chan_sip.c
<https://reviewboard.asterisk.org/r/1939/#comment11745>

    Same suggestion here.


- Mark


On May 22, 2012, 12:22 p.m., Matt Jordan wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1939/
> -----------------------------------------------------------
> 
> (Updated May 22, 2012, 12:22 p.m.)
> 
> 
> Review request for Asterisk Developers and irroot.
> 
> 
> Summary
> -------
> 
> In prior versions of Asterisk, the lastmsgssent value was used to track whether or not a peer had received MWI notifications.  Since chan_sip polled for the notifications itself, the value was rather important.  When MWI notifications were changed to use the event notification framework, the value was no longer useful for anything other then reporting through the CLI or AMI events.
> 
> Hence, in Asterisk 10 and trunk, the value was completely removed.  Unfortunately, in Asterisk 1.8, the value was not removed; instead, it is set to a value of -1 and never updated.  Since the lower 16 bits are used for old messages and the upper 16 bits are used for new messages, this results in the following being displayed for 'sip show peer foo':
> 
> LastMsgsSent : 32767/65535
> 
> Normally, I'd suggest that we remove the field from Asterisk 1.8 and call it a day.  However, since this field was supplied to users via AMI and the CLI, doing so breaks backwards compatibility.
> 
> This patch is a modification of a patch originally supplied by irroot on ASTERIS-17866.  It re-implements updating of lastmsgssent when an MWI notification is sent to a SIP peer.  Note that the original patch had to be modified slightly due to changes in sip_send_mwi_to_peer (and that up to three threads can be involved in accessing lastmsgssent means that, at the very least, the peer really should be locked when we update it).
> 
> If we decide that this isn't worth it, we should instead remove the field from Asterisk 1.8, as reporting an erroneous value isn't terribly useful.
> 
> 
> This addresses bug ASTERISK-17866.
>     https://issues.asterisk.org/jira/browse/ASTERISK-17866
> 
> 
> Diffs
> -----
> 
>   /branches/1.8/channels/chan_sip.c 367134 
> 
> Diff: https://reviewboard.asterisk.org/r/1939/diff
> 
> 
> Testing
> -------
> 
> Tested with two SIP realtime peers.  One peer without voicemail continued to display the 32767/65535 value - which is expected, as that value indicates that we haven't sent any message notifications.  Another peer, with voicemail, correctly showed the new/old message counts post registration, and displayed the counts correctly after MWI notifications were sent when new voicemails were left or listened to.
> 
> 
> Thanks,
> 
> Matt
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20120522/bcb9603b/attachment-0001.htm>


More information about the asterisk-dev mailing list