[asterisk-dev] [Code Review]: Enhancements to presence in Asterisk

Matt Jordan reviewboard at asterisk.org
Tue Apr 17 09:49:18 CDT 2012



> On April 12, 2012, 9:30 a.m., Matt Jordan wrote:
> > /team/mmichelson/trunk-digiumphones/funcs/func_presencestate.c, line 311
> > <https://reviewboard.asterisk.org/r/1850/diff/2/?file=27018#file27018line311>
> >
> >     If we can't parse the value in the data base into a valid presence state, it returns -1.  Furthermore, if we run out of delimiters in the comma separated list of values that we expect to be in state_info, we return 0, and the subsequent buffers passed into parse_data retain their original values.
> >     
> >     In those cases, the various character pointers will be pointing to who knows what.  If parse_data fails or returns earlier then we expect, we need to gracefully handle that here.
> 
> Mark Michelson wrote:
>     Agree that we should handle a failure. However, your statement about the "character pointers will be pointing to who knows what" are incorrect. The first thing that parse_data() does is to set the subtype, message, and options to an empty string. This means that on any return, we can be sure that the pointers are initialized to some value, even if that value is an empty string.

Doh - missed that due to not expanding parse_data out.  This (and the rest of the findings dealing with parse_data) are much less important.


- Matt


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


On April 5, 2012, 5:32 p.m., Mark Michelson wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1850/
> -----------------------------------------------------------
> 
> (Updated April 5, 2012, 5:32 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> This changeset contains revisions to the presence system in Asterisk to make it more palatable for general release in Asterisk 11. While the system as it exists in the 1.8-digiumphones and 10-digiumphones works well, it was missing some functionality and was not implemented in the most optimal way in some cases. Below are a list of the changes made:
> 
> * func_presencestate has two CLI commands added. "presencestate list" lists the current states of all CustomPresence entities. "presencestate change" allows for CustomPresence entities' states to be updated. These two commands are modeled after similar ones in func_devstate.
> * func_presencestate now populates the event cache on startup to mirror what func_devstate does.
> * The functions that change presence state have been updated to behave more like the ast_devstate_changed family of functions. This includes two main changes.
>     - There are now two functions to use, either ast_presence_state_changed() or ast_presence_state_changed_literal(). The difference between these is that one takes a printf-style format string and the other takes a literal name.
>     - The state change functions now take the state (and subtype and message) as part of the function. This saves the trouble of having to look up the state from the presence state provider on every state change. In the case of CustomPresence, this means far fewer ASTDB reads.
> * A new manager action, "PresenceState", has been added. This will return the current presence state, subtype, and message for a given presence provider.
> 
> 
> Diffs
> -----
> 
>   /team/mmichelson/trunk-digiumphones/funcs/func_presencestate.c 361324 
>   /team/mmichelson/trunk-digiumphones/include/asterisk/presencestate.h 361324 
>   /team/mmichelson/trunk-digiumphones/main/manager.c 361324 
>   /team/mmichelson/trunk-digiumphones/main/presencestate.c 361324 
> 
> Diff: https://reviewboard.asterisk.org/r/1850/diff
> 
> 
> Testing
> -------
> 
> I have tested the CLI commands and Manager actions. They exercise the core updates, so I can verify they work as well. I will have an external test written within the coming days and will post it when I have completed it.
> 
> 
> Thanks,
> 
> Mark
> 
>

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


More information about the asterisk-dev mailing list