[asterisk-commits] mmichelson: branch mmichelson/pub_sub r385340 - in /team/mmichelson/pub_sub: ...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Apr 11 12:42:59 CDT 2013
Author: mmichelson
Date: Thu Apr 11 12:42:57 2013
New Revision: 385340
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=385340
Log:
Make aggregation of mailbox state optional for unsolicited MWI.
Modified:
team/mmichelson/pub_sub/include/asterisk/res_sip.h
team/mmichelson/pub_sub/res/res_sip/sip_configuration.c
team/mmichelson/pub_sub/res/res_sip_mwi.c
Modified: team/mmichelson/pub_sub/include/asterisk/res_sip.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pub_sub/include/asterisk/res_sip.h?view=diff&rev=385340&r1=385339&r2=385340
==============================================================================
--- team/mmichelson/pub_sub/include/asterisk/res_sip.h (original)
+++ team/mmichelson/pub_sub/include/asterisk/res_sip.h Thu Apr 11 12:42:57 2013
@@ -330,6 +330,8 @@
unsigned int send_pai;
/*! Do we send Remote-Party-ID headers to this endpoint? */
unsigned int send_rpid;
+ /*! Should unsolicited MWI be aggregated into a single NOTIFY? */
+ unsigned int aggregate_mwi;
};
/*!
Modified: team/mmichelson/pub_sub/res/res_sip/sip_configuration.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pub_sub/res/res_sip/sip_configuration.c?view=diff&rev=385340&r1=385339&r2=385340
==============================================================================
--- team/mmichelson/pub_sub/res/res_sip/sip_configuration.c (original)
+++ team/mmichelson/pub_sub/res/res_sip/sip_configuration.c Thu Apr 11 12:42:57 2013
@@ -350,6 +350,7 @@
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "send_pai", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, send_pai));
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "send_rpid", "no", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, send_rpid));
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "mailboxes", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, mailboxes));
+ ast_sorcery_object_field_register(sip_sorcery, "endpoint", "aggregate_mwi", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, aggregate_mwi));
if (ast_sip_initialize_sorcery_transport(sip_sorcery)) {
ast_log(LOG_ERROR, "Failed to register SIP transport support with sorcery\n");
Modified: team/mmichelson/pub_sub/res/res_sip_mwi.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pub_sub/res/res_sip_mwi.c?view=diff&rev=385340&r1=385339&r2=385340
==============================================================================
--- team/mmichelson/pub_sub/res/res_sip_mwi.c (original)
+++ team/mmichelson/pub_sub/res/res_sip_mwi.c Thu Apr 11 12:42:57 2013
@@ -300,7 +300,7 @@
static int create_mwi_subscriptions_for_endpoint(void *obj, void *arg, int flags)
{
- RAII_VAR(struct mwi_subscription *, sub, NULL, ao2_cleanup);
+ RAII_VAR(struct mwi_subscription *, aggregate_sub, NULL, ao2_cleanup);
struct ast_sip_endpoint *endpoint = obj;
char *mailboxes;
char *mailbox;
@@ -309,20 +309,27 @@
return 0;
}
- sub = mwi_subscription_alloc(endpoint, 0);
- if (!sub) {
- return 0;
+ if (endpoint->aggregate_mwi) {
+ aggregate_sub = mwi_subscription_alloc(endpoint, 0);
+ if (!aggregate_sub) {
+ return 0;
+ }
}
mailboxes = ast_strdupa(endpoint->mailboxes);
while ((mailbox = strsep(&mailboxes, ","))) {
+ struct mwi_subscription *sub = aggregate_sub ?: mwi_subscription_alloc(endpoint, 0);
RAII_VAR(struct mwi_stasis_subscription *, mwi_stasis_sub,
mwi_stasis_subscription_alloc(mailbox, sub), ao2_cleanup);
if (mwi_stasis_sub) {
ao2_link(sub->stasis_subs, mwi_stasis_sub);
}
- }
- ao2_link(mwi_subscriptions, sub);
+ if (!aggregate_sub) {
+ ao2_link(mwi_subscriptions, sub);
+ ao2_cleanup(sub);
+ }
+ }
+ ao2_link(mwi_subscriptions, aggregate_sub);
return 0;
}
More information about the asterisk-commits
mailing list