mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-29 18:19:30 +00:00
Voicemail: Remove mailbox identifier format (box@context) assumptions in the system.
This change is in preparation for external MWI support. Removed code from the system for normal mailbox handling that appends @default to the mailbox identifier if it does not have a context. The only exception is the legacy hasvoicemail users.conf option. The legacy option will only work for app_voicemail mailboxes. The system cannot make any assumptions about the format of the mailbox identifer used by app_voicemail. chan_sip and chan_dahdi/sig_pri had the most changes because they both tried to interpret the mailbox identifier. chan_sip just stored and compared the two components. chan_dahdi actually used the box information. The ISDN MWI support configuration options had to be reworked because chan_dahdi was parsing the box@context format to get the box number. As a result the mwi_vm_boxes chan_dahdi.conf option was added and is documented in the chan_dahdi.conf.sample file. Review: https://reviewboard.asterisk.org/r/3072/ ........ Merged revisions 404348 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404350 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -370,7 +370,7 @@ static int aji_delete_node_list(void *data, ikspak* pak);
|
||||
static void aji_pubsub_purge_nodes(struct aji_client *client,
|
||||
const char* collection_name);
|
||||
static void aji_publish_mwi(struct aji_client *client, const char *mailbox,
|
||||
const char *context, const char *oldmsgs, const char *newmsgs);
|
||||
const char *oldmsgs, const char *newmsgs);
|
||||
static void aji_devstate_cb(void *data, struct stasis_subscription *sub, struct stasis_message *msg);
|
||||
static void aji_mwi_cb(void *data, struct stasis_subscription *sub, struct stasis_message *msg);
|
||||
static iks* aji_build_publish_skeleton(struct aji_client *client, const char *node,
|
||||
@@ -3237,8 +3237,6 @@ int ast_aji_disconnect(struct aji_client *client)
|
||||
*/
|
||||
static void aji_mwi_cb(void *data, struct stasis_subscription *sub, struct stasis_message *msg)
|
||||
{
|
||||
const char *mailbox;
|
||||
const char *context;
|
||||
char oldmsgs[10];
|
||||
char newmsgs[10];
|
||||
struct aji_client *client = data;
|
||||
@@ -3255,13 +3253,9 @@ static void aji_mwi_cb(void *data, struct stasis_subscription *sub, struct stasi
|
||||
return;
|
||||
}
|
||||
|
||||
mailbox = mwi_state->mailbox;
|
||||
context = mwi_state->context;
|
||||
snprintf(oldmsgs, sizeof(oldmsgs), "%d",
|
||||
mwi_state->old_msgs);
|
||||
snprintf(newmsgs, sizeof(newmsgs), "%d",
|
||||
mwi_state->new_msgs);
|
||||
aji_publish_mwi(client, mailbox, context, oldmsgs, newmsgs);
|
||||
snprintf(oldmsgs, sizeof(oldmsgs), "%d", mwi_state->old_msgs);
|
||||
snprintf(newmsgs, sizeof(newmsgs), "%d", mwi_state->new_msgs);
|
||||
aji_publish_mwi(client, mwi_state->uniqueid, oldmsgs, newmsgs);
|
||||
}
|
||||
/*!
|
||||
* \brief Callback function for device state events
|
||||
@@ -3514,20 +3508,18 @@ static void aji_publish_device_state(struct aji_client *client, const char *devi
|
||||
/*!
|
||||
* \brief Publish MWI to a PubSub node
|
||||
* \param client the configured XMPP client we use to connect to a XMPP server
|
||||
* \param mailbox The mailbox
|
||||
* \param context The context
|
||||
* \param mailbox The mailbox identifier
|
||||
* \param oldmsgs Old messages
|
||||
* \param newmsgs New messages
|
||||
* \return void
|
||||
*/
|
||||
static void aji_publish_mwi(struct aji_client *client, const char *mailbox,
|
||||
const char *context, const char *oldmsgs, const char *newmsgs)
|
||||
const char *oldmsgs, const char *newmsgs)
|
||||
{
|
||||
char full_mailbox[AST_MAX_EXTENSION+AST_MAX_CONTEXT];
|
||||
char eid_str[20];
|
||||
iks *mailbox_node, *request;
|
||||
snprintf(full_mailbox, sizeof(full_mailbox), "%s@%s", mailbox, context);
|
||||
request = aji_build_publish_skeleton(client, full_mailbox, "message_waiting", 1);
|
||||
|
||||
request = aji_build_publish_skeleton(client, mailbox, "message_waiting", 1);
|
||||
ast_eid_to_str(eid_str, sizeof(eid_str), &ast_eid_default);
|
||||
mailbox_node = iks_insert(request, "mailbox");
|
||||
iks_insert_attrib(mailbox_node, "xmlns", "http://asterisk.org");
|
||||
|
@@ -1245,21 +1245,20 @@ static void xmpp_pubsub_create_leaf(struct ast_xmpp_client *client, const char *
|
||||
/*!
|
||||
* \brief Publish MWI to a PubSub node
|
||||
* \param client the configured XMPP client we use to connect to a XMPP server
|
||||
* \param mailbox The Mailbox
|
||||
* \param context The Context
|
||||
* \param mailbox The mailbox identifier
|
||||
* \param oldmsgs Old messages
|
||||
* \param newmsgs New Messages
|
||||
* \return void
|
||||
*/
|
||||
static void xmpp_pubsub_publish_mwi(struct ast_xmpp_client *client, const char *mailbox,
|
||||
const char *context, const char *oldmsgs, const char *newmsgs)
|
||||
const char *oldmsgs, const char *newmsgs)
|
||||
{
|
||||
char full_mailbox[AST_MAX_EXTENSION+AST_MAX_CONTEXT], eid_str[20];
|
||||
char eid_str[20];
|
||||
iks *mailbox_node, *request;
|
||||
|
||||
snprintf(full_mailbox, sizeof(full_mailbox), "%s@%s", mailbox, context);
|
||||
|
||||
if (!(request = xmpp_pubsub_build_publish_skeleton(client, full_mailbox, "message_waiting", AST_DEVSTATE_CACHABLE))) {
|
||||
request = xmpp_pubsub_build_publish_skeleton(client, mailbox, "message_waiting",
|
||||
AST_DEVSTATE_CACHABLE);
|
||||
if (!request) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1321,7 +1320,6 @@ static void xmpp_pubsub_publish_device_state(struct ast_xmpp_client *client, con
|
||||
static void xmpp_pubsub_mwi_cb(void *data, struct stasis_subscription *sub, struct stasis_message *msg)
|
||||
{
|
||||
struct ast_xmpp_client *client = data;
|
||||
const char *mailbox, *context;
|
||||
char oldmsgs[10], newmsgs[10];
|
||||
struct ast_mwi_state *mwi_state;
|
||||
|
||||
@@ -1336,13 +1334,9 @@ static void xmpp_pubsub_mwi_cb(void *data, struct stasis_subscription *sub, stru
|
||||
return;
|
||||
}
|
||||
|
||||
mailbox = mwi_state->mailbox;
|
||||
context = mwi_state->context;
|
||||
snprintf(oldmsgs, sizeof(oldmsgs), "%d",
|
||||
mwi_state->old_msgs);
|
||||
snprintf(newmsgs, sizeof(newmsgs), "%d",
|
||||
mwi_state->new_msgs);
|
||||
xmpp_pubsub_publish_mwi(client, mailbox, context, oldmsgs, newmsgs);
|
||||
snprintf(oldmsgs, sizeof(oldmsgs), "%d", mwi_state->old_msgs);
|
||||
snprintf(newmsgs, sizeof(newmsgs), "%d", mwi_state->new_msgs);
|
||||
xmpp_pubsub_publish_mwi(client, mwi_state->uniqueid, oldmsgs, newmsgs);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
Reference in New Issue
Block a user