summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2013-05-24 20:44:07 +0000
committerMatthew Jordan <mjordan@digium.com>2013-05-24 20:44:07 +0000
commit06be8463b683333c79845402d55168ef1b582fa9 (patch)
tree2fe0871cfec4d5edf3aae763541ff7efa32a444a /channels
parentc1b51fd2654736fd7c614d1571f904e236006651 (diff)
Migrate a large number of AMI events over to Stasis-Core
This patch moves a number of AMI events over to the Stasis-Core message bus. This includes: * ChanSpyStart/Stop * MonitorStart/Stop * MusicOnHoldStart/Stop * FullyBooted/Reload * All Voicemail/MWI related events In addition, it adds some Stasis-Core and AMI support for generic AMI messages, refactors the message router in AMI to use a single router with topic forwarding for the topics that AMI cares about, and refactors MWI message types and topics to be more name compliant. Review: https://reviewboard.asterisk.org/r/2532 (closes issue ASTERISK-21462) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@389733 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_dahdi.c8
-rw-r--r--channels/chan_iax2.c6
-rw-r--r--channels/chan_mgcp.c6
-rw-r--r--channels/chan_sip.c10
-rw-r--r--channels/chan_skinny.c6
-rw-r--r--channels/chan_unistim.c4
-rw-r--r--channels/sig_pri.c10
7 files changed, 25 insertions, 25 deletions
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index 1f9ee5a56..03279a01e 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -3762,7 +3762,7 @@ static void notify_message(char *mailbox_full, int thereornot)
if (ast_strlen_zero(context))
context = "default";
- stasis_publish_mwi_state(mailbox, context, thereornot, thereornot);
+ ast_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);
@@ -5427,10 +5427,10 @@ static int has_voicemail(struct dahdi_pvt *p)
}
ast_str_set(&uniqueid, 0, "%s@%s", mailbox, context);
- mwi_message = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state_type(), ast_str_buffer(uniqueid));
+ mwi_message = stasis_cache_get(ast_mwi_topic_cached(), ast_mwi_state_type(), ast_str_buffer(uniqueid));
if (mwi_message) {
- struct stasis_mwi_state *mwi_state = stasis_message_data(mwi_message);
+ struct ast_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);
@@ -13235,7 +13235,7 @@ static struct dahdi_pvt *mkintf(int channel, const struct dahdi_chan_conf *conf,
ast_str_set(&uniqueid, 0, "%s@%s", mailbox, context);
- mailbox_specific_topic = stasis_mwi_topic(ast_str_buffer(uniqueid));
+ mailbox_specific_topic = ast_mwi_topic(ast_str_buffer(uniqueid));
if (mailbox_specific_topic) {
tmp->mwi_event_sub = stasis_subscribe(mailbox_specific_topic, mwi_event_cb, NULL);
}
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 49ce66cb7..7f98159b2 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -8772,10 +8772,10 @@ static int update_registry(struct sockaddr_in *sin, int callno, char *devtype, i
}
ast_str_set(&uniqueid, 0, "%s@%s", mailbox, context);
- msg = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state_type(), ast_str_buffer(uniqueid));
+ msg = stasis_cache_get(ast_mwi_topic_cached(), ast_mwi_state_type(), ast_str_buffer(uniqueid));
if (msg) {
- struct stasis_mwi_state *mwi_state = stasis_message_data(msg);
+ struct ast_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 */
@@ -12555,7 +12555,7 @@ static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, st
ast_str_set(&uniqueid, 0, "%s@%s", mailbox, context);
- mailbox_specific_topic = stasis_mwi_topic(ast_str_buffer(uniqueid));
+ mailbox_specific_topic = ast_mwi_topic(ast_str_buffer(uniqueid));
if (mailbox_specific_topic) {
peer->mwi_event_sub = stasis_subscribe(mailbox_specific_topic, mwi_event_cb, NULL);
}
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index 1f0830762..c6b441049 100644
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -507,10 +507,10 @@ static int has_voicemail(struct mgcp_endpoint *p)
ast_str_set(&uniqueid, 0, "%s@%s", mbox, cntx);
- msg = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state_type(), ast_str_buffer(uniqueid));
+ msg = stasis_cache_get(ast_mwi_topic_cached(), ast_mwi_state_type(), ast_str_buffer(uniqueid));
if (msg) {
- struct stasis_mwi_state *mwi_state = stasis_message_data(msg);
+ struct ast_mwi_state *mwi_state = stasis_message_data(msg);
new_msgs = mwi_state->new_msgs;
} else {
new_msgs = ast_app_has_voicemail(p->mailbox, NULL);
@@ -4169,7 +4169,7 @@ static struct mgcp_gateway *build_gateway(char *cat, struct ast_variable *v)
ast_str_reset(uniqueid);
ast_str_set(&uniqueid, 0, "%s@%s", mbox, cntx);
- mailbox_specific_topic = stasis_mwi_topic(ast_str_buffer(uniqueid));
+ mailbox_specific_topic = ast_mwi_topic(ast_str_buffer(uniqueid));
if (mailbox_specific_topic) {
e->mwi_event_sub = stasis_subscribe(mailbox_specific_topic, mwi_event_cb, NULL);
}
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index f7a528b68..77cd9c253 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -16724,7 +16724,7 @@ static void mwi_event_cb(void *userdata, struct stasis_subscription *sub, struct
ao2_cleanup(peer);
return;
}
- if (stasis_mwi_state_type() == stasis_message_type(msg)) {
+ if (ast_mwi_state_type() == stasis_message_type(msg)) {
sip_send_mwi_to_peer(peer, 0);
}
}
@@ -24767,7 +24767,7 @@ static int handle_request_notify(struct sip_pvt *p, struct sip_request *req, str
char *old = strsep(&c, " ");
char *new = strsep(&old, "/");
- stasis_publish_mwi_state(mailbox, "SIP_Remote", atoi(new), atoi(old));
+ ast_publish_mwi_state(mailbox, "SIP_Remote", atoi(new), atoi(old));
transmit_response(p, "200 OK", req);
} else {
@@ -27420,7 +27420,7 @@ static void add_peer_mwi_subs(struct sip_peer *peer)
ast_str_reset(uniqueid);
ast_str_set(&uniqueid, 0, "%s@%s", mailbox->mailbox, S_OR(mailbox->context, "default"));
- mailbox_specific_topic = stasis_mwi_topic(ast_str_buffer(uniqueid));
+ mailbox_specific_topic = ast_mwi_topic(ast_str_buffer(uniqueid));
if (mailbox_specific_topic) {
ao2_ref(peer, +1);
mailbox->event_sub = stasis_subscribe(mailbox_specific_topic, mwi_event_cb, peer);
@@ -28630,12 +28630,12 @@ static int get_cached_mwi(struct sip_peer *peer, int *new, int *old)
in_cache = 0;
AST_LIST_TRAVERSE(&peer->mailboxes, mailbox, entry) {
RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
- struct stasis_mwi_state *mwi_state;
+ struct ast_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_type(), ast_str_buffer(uniqueid));
+ msg = stasis_cache_get(ast_mwi_topic_cached(), ast_mwi_state_type(), ast_str_buffer(uniqueid));
if (!msg) {
continue;
}
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index cd194d5a8..f1398049b 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -3535,8 +3535,8 @@ static void mwi_event_cb(void *userdata, struct stasis_subscription *sub, struct
return;
}
- if (msg && stasis_mwi_state_type() == stasis_message_type(msg)) {
- struct stasis_mwi_state *mwi_state = stasis_message_data(msg);
+ if (msg && ast_mwi_state_type() == stasis_message_type(msg)) {
+ struct ast_mwi_state *mwi_state = stasis_message_data(msg);
l->newmsgs = mwi_state->new_msgs;
}
@@ -8214,7 +8214,7 @@ static struct skinny_line *config_line(const char *lname, struct ast_variable *v
ast_str_set(&uniqueid, 0, "%s@%s", cfg_mailbox, cfg_context);
- mailbox_specific_topic = stasis_mwi_topic(ast_str_buffer(uniqueid));
+ mailbox_specific_topic = ast_mwi_topic(ast_str_buffer(uniqueid));
if (mailbox_specific_topic) {
l->mwi_event_sub = stasis_subscribe(mailbox_specific_topic, mwi_event_cb, l);
}
diff --git a/channels/chan_unistim.c b/channels/chan_unistim.c
index 88332ec9a..42a71bac3 100644
--- a/channels/chan_unistim.c
+++ b/channels/chan_unistim.c
@@ -5508,10 +5508,10 @@ static int unistim_send_mwi_to_peer(struct unistim_line *peer, unsigned int tick
ast_str_set(&uniqueid, 0, "%s@%s", mailbox, context);
- msg = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state_type(), ast_str_buffer(uniqueid));
+ msg = stasis_cache_get(ast_mwi_topic_cached(), ast_mwi_state_type(), ast_str_buffer(uniqueid));
if (msg) {
- struct stasis_mwi_state *mwi_state = stasis_message_data(msg);
+ struct ast_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");
diff --git a/channels/sig_pri.c b/channels/sig_pri.c
index 353b7f39b..db0c92043 100644
--- a/channels/sig_pri.c
+++ b/channels/sig_pri.c
@@ -8768,9 +8768,9 @@ static void sig_pri_mwi_event_cb(void *userdata, struct stasis_subscription *sub
const char *mbox_number;
int num_messages;
int idx;
- struct stasis_mwi_state *mwi_state;
+ struct ast_mwi_state *mwi_state;
- if (stasis_mwi_state_type() != stasis_message_type(msg)) {
+ if (ast_mwi_state_type() != stasis_message_type(msg)) {
return;
}
@@ -8816,7 +8816,7 @@ static void sig_pri_mwi_cache_update(struct sig_pri_span *pri)
{
int idx;
struct ast_str *uniqueid = ast_str_alloca(AST_MAX_MAILBOX_UNIQUEID);
- struct stasis_mwi_state *mwi_state;
+ struct ast_mwi_state *mwi_state;
for (idx = 0; idx < ARRAY_LEN(pri->mbox); ++idx) {
RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
@@ -8828,7 +8828,7 @@ static void sig_pri_mwi_cache_update(struct sig_pri_span *pri)
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_type(), ast_str_buffer(uniqueid));
+ msg = stasis_cache_get(ast_mwi_topic_cached(), ast_mwi_state_type(), ast_str_buffer(uniqueid));
if (!msg) {
/* No cached event for this mailbox. */
continue;
@@ -9002,7 +9002,7 @@ int sig_pri_start_pri(struct sig_pri_span *pri)
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);
- mailbox_specific_topic = stasis_mwi_topic(ast_str_buffer(uniqueid));
+ mailbox_specific_topic = ast_mwi_topic(ast_str_buffer(uniqueid));
if (mailbox_specific_topic) {
pri->mbox[i].sub = stasis_subscribe(mailbox_specific_topic, sig_pri_mwi_event_cb, pri);
}