[asterisk-commits] kmoore: branch kmoore/stasis-mwi r382715 - in /team/kmoore/stasis-mwi: apps/ ...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Mar 8 10:19:15 CST 2013
Author: kmoore
Date: Fri Mar 8 10:19:07 2013
New Revision: 382715
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=382715
Log:
Re-commit work up to this point
Note that this is the mwi conversion only now that other parts have
gone into trunk.
Modified:
team/kmoore/stasis-mwi/apps/app_minivm.c
team/kmoore/stasis-mwi/apps/app_voicemail.c
team/kmoore/stasis-mwi/channels/chan_dahdi.c
team/kmoore/stasis-mwi/channels/chan_iax2.c
team/kmoore/stasis-mwi/channels/chan_mgcp.c
team/kmoore/stasis-mwi/channels/chan_sip.c
team/kmoore/stasis-mwi/channels/chan_skinny.c
team/kmoore/stasis-mwi/channels/chan_unistim.c
team/kmoore/stasis-mwi/channels/sig_pri.c
team/kmoore/stasis-mwi/channels/sig_pri.h
team/kmoore/stasis-mwi/channels/sip/include/sip.h
team/kmoore/stasis-mwi/include/asterisk/app.h
team/kmoore/stasis-mwi/include/asterisk/xmpp.h
team/kmoore/stasis-mwi/main/app.c
team/kmoore/stasis-mwi/main/asterisk.c
team/kmoore/stasis-mwi/res/res_jabber.c
team/kmoore/stasis-mwi/res/res_xmpp.c
Modified: team/kmoore/stasis-mwi/apps/app_minivm.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/apps/app_minivm.c?view=diff&rev=382715&r1=382714&r2=382715
==============================================================================
--- team/kmoore/stasis-mwi/apps/app_minivm.c (original)
+++ team/kmoore/stasis-mwi/apps/app_minivm.c Fri Mar 8 10:19:07 2013
@@ -2013,7 +2013,6 @@
* \brief Queue a message waiting event */
static void queue_mwi_event(const char *mbx, const char *ctx, int urgent, int new, int old)
{
- struct ast_event *event;
char *mailbox, *context;
mailbox = ast_strdupa(mbx);
@@ -2022,16 +2021,7 @@
context = "default";
}
- if (!(event = ast_event_new(AST_EVENT_MWI,
- AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mailbox,
- AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, context,
- AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_UINT, (new+urgent),
- AST_EVENT_IE_OLDMSGS, AST_EVENT_IE_PLTYPE_UINT, old,
- AST_EVENT_IE_END))) {
- return;
- }
-
- ast_event_queue_and_cache(event);
+ stasis_publish_mwi_state(mailbox, context, new + urgent, old);
}
/*!\internal
Modified: team/kmoore/stasis-mwi/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/apps/app_voicemail.c?view=diff&rev=382715&r1=382714&r2=382715
==============================================================================
--- team/kmoore/stasis-mwi/apps/app_voicemail.c (original)
+++ team/kmoore/stasis-mwi/apps/app_voicemail.c Fri Mar 8 10:19:07 2013
@@ -974,10 +974,8 @@
static pthread_t poll_thread = AST_PTHREADT_NULL;
static unsigned char poll_thread_run;
-/*! Subscription to ... MWI event subscriptions */
-static struct ast_event_sub *mwi_sub_sub;
-/*! Subscription to ... MWI event un-subscriptions */
-static struct ast_event_sub *mwi_unsub_sub;
+/*! Subscription to MWI event subscription changes */
+static struct stasis_subscription *mwi_sub_sub;
/*!
* \brief An MWI subscription
@@ -991,15 +989,23 @@
int old_urgent;
int old_new;
int old_old;
- uint32_t uniqueid;
+ char *uniqueid;
char mailbox[1];
};
struct mwi_sub_task {
const char *mailbox;
const char *context;
- uint32_t uniqueid;
+ const char *uniqueid;
};
+
+static void mwi_sub_task_dtor(struct mwi_sub_task *mwist)
+{
+ ast_free((void *) mwist->mailbox);
+ ast_free((void *) mwist->context);
+ ast_free((void *) mwist->uniqueid);
+ ast_free(mwist);
+}
static struct ast_taskprocessor *mwi_subscription_tps;
@@ -7721,25 +7727,16 @@
static void queue_mwi_event(const char *box, int urgent, int new, int old)
{
- struct ast_event *event;
char *mailbox, *context;
/* Strip off @default */
context = mailbox = ast_strdupa(box);
strsep(&context, "@");
- if (ast_strlen_zero(context))
+ if (ast_strlen_zero(context)) {
context = "default";
-
- if (!(event = ast_event_new(AST_EVENT_MWI,
- AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mailbox,
- AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, context,
- AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_UINT, (new+urgent),
- AST_EVENT_IE_OLDMSGS, AST_EVENT_IE_PLTYPE_UINT, old,
- AST_EVENT_IE_END))) {
- return;
- }
-
- ast_event_queue_and_cache(event);
+ }
+
+ stasis_publish_mwi_state(mailbox, context, new + urgent, old);
}
/*!
@@ -12533,28 +12530,28 @@
static void mwi_sub_destroy(struct mwi_sub *mwi_sub)
{
+ ast_free(mwi_sub->uniqueid);
ast_free(mwi_sub);
}
static int handle_unsubscribe(void *datap)
{
struct mwi_sub *mwi_sub;
- uint32_t *uniqueid = datap;
-
+ char *uniqueid = datap;
+
AST_RWLIST_WRLOCK(&mwi_subs);
AST_RWLIST_TRAVERSE_SAFE_BEGIN(&mwi_subs, mwi_sub, entry) {
- if (mwi_sub->uniqueid == *uniqueid) {
+ if (!strcmp(mwi_sub->uniqueid, uniqueid)) {
AST_LIST_REMOVE_CURRENT(entry);
- break;
+ /* Don't break here since a duplicate uniqueid
+ * may have been added as a result of a cache dump. */
+ mwi_sub_destroy(mwi_sub);
}
}
AST_RWLIST_TRAVERSE_SAFE_END
AST_RWLIST_UNLOCK(&mwi_subs);
- if (mwi_sub)
- mwi_sub_destroy(mwi_sub);
-
- ast_free(uniqueid);
+ ast_free(uniqueid);
return 0;
}
@@ -12574,7 +12571,7 @@
if (!(mwi_sub = ast_calloc(1, len)))
return -1;
- mwi_sub->uniqueid = p->uniqueid;
+ mwi_sub->uniqueid = ast_strdup(p->uniqueid);
if (!ast_strlen_zero(p->mailbox))
strcpy(mwi_sub->mailbox, p->mailbox);
@@ -12586,75 +12583,85 @@
AST_RWLIST_WRLOCK(&mwi_subs);
AST_RWLIST_INSERT_TAIL(&mwi_subs, mwi_sub, entry);
AST_RWLIST_UNLOCK(&mwi_subs);
- ast_free((void *) p->mailbox);
- ast_free((void *) p->context);
- ast_free(p);
+ mwi_sub_task_dtor(p);
poll_subscribed_mailbox(mwi_sub);
return 0;
}
-static void mwi_unsub_event_cb(const struct ast_event *event, void *userdata)
-{
- uint32_t u, *uniqueid = ast_calloc(1, sizeof(*uniqueid));
+static void mwi_unsub_event_cb(struct stasis_subscription_change *change)
+{
+ char *uniqueid = ast_strdup(change->uniqueid);
if (!uniqueid) {
ast_log(LOG_ERROR, "Unable to allocate memory for uniqueid\n");
return;
}
- if (ast_event_get_type(event) != AST_EVENT_UNSUB) {
- ast_free(uniqueid);
- return;
- }
-
- if (ast_event_get_ie_uint(event, AST_EVENT_IE_EVENTTYPE) != AST_EVENT_MWI) {
- ast_free(uniqueid);
- return;
- }
-
- u = ast_event_get_ie_uint(event, AST_EVENT_IE_UNIQUEID);
- *uniqueid = u;
if (ast_taskprocessor_push(mwi_subscription_tps, handle_unsubscribe, uniqueid) < 0) {
ast_free(uniqueid);
}
}
-static void mwi_sub_event_cb(const struct ast_event *event, void *userdata)
+static void mwi_sub_event_cb(struct stasis_subscription_change *change)
{
struct mwi_sub_task *mwist;
-
- if (ast_event_get_type(event) != AST_EVENT_SUB)
+ char *context = ast_strdupa(stasis_topic_name(change->topic));
+ char *mailbox;
+
+ if ((mwist = ast_calloc(1, (sizeof(*mwist)))) == NULL) {
return;
-
- if (ast_event_get_ie_uint(event, AST_EVENT_IE_EVENTTYPE) != AST_EVENT_MWI)
+ }
+
+ mailbox = strsep(&context, "@");
+
+ mwist->mailbox = ast_strdup(mailbox);
+ mwist->context = ast_strdup(context);
+ mwist->uniqueid = ast_strdup(change->uniqueid);
+
+ if (ast_taskprocessor_push(mwi_subscription_tps, handle_subscribe, mwist) < 0) {
+ mwi_sub_task_dtor(mwist);
+ }
+}
+
+static void mwi_event_cb(void *userdata, struct stasis_subscription *sub, struct stasis_topic *topic, struct stasis_message *msg)
+{
+ struct stasis_subscription_change *change;
+ /* Only looking for subscription change notices here */
+ if (stasis_message_type(msg) != stasis_subscription_change()) {
return;
-
- if ((mwist = ast_calloc(1, (sizeof(*mwist)))) == NULL) {
- ast_log(LOG_ERROR, "could not allocate a mwi_sub_task\n");
+ }
+
+ change = stasis_message_data(msg);
+ if (change->topic == stasis_mwi_topic_all()) {
return;
}
- mwist->mailbox = ast_strdup(ast_event_get_ie_str(event, AST_EVENT_IE_MAILBOX));
- mwist->context = ast_strdup(ast_event_get_ie_str(event, AST_EVENT_IE_CONTEXT));
- mwist->uniqueid = ast_event_get_ie_uint(event, AST_EVENT_IE_UNIQUEID);
-
- if (ast_taskprocessor_push(mwi_subscription_tps, handle_subscribe, mwist) < 0) {
- ast_free(mwist);
- }
+
+ if (!strcmp(change->description, "Subscribe")) {
+ mwi_sub_event_cb(change);
+ } else if (!strcmp(change->description, "Unsubscribe")) {
+ mwi_unsub_event_cb(change);
+ }
+}
+
+static int dump_cache(void *obj, void *arg, int flags)
+{
+ struct stasis_message *msg = obj;
+ mwi_event_cb(NULL, NULL, NULL, msg);
+ return 0;
}
static void start_poll_thread(void)
{
int errcode;
- mwi_sub_sub = ast_event_subscribe(AST_EVENT_SUB, mwi_sub_event_cb, "Voicemail MWI subscription", NULL,
- AST_EVENT_IE_EVENTTYPE, AST_EVENT_IE_PLTYPE_UINT, AST_EVENT_MWI,
- AST_EVENT_IE_END);
-
- mwi_unsub_sub = ast_event_subscribe(AST_EVENT_UNSUB, mwi_unsub_event_cb, "Voicemail MWI subscription", NULL,
- AST_EVENT_IE_EVENTTYPE, AST_EVENT_IE_PLTYPE_UINT, AST_EVENT_MWI,
- AST_EVENT_IE_END);
-
- if (mwi_sub_sub)
- ast_event_report_subs(mwi_sub_sub);
+ mwi_sub_sub = stasis_subscribe(stasis_mwi_topic_all(), mwi_event_cb, NULL);
+
+ if (mwi_sub_sub) {
+ struct ao2_container *cached = stasis_cache_dump(stasis_mwi_topic_cached(), stasis_subscription_change());
+ if (cached) {
+ ao2_callback(cached, OBJ_MULTIPLE | OBJ_NODATA, dump_cache, NULL);
+ }
+ ao2_cleanup(cached);
+ }
poll_thread_run = 1;
@@ -12668,13 +12675,8 @@
poll_thread_run = 0;
if (mwi_sub_sub) {
- ast_event_unsubscribe(mwi_sub_sub);
+ stasis_unsubscribe(mwi_sub_sub);
mwi_sub_sub = NULL;
- }
-
- if (mwi_unsub_sub) {
- ast_event_unsubscribe(mwi_unsub_sub);
- mwi_unsub_sub = NULL;
}
ast_mutex_lock(&poll_lock);
Modified: team/kmoore/stasis-mwi/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/channels/chan_dahdi.c?view=diff&rev=382715&r1=382714&r2=382715
==============================================================================
--- team/kmoore/stasis-mwi/channels/chan_dahdi.c (original)
+++ team/kmoore/stasis-mwi/channels/chan_dahdi.c Fri Mar 8 10:19:07 2013
@@ -502,7 +502,7 @@
static int dahdi_sendtext(struct ast_channel *c, const char *text);
-static void mwi_event_cb(const struct ast_event *event, void *userdata)
+static void mwi_event_cb(void *userdata, struct stasis_subscription *sub, struct stasis_topic *topic, struct stasis_message *msg)
{
/* This module does not handle MWI in an event-based manner. However, it
* subscribes to MWI for each mailbox that is configured so that the core
@@ -1215,7 +1215,7 @@
*/
char mailbox[AST_MAX_EXTENSION];
/*! \brief Opaque event subscription parameters for message waiting indication support. */
- struct ast_event_sub *mwi_event_sub;
+ struct stasis_subscription *mwi_event_sub;
/*! \brief Delayed dialing for E911. Overlap digits for ISDN. */
char dialdest[256];
#ifdef HAVE_DAHDI_LINEREVERSE_VMWI
@@ -3753,7 +3753,6 @@
static void notify_message(char *mailbox_full, int thereornot)
{
char s[sizeof(mwimonitornotify) + 80];
- struct ast_event *event;
char *mailbox, *context;
/* Strip off @default */
@@ -3762,16 +3761,7 @@
if (ast_strlen_zero(context))
context = "default";
- if (!(event = ast_event_new(AST_EVENT_MWI,
- AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mailbox,
- AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, context,
- AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_UINT, thereornot,
- AST_EVENT_IE_OLDMSGS, AST_EVENT_IE_PLTYPE_UINT, thereornot,
- AST_EVENT_IE_END))) {
- return;
- }
-
- ast_event_queue_and_cache(event);
+ stasis_publish_mwi_state(mailbox, context, thereornot, thereornot);
if (!ast_strlen_zero(mailbox) && !ast_strlen_zero(mwimonitornotify)) {
snprintf(s, sizeof(s), "%s %s %d", mwimonitornotify, mailbox, thereornot);
@@ -5413,24 +5403,25 @@
static int has_voicemail(struct dahdi_pvt *p)
{
int new_msgs;
- struct ast_event *event;
char *mailbox, *context;
+ RAII_VAR(struct stasis_message *, mwi_message, NULL, ao2_cleanup);
+ struct ast_str *uniqueid = ast_str_alloca(AST_MAX_MAILBOX_UNIQUEID);
mailbox = context = ast_strdupa(p->mailbox);
strsep(&context, "@");
- if (ast_strlen_zero(context))
+ if (ast_strlen_zero(context)) {
context = "default";
-
- event = ast_event_get_cached(AST_EVENT_MWI,
- AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mailbox,
- AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, context,
- AST_EVENT_IE_END);
-
- if (event) {
- new_msgs = ast_event_get_ie_uint(event, AST_EVENT_IE_NEWMSGS);
- ast_event_destroy(event);
- } else
+ }
+
+ ast_str_set(&uniqueid, 0, "%s@%s", mailbox, context);
+ mwi_message = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state(), ast_str_buffer(uniqueid));
+
+ if (mwi_message) {
+ struct stasis_mwi_state *mwi_state = stasis_message_data(mwi_message);
+ new_msgs = mwi_state->new_msgs;
+ } else {
new_msgs = ast_app_has_voicemail(p->mailbox, NULL);
+ }
return new_msgs;
}
@@ -5968,7 +5959,7 @@
if (p->use_smdi)
ast_smdi_interface_unref(p->smdi_iface);
if (p->mwi_event_sub)
- ast_event_unsubscribe(p->mwi_event_sub);
+ stasis_unsubscribe(p->mwi_event_sub);
if (p->vars) {
ast_variables_destroy(p->vars);
}
@@ -13226,15 +13217,14 @@
ast_copy_string(tmp->mailbox, conf->chan.mailbox, sizeof(tmp->mailbox));
if (channel != CHAN_PSEUDO && !ast_strlen_zero(tmp->mailbox)) {
char *mailbox, *context;
+ struct ast_str *uniqueid = ast_str_alloca(AST_MAX_MAILBOX_UNIQUEID);
mailbox = context = ast_strdupa(tmp->mailbox);
strsep(&context, "@");
if (ast_strlen_zero(context))
context = "default";
- tmp->mwi_event_sub = ast_event_subscribe(AST_EVENT_MWI, mwi_event_cb, "Dahdi MWI subscription", NULL,
- AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mailbox,
- AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, context,
- AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_EXISTS,
- AST_EVENT_IE_END);
+
+ ast_str_set(&uniqueid, 0, "%s@%s", mailbox, context);
+ tmp->mwi_event_sub = stasis_subscribe(stasis_mwi_topic(ast_str_buffer(uniqueid)), mwi_event_cb, NULL);
}
#ifdef HAVE_DAHDI_LINEREVERSE_VMWI
tmp->mwisend_setting = conf->chan.mwisend_setting;
Modified: team/kmoore/stasis-mwi/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/channels/chan_iax2.c?view=diff&rev=382715&r1=382714&r2=382715
==============================================================================
--- team/kmoore/stasis-mwi/channels/chan_iax2.c (original)
+++ team/kmoore/stasis-mwi/channels/chan_iax2.c Fri Mar 8 10:19:07 2013
@@ -533,7 +533,7 @@
int expire; /*!< Schedule entry for expiry */
int expiry; /*!< How soon to expire */
- iax2_format capability; /*!< Capability */
+ iax2_format capability; /*!< Capability */
/* Qualification */
int callno; /*!< Call number of POKE request */
@@ -545,12 +545,12 @@
int pokefreqnotok; /*!< How often to check when the host has been determined to be down */
int historicms; /*!< How long recent average responses took */
int smoothing; /*!< Sample over how many units to determine historic ms */
- uint16_t maxcallno; /*!< Max call number limit for this peer. Set on registration */
-
- struct ast_event_sub *mwi_event_sub;
+ uint16_t maxcallno; /*!< Max call number limit for this peer. Set on registration */
+
+ struct stasis_subscription *mwi_event_sub; /*!< This subscription lets pollmailboxes know which mailboxes need to be polled */
struct ast_acl_list *acl;
- enum calltoken_peer_enum calltoken_required; /*!< Is calltoken validation required or not, can be YES, NO, or AUTO */
+ enum calltoken_peer_enum calltoken_required; /*!< Is calltoken validation required or not, can be YES, NO, or AUTO */
};
#define IAX2_TRUNK_PREFACE (sizeof(struct iax_frame) + sizeof(struct ast_iax2_meta_hdr) + sizeof(struct ast_iax2_meta_trunk_hdr))
@@ -1316,7 +1316,7 @@
}
}
-static void mwi_event_cb(const struct ast_event *event, void *userdata)
+static void mwi_event_cb(void *userdata, struct stasis_subscription *sub, struct stasis_topic *topic, struct stasis_message *msg)
{
/* The MWI subscriptions exist just so the core knows we care about those
* mailboxes. However, we just grab the events out of the cache when it
@@ -8743,23 +8743,24 @@
iax_ie_append_short(&ied, IAX_IE_REFRESH, p->expiry);
iax_ie_append_addr(&ied, IAX_IE_APPARENT_ADDR, &peer_addr);
if (!ast_strlen_zero(p->mailbox)) {
- struct ast_event *event;
int new, old;
char *mailbox, *context;
+ RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
+ struct ast_str *uniqueid = ast_str_alloca(AST_MAX_MAILBOX_UNIQUEID);
context = mailbox = ast_strdupa(p->mailbox);
strsep(&context, "@");
- if (ast_strlen_zero(context))
+ if (ast_strlen_zero(context)) {
context = "default";
-
- event = ast_event_get_cached(AST_EVENT_MWI,
- AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mailbox,
- AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, context,
- AST_EVENT_IE_END);
- if (event) {
- new = ast_event_get_ie_uint(event, AST_EVENT_IE_NEWMSGS);
- old = ast_event_get_ie_uint(event, AST_EVENT_IE_OLDMSGS);
- ast_event_destroy(event);
+ }
+
+ ast_str_set(&uniqueid, 0, "%s@%s", mailbox, context);
+ msg = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state(), ast_str_buffer(uniqueid));
+
+ if (msg) {
+ struct stasis_mwi_state *mwi_state = stasis_message_data(msg);
+ new = mwi_state->new_msgs;
+ old = mwi_state->old_msgs;
} else { /* Fall back on checking the mailbox directly */
ast_app_inboxcount(p->mailbox, &new, &old);
}
@@ -12393,7 +12394,7 @@
ast_dnsmgr_release(peer->dnsmgr);
if (peer->mwi_event_sub)
- ast_event_unsubscribe(peer->mwi_event_sub);
+ stasis_unsubscribe(peer->mwi_event_sub);
ast_string_field_free_memory(peer);
}
@@ -12667,14 +12668,17 @@
if (!ast_strlen_zero(peer->mailbox)) {
char *mailbox, *context;
+ struct ast_str *uniqueid = ast_str_alloca(AST_MAX_MAILBOX_UNIQUEID);
+
context = mailbox = ast_strdupa(peer->mailbox);
strsep(&context, "@");
- if (ast_strlen_zero(context))
+ if (ast_strlen_zero(context)) {
context = "default";
- peer->mwi_event_sub = ast_event_subscribe(AST_EVENT_MWI, mwi_event_cb, "IAX MWI subscription", NULL,
- AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mailbox,
- AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, context,
- AST_EVENT_IE_END);
+ }
+
+ ast_str_set(&uniqueid, 0, "%s@%s", mailbox, context);
+
+ peer->mwi_event_sub = stasis_subscribe(stasis_mwi_topic(ast_str_buffer(uniqueid)), mwi_event_cb, NULL);
}
if (subscribe_acl_change) {
Modified: team/kmoore/stasis-mwi/channels/chan_mgcp.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/channels/chan_mgcp.c?view=diff&rev=382715&r1=382714&r2=382715
==============================================================================
--- team/kmoore/stasis-mwi/channels/chan_mgcp.c (original)
+++ team/kmoore/stasis-mwi/channels/chan_mgcp.c Fri Mar 8 10:19:07 2013
@@ -82,6 +82,7 @@
#include "asterisk/event.h"
#include "asterisk/chanvars.h"
#include "asterisk/pktccops.h"
+#include "asterisk/stasis.h"
/*
* Define to work around buggy dlink MGCP phone firmware which
@@ -342,7 +343,7 @@
char curtone[80]; /*!< Current tone */
char mailbox[AST_MAX_EXTENSION];
char parkinglot[AST_MAX_CONTEXT]; /*!< Parkinglot */
- struct ast_event_sub *mwi_event_sub;
+ struct stasis_subscription *mwi_event_sub;
ast_group_t callgroup;
ast_group_t pickupgroup;
int callwaiting;
@@ -483,7 +484,7 @@
.func_channel_read = acf_channel_read,
};
-static void mwi_event_cb(const struct ast_event *event, void *userdata)
+static void mwi_event_cb(void *userdata, struct stasis_subscription *sub, struct stasis_topic *topic, struct stasis_message *msg)
{
/* This module does not handle MWI in an event-based manner. However, it
* subscribes to MWI for each mailbox that is configured so that the core
@@ -494,24 +495,26 @@
static int has_voicemail(struct mgcp_endpoint *p)
{
int new_msgs;
- struct ast_event *event;
+ RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
+ struct ast_str *uniqueid = ast_str_alloca(AST_MAX_MAILBOX_UNIQUEID);
char *mbox, *cntx;
cntx = mbox = ast_strdupa(p->mailbox);
strsep(&cntx, "@");
- if (ast_strlen_zero(cntx))
+ if (ast_strlen_zero(cntx)) {
cntx = "default";
-
- event = ast_event_get_cached(AST_EVENT_MWI,
- AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mbox,
- AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, cntx,
- AST_EVENT_IE_END);
-
- if (event) {
- new_msgs = ast_event_get_ie_uint(event, AST_EVENT_IE_NEWMSGS);
- ast_event_destroy(event);
- } else
+ }
+
+ ast_str_set(&uniqueid, 0, "%s@%s", mbox, cntx);
+
+ msg = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state(), ast_str_buffer(uniqueid));
+
+ if (msg) {
+ struct stasis_mwi_state *mwi_state = stasis_message_data(msg);
+ new_msgs = mwi_state->new_msgs;
+ } else {
new_msgs = ast_app_has_voicemail(p->mailbox, NULL);
+ }
return new_msgs;
}
@@ -3972,6 +3975,7 @@
struct mgcp_endpoint *e;
struct mgcp_subchannel *sub;
struct ast_variable *chanvars = NULL;
+ struct ast_str *uniqueid = ast_str_alloca(AST_MAX_MAILBOX_UNIQUEID);
/*char txident[80];*/
int i=0, y=0;
@@ -4173,11 +4177,9 @@
if (ast_strlen_zero(cntx)) {
cntx = "default";
}
- e->mwi_event_sub = ast_event_subscribe(AST_EVENT_MWI, mwi_event_cb, "MGCP MWI subscription", NULL,
- AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mbox,
- AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, cntx,
- AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_EXISTS,
- AST_EVENT_IE_END);
+ ast_str_reset(uniqueid);
+ ast_str_set(&uniqueid, 0, "%s@%s", mbox, cntx);
+ e->mwi_event_sub = stasis_subscribe(stasis_mwi_topic(ast_str_buffer(uniqueid)), mwi_event_cb, NULL);
}
snprintf(e->rqnt_ident, sizeof(e->rqnt_ident), "%08lx", ast_random());
e->msgstate = -1;
@@ -4516,8 +4518,9 @@
ast_free(s);
}
- if (e->mwi_event_sub)
- ast_event_unsubscribe(e->mwi_event_sub);
+ if (e->mwi_event_sub) {
+ stasis_unsubscribe(e->mwi_event_sub);
+ }
if (e->chanvars) {
ast_variables_destroy(e->chanvars);
Modified: team/kmoore/stasis-mwi/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/channels/chan_sip.c?view=diff&rev=382715&r1=382714&r2=382715
==============================================================================
--- team/kmoore/stasis-mwi/channels/chan_sip.c (original)
+++ team/kmoore/stasis-mwi/channels/chan_sip.c Fri Mar 8 10:19:07 2013
@@ -294,6 +294,7 @@
#include "sip/include/dialplan_functions.h"
#include "sip/include/security_events.h"
#include "asterisk/sip_api.h"
+#include "asterisk/app.h"
/*** DOCUMENTATION
<application name="SIPDtmfMode" language="en_US">
@@ -1275,7 +1276,7 @@
static int sip_poke_peer(struct sip_peer *peer, int force);
static void sip_poke_all_peers(void);
static void sip_peer_hold(struct sip_pvt *p, int hold);
-static void mwi_event_cb(const struct ast_event *, void *);
+static void mwi_event_cb(void *, struct stasis_subscription *, struct stasis_topic *, struct stasis_message *);
static void network_change_event_cb(const struct ast_event *, void *);
static void acl_change_event_cb(const struct ast_event *event, void *userdata);
static void sip_keepalive_all_peers(void);
@@ -5226,7 +5227,7 @@
static void destroy_mailbox(struct sip_mailbox *mailbox)
{
if (mailbox->event_sub)
- ast_event_unsubscribe(mailbox->event_sub);
+ stasis_unsubscribe(mailbox->event_sub);
ast_free(mailbox);
}
@@ -16640,11 +16641,16 @@
}
/*! \brief Receive MWI events that we have subscribed to */
-static void mwi_event_cb(const struct ast_event *event, void *userdata)
+static void mwi_event_cb(void *userdata, struct stasis_subscription *sub, struct stasis_topic *topic, struct stasis_message *msg)
{
struct sip_peer *peer = userdata;
-
- sip_send_mwi_to_peer(peer, 0);
+ if (stasis_subscription_final_message(sub, msg)) {
+ ao2_cleanup(peer);
+ return;
+ }
+ if (stasis_mwi_state() == stasis_message_type(msg)) {
+ sip_send_mwi_to_peer(peer, 0);
+ }
}
static void network_change_event_subscribe(void)
@@ -24783,16 +24789,9 @@
if (!ast_strlen_zero(mailbox) && !ast_strlen_zero(c)) {
char *old = strsep(&c, " ");
char *new = strsep(&old, "/");
- struct ast_event *event;
-
- if ((event = ast_event_new(AST_EVENT_MWI,
- AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mailbox,
- AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, "SIP_Remote",
- AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_UINT, atoi(new),
- AST_EVENT_IE_OLDMSGS, AST_EVENT_IE_PLTYPE_UINT, atoi(old),
- AST_EVENT_IE_END))) {
- ast_event_queue_and_cache(event);
- }
+
+ stasis_publish_mwi_state(mailbox, "SIP_Remote", atoi(new), atoi(old));
+
transmit_response(p, "200 OK", req);
} else {
transmit_response(p, "489 Bad event", req);
@@ -27612,16 +27611,16 @@
static void add_peer_mwi_subs(struct sip_peer *peer)
{
struct sip_mailbox *mailbox;
+ struct ast_str *uniqueid = ast_str_alloca(AST_MAX_MAILBOX_UNIQUEID);
AST_LIST_TRAVERSE(&peer->mailboxes, mailbox, entry) {
- if (mailbox->event_sub) {
- ast_event_unsubscribe(mailbox->event_sub);
- }
-
- mailbox->event_sub = ast_event_subscribe(AST_EVENT_MWI, mwi_event_cb, "SIP mbox event", peer,
- AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mailbox->mailbox,
- AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, S_OR(mailbox->context, "default"),
- AST_EVENT_IE_END);
+ stasis_unsubscribe(mailbox->event_sub);
+
+ ast_str_reset(uniqueid);
+ ast_str_set(&uniqueid, 0, "%s@%s", mailbox->mailbox, S_OR(mailbox->context, "default"));
+
+ ao2_ref(peer, +1);
+ mailbox->event_sub = stasis_subscribe(stasis_mwi_topic(ast_str_buffer(uniqueid)), mwi_event_cb, peer);
}
}
@@ -28827,19 +28826,24 @@
{
struct sip_mailbox *mailbox;
int in_cache;
+ struct ast_str *uniqueid = ast_str_alloca(AST_MAX_MAILBOX_UNIQUEID);
in_cache = 0;
AST_LIST_TRAVERSE(&peer->mailboxes, mailbox, entry) {
- struct ast_event *event;
- event = ast_event_get_cached(AST_EVENT_MWI,
- AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mailbox->mailbox,
- AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, S_OR(mailbox->context, "default"),
- AST_EVENT_IE_END);
- if (!event)
+ RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
+ struct stasis_mwi_state *mwi_state;
+
+ ast_str_reset(uniqueid);
+ ast_str_set(&uniqueid, 0, "%s@%s", mailbox->mailbox, S_OR(mailbox->context, "default"));
+
+ msg = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state(), ast_str_buffer(uniqueid));
+ if (!msg) {
continue;
- *new += ast_event_get_ie_uint(event, AST_EVENT_IE_NEWMSGS);
- *old += ast_event_get_ie_uint(event, AST_EVENT_IE_OLDMSGS);
- ast_event_destroy(event);
+ }
+
+ mwi_state = stasis_message_data(msg);
+ *new += mwi_state->new_msgs;
+ *old += mwi_state->old_msgs;
in_cache = 1;
}
Modified: team/kmoore/stasis-mwi/channels/chan_skinny.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/channels/chan_skinny.c?view=diff&rev=382715&r1=382714&r2=382715
==============================================================================
--- team/kmoore/stasis-mwi/channels/chan_skinny.c (original)
+++ team/kmoore/stasis-mwi/channels/chan_skinny.c Fri Mar 8 10:19:07 2013
@@ -1442,7 +1442,7 @@
SKINNY_LINE_OPTIONS
ast_mutex_t lock;
struct skinny_container *container;
- struct ast_event_sub *mwi_event_sub; /* Event based MWI */
+ struct stasis_subscription *mwi_event_sub; /* Event based MWI */
struct skinny_subchannel *activesub;
AST_LIST_HEAD(, skinny_subchannel) sub;
AST_LIST_HEAD(, skinny_subline) sublines;
@@ -1611,7 +1611,7 @@
static int skinny_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
static int skinny_senddigit_begin(struct ast_channel *ast, char digit);
static int skinny_senddigit_end(struct ast_channel *ast, char digit, unsigned int duration);
-static void mwi_event_cb(const struct ast_event *event, void *userdata);
+static void mwi_event_cb(void *userdata, struct stasis_subscription *sub, struct stasis_topic *topic, struct stasis_message *msg);
static int skinny_dialer_cb(const void *data);
static int skinny_reload(void);
@@ -2261,7 +2261,7 @@
manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "ChannelType: Skinny\r\nPeer: Skinny/%s@%s\r\nPeerStatus: Registered\r\n", l->name, d->name);
register_exten(l);
/* initialize MWI on line and device */
- mwi_event_cb(0, l);
+ mwi_event_cb(l, NULL, NULL, NULL);
AST_LIST_TRAVERSE(&l->sublines, subline, list) {
ast_extension_state_add(subline->context, subline->exten, skinny_extensionstate_cb, subline->container);
}
@@ -3507,7 +3507,7 @@
send_callinfo(sub);
}
-static void mwi_event_cb(const struct ast_event *event, void *userdata)
+static void mwi_event_cb(void *userdata, struct stasis_subscription *sub, struct stasis_topic *topic, struct stasis_message *msg)
{
struct skinny_line *l = userdata;
struct skinny_device *d = l->device;
@@ -3518,8 +3518,9 @@
return;
}
- if (event) {
- l->newmsgs = ast_event_get_ie_uint(event, AST_EVENT_IE_NEWMSGS);
+ if (msg && stasis_mwi_state() == stasis_message_type(msg)) {
+ struct stasis_mwi_state *mwi_state = stasis_message_data(msg);
+ l->newmsgs = mwi_state->new_msgs;
}
if (l->newmsgs) {
@@ -8250,16 +8251,18 @@
if (!ast_strlen_zero(l->mailbox)) {
char *cfg_mailbox, *cfg_context;
+ struct ast_str *uniqueid = ast_str_alloca(AST_MAX_MAILBOX_UNIQUEID);
+
cfg_context = cfg_mailbox = ast_strdupa(l->mailbox);
ast_verb(3, "Setting mailbox '%s' on line %s\n", cfg_mailbox, l->name);
strsep(&cfg_context, "@");
- if (ast_strlen_zero(cfg_context))
- cfg_context = "default";
- l->mwi_event_sub = ast_event_subscribe(AST_EVENT_MWI, mwi_event_cb, "skinny MWI subsciption", l,
- AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, cfg_mailbox,
- AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, cfg_context,
- AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_EXISTS,
- AST_EVENT_IE_END);
+ if (ast_strlen_zero(cfg_context)) {
+ cfg_context = "default";
+ }
+
+ ast_str_set(&uniqueid, 0, "%s@%s", cfg_mailbox, cfg_context);
+
+ l->mwi_event_sub = stasis_subscribe(stasis_mwi_topic(ast_str_buffer(uniqueid)), mwi_event_cb, l);
}
if (!ast_strlen_zero(vmexten) && ast_strlen_zero(l->vmexten)) {
@@ -8695,7 +8698,7 @@
ast_mutex_unlock(&sub->lock);
}
if (l->mwi_event_sub)
- ast_event_unsubscribe(l->mwi_event_sub);
+ stasis_unsubscribe(l->mwi_event_sub);
ast_mutex_unlock(&l->lock);
manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "ChannelType: Skinny\r\nPeer: Skinny/%s@%s\r\nPeerStatus: Unregistered\r\n", l->name, d->name);
unregister_exten(l);
Modified: team/kmoore/stasis-mwi/channels/chan_unistim.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/channels/chan_unistim.c?view=diff&rev=382715&r1=382714&r2=382715
==============================================================================
--- team/kmoore/stasis-mwi/channels/chan_unistim.c (original)
+++ team/kmoore/stasis-mwi/channels/chan_unistim.c Fri Mar 8 10:19:07 2013
@@ -5500,23 +5500,24 @@
/*--- unistim_send_mwi_to_peer: Send message waiting indication ---*/
static int unistim_send_mwi_to_peer(struct unistim_line *peer, unsigned int tick)
{
- struct ast_event *event;
int new;
char *mailbox, *context;
+ RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
+ struct ast_str *uniqueid = ast_str_alloca(AST_MAX_MAILBOX_UNIQUEID);
context = mailbox = ast_strdupa(peer->mailbox);
strsep(&context, "@");
if (ast_strlen_zero(context)) {
context = "default";
}
- event = ast_event_get_cached(AST_EVENT_MWI,
- AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mailbox,
- AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, context,
- AST_EVENT_IE_END);
-
- if (event) {
- new = ast_event_get_ie_uint(event, AST_EVENT_IE_NEWMSGS);
- ast_event_destroy(event);
+
+ ast_str_set(&uniqueid, 0, "%s@%s", mailbox, context);
+
+ msg = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state(), ast_str_buffer(uniqueid));
+
+ if (msg) {
+ struct stasis_mwi_state *mwi_state = stasis_message_data(msg);
+ new = mwi_state->new_msgs;
} else { /* Fall back on checking the mailbox directly */
new = ast_app_has_voicemail(peer->mailbox, "INBOX");
}
Modified: team/kmoore/stasis-mwi/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/channels/sig_pri.c?view=diff&rev=382715&r1=382714&r2=382715
==============================================================================
--- team/kmoore/stasis-mwi/channels/sig_pri.c (original)
+++ team/kmoore/stasis-mwi/channels/sig_pri.c Fri Mar 8 10:19:07 2013
@@ -8752,23 +8752,30 @@
*
* \return Nothing
*/
-static void sig_pri_mwi_event_cb(const struct ast_event *event, void *userdata)
+static void sig_pri_mwi_event_cb(void *userdata, struct stasis_subscription *sub, struct stasis_topic *topic, struct stasis_message *msg)
{
struct sig_pri_span *pri = userdata;
const char *mbox_context;
const char *mbox_number;
int num_messages;
int idx;
-
- mbox_number = ast_event_get_ie_str(event, AST_EVENT_IE_MAILBOX);
+ struct stasis_mwi_state *mwi_state;
+
+ if (stasis_mwi_state() != stasis_message_type(msg)) {
+ return;
+ }
+
+ mwi_state = stasis_message_data(msg);
+
+ mbox_number = mwi_state->mailbox;
if (ast_strlen_zero(mbox_number)) {
return;
}
- mbox_context = ast_event_get_ie_str(event, AST_EVENT_IE_CONTEXT);
+ mbox_context = mwi_state->context;
if (ast_strlen_zero(mbox_context)) {
return;
}
- num_messages = ast_event_get_ie_uint(event, AST_EVENT_IE_NEWMSGS);
+ num_messages = mwi_state->new_msgs;
for (idx = 0; idx < ARRAY_LEN(pri->mbox); ++idx) {
if (!pri->mbox[idx].sub) {
@@ -8799,27 +8806,28 @@
static void sig_pri_mwi_cache_update(struct sig_pri_span *pri)
{
int idx;
- int num_messages;
- struct ast_event *event;
+ struct ast_str *uniqueid = ast_str_alloca(AST_MAX_MAILBOX_UNIQUEID);
+ struct stasis_mwi_state *mwi_state;
for (idx = 0; idx < ARRAY_LEN(pri->mbox); ++idx) {
+ RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
if (!pri->mbox[idx].sub) {
/* Mailbox slot is empty */
continue;
}
- event = ast_event_get_cached(AST_EVENT_MWI,
- AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, pri->mbox[idx].number,
- AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, pri->mbox[idx].context,
- AST_EVENT_IE_END);
- if (!event) {
+ ast_str_reset(uniqueid);
+ ast_str_set(&uniqueid, 0, "%s@%s", pri->mbox[idx].number, pri->mbox[idx].context);
+
+ msg = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state(), ast_str_buffer(uniqueid));
+ if (!msg) {
/* No cached event for this mailbox. */
continue;
}
- num_messages = ast_event_get_ie_uint(event, AST_EVENT_IE_NEWMSGS);
+
+ mwi_state = stasis_message_data(msg);
sig_pri_send_mwi_indication(pri, pri->mbox[idx].vm_number, pri->mbox[idx].number,
- pri->mbox[idx].context, num_messages);
- ast_event_destroy(event);
+ pri->mbox[idx].context, mwi_state->new_msgs);
}
}
#endif /* defined(HAVE_PRI_MWI) */
@@ -8841,7 +8849,8 @@
#if defined(HAVE_PRI_MWI)
for (idx = 0; idx < ARRAY_LEN(pri->mbox); ++idx) {
if (pri->mbox[idx].sub) {
- pri->mbox[idx].sub = ast_event_unsubscribe(pri->mbox[idx].sub);
+ stasis_unsubscribe(pri->mbox[idx].sub);
+ pri->mbox[idx].sub = NULL;
}
}
#endif /* defined(HAVE_PRI_MWI) */
@@ -8905,13 +8914,15 @@
char *saveptr;
char *prev_vm_number;
struct ast_str *mwi_description = ast_str_alloca(64);
+ struct ast_str *uniqueid = ast_str_alloca(AST_MAX_MAILBOX_UNIQUEID);
#endif /* defined(HAVE_PRI_MWI) */
#if defined(HAVE_PRI_MWI)
/* Prepare the mbox[] for use. */
for (i = 0; i < ARRAY_LEN(pri->mbox); ++i) {
if (pri->mbox[i].sub) {
- pri->mbox[i].sub = ast_event_unsubscribe(pri->mbox[i].sub);
+ stasis_unsubscribe(pri->mbox[i].sub);
+ pri->mbox[i].sub = NULL;
}
}
#endif /* defined(HAVE_PRI_MWI) */
@@ -8976,13 +8987,13 @@
/* Fill the mbox[] element. */
pri->mbox[i].number = mbox_number;
pri->mbox[i].context = mbox_context;
+
+ ast_str_reset(uniqueid);
+ ast_str_set(&uniqueid, 0, "%s@%s", mbox_number, mbox_context);
+
ast_str_set(&mwi_description, -1, "%s span %d[%d] MWI mailbox %s@%s",
sig_pri_cc_type_name, pri->span, i, mbox_number, mbox_context);
- pri->mbox[i].sub = ast_event_subscribe(AST_EVENT_MWI, sig_pri_mwi_event_cb,
- ast_str_buffer(mwi_description), pri,
- AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, mbox_number,
- AST_EVENT_IE_CONTEXT, AST_EVENT_IE_PLTYPE_STR, mbox_context,
- AST_EVENT_IE_END);
+ pri->mbox[i].sub = stasis_subscribe(stasis_mwi_topic(ast_str_buffer(uniqueid)), sig_pri_mwi_event_cb, pri);
if (!pri->mbox[i].sub) {
ast_log(LOG_ERROR, "%s span %d could not subscribe to MWI events for %s@%s.",
sig_pri_cc_type_name, pri->span, mbox_number, mbox_context);
Modified: team/kmoore/stasis-mwi/channels/sig_pri.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/channels/sig_pri.h?view=diff&rev=382715&r1=382714&r2=382715
==============================================================================
--- team/kmoore/stasis-mwi/channels/sig_pri.h (original)
+++ team/kmoore/stasis-mwi/channels/sig_pri.h Fri Mar 8 10:19:07 2013
@@ -405,7 +405,7 @@
* \brief MWI mailbox event subscription.
* \note NULL if mailbox not configured.
*/
- struct ast_event_sub *sub;
+ struct stasis_subscription *sub;
/*! \brief Mailbox number */
const char *number;
/*! \brief Mailbox context. */
Modified: team/kmoore/stasis-mwi/channels/sip/include/sip.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/channels/sip/include/sip.h?view=diff&rev=382715&r1=382714&r2=382715
==============================================================================
--- team/kmoore/stasis-mwi/channels/sip/include/sip.h (original)
+++ team/kmoore/stasis-mwi/channels/sip/include/sip.h Fri Mar 8 10:19:07 2013
@@ -1260,7 +1260,7 @@
*/
struct sip_mailbox {
/*! Associated MWI subscription */
- struct ast_event_sub *event_sub;
+ struct stasis_subscription *event_sub;
AST_LIST_ENTRY(sip_mailbox) entry;
unsigned int delme:1;
char *context;
Modified: team/kmoore/stasis-mwi/include/asterisk/app.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/include/asterisk/app.h?view=diff&rev=382715&r1=382714&r2=382715
==============================================================================
--- team/kmoore/stasis-mwi/include/asterisk/app.h (original)
+++ team/kmoore/stasis-mwi/include/asterisk/app.h Fri Mar 8 10:19:07 2013
@@ -28,6 +28,7 @@
#include "asterisk/threadstorage.h"
#include "asterisk/file.h"
#include "asterisk/linkedlists.h"
+#include "asterisk/utils.h"
struct ast_flags64;
@@ -1086,6 +1087,96 @@
*/
int ast_app_parse_timelen(const char *timestr, int *result, enum ast_timelen defunit);
+/*!
+ * \brief Publish a MWI state update via stasis
+ * \param[in] uniqueid A unique identifier for this mailbox (usually mailbox at context)
+ * \param[in] mailbox The number identifying this mailbox
+ * \param[in] context The context this mailbox resides in
+ * \param[in] new_msgs The number of new messages in this mailbox
+ * \param[in] old_msgs The number of old messages in this mailbox
+ * \retval 0 Success
+ * \retval -1 Failure
+ * \since 12
+ */
+#define stasis_publish_mwi_state(mailbox, context, new_msgs, old_msgs) \
+ stasis_publish_mwi_state_full(mailbox, context, new_msgs, old_msgs, NULL)
+
+/*!
+ * \brief Publish a MWI state update via stasis with EID
+ * \param[in] uniqueid A unique identifier for this mailbox (usually mailbox at context)
+ * \param[in] mailbox The number identifying this mailbox
[... 532 lines stripped ...]
More information about the asterisk-commits
mailing list