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

Mark Michelson reviewboard at asterisk.org
Thu Apr 5 17:32:14 CDT 2012


-----------------------------------------------------------
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.


Changes
-------

This update changes some uses of int to enum ast_presence_state.


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 (updated)
-----

  /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/20120405/7c92c08c/attachment.htm>


More information about the asterisk-dev mailing list