[asterisk-commits] mmichelson: branch mmichelson/more_transfer r389852 - in /team/mmichelson/mor...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue May 28 09:54:38 CDT 2013
Author: mmichelson
Date: Tue May 28 09:54:32 2013
New Revision: 389852
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=389852
Log:
Resolve conflicts. Reset automerge.
Modified:
team/mmichelson/more_transfer/ (props changed)
team/mmichelson/more_transfer/CHANGES
team/mmichelson/more_transfer/apps/app_chanspy.c
team/mmichelson/more_transfer/apps/app_fax.c
team/mmichelson/more_transfer/apps/app_minivm.c
team/mmichelson/more_transfer/apps/app_voicemail.c
team/mmichelson/more_transfer/channels/chan_dahdi.c
team/mmichelson/more_transfer/channels/chan_h323.c
team/mmichelson/more_transfer/channels/chan_iax2.c
team/mmichelson/more_transfer/channels/chan_mgcp.c
team/mmichelson/more_transfer/channels/chan_misdn.c
team/mmichelson/more_transfer/channels/chan_motif.c
team/mmichelson/more_transfer/channels/chan_sip.c
team/mmichelson/more_transfer/channels/chan_skinny.c
team/mmichelson/more_transfer/channels/chan_unistim.c
team/mmichelson/more_transfer/channels/sig_analog.c
team/mmichelson/more_transfer/channels/sig_pri.c
team/mmichelson/more_transfer/include/asterisk/_private.h
team/mmichelson/more_transfer/include/asterisk/app.h
team/mmichelson/more_transfer/include/asterisk/bridging.h
team/mmichelson/more_transfer/include/asterisk/channel.h
team/mmichelson/more_transfer/include/asterisk/json.h
team/mmichelson/more_transfer/include/asterisk/manager.h
team/mmichelson/more_transfer/include/asterisk/stasis_channels.h
team/mmichelson/more_transfer/main/app.c
team/mmichelson/more_transfer/main/asterisk.c
team/mmichelson/more_transfer/main/bridging.c
team/mmichelson/more_transfer/main/cdr.c
team/mmichelson/more_transfer/main/channel.c
team/mmichelson/more_transfer/main/cli.c
team/mmichelson/more_transfer/main/devicestate.c
team/mmichelson/more_transfer/main/dnsmgr.c
team/mmichelson/more_transfer/main/enum.c
team/mmichelson/more_transfer/main/features.c
team/mmichelson/more_transfer/main/json.c
team/mmichelson/more_transfer/main/loader.c
team/mmichelson/more_transfer/main/manager.c
team/mmichelson/more_transfer/main/manager_channels.c
team/mmichelson/more_transfer/main/pbx.c
team/mmichelson/more_transfer/main/stasis_channels.c
team/mmichelson/more_transfer/main/stasis_endpoints.c
team/mmichelson/more_transfer/res/parking/parking_manager.c
team/mmichelson/more_transfer/res/res_fax.c
team/mmichelson/more_transfer/res/res_fax_spandsp.c
team/mmichelson/more_transfer/res/res_jabber.c
team/mmichelson/more_transfer/res/res_monitor.c
team/mmichelson/more_transfer/res/res_musiconhold.c
team/mmichelson/more_transfer/res/res_sip_mwi.c
team/mmichelson/more_transfer/res/res_sip_sdp_rtp.c
team/mmichelson/more_transfer/res/res_stasis.c
team/mmichelson/more_transfer/res/res_xmpp.c
Propchange: team/mmichelson/more_transfer/
------------------------------------------------------------------------------
automerge = *
Propchange: team/mmichelson/more_transfer/
------------------------------------------------------------------------------
--- bridge_construction-integrated (original)
+++ bridge_construction-integrated Tue May 28 09:54:32 2013
@@ -1,1 +1,1 @@
-/trunk:1-389680
+/trunk:1-389848
Propchange: team/mmichelson/more_transfer/
------------------------------------------------------------------------------
--- more_transfer-integrated (original)
+++ more_transfer-integrated Tue May 28 09:54:32 2013
@@ -1,1 +1,1 @@
-/team/mmichelson/transfer:1-389719
+/team/mmichelson/transfer:1-389850
Propchange: team/mmichelson/more_transfer/
------------------------------------------------------------------------------
--- transfer-integrated (original)
+++ transfer-integrated Tue May 28 09:54:32 2013
@@ -1,1 +1,1 @@
-/team/group/bridge_construction:1-389687
+/team/group/bridge_construction:1-389849
Modified: team/mmichelson/more_transfer/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/more_transfer/CHANGES?view=diff&rev=389852&r1=389851&r2=389852
==============================================================================
--- team/mmichelson/more_transfer/CHANGES (original)
+++ team/mmichelson/more_transfer/CHANGES Tue May 28 09:54:32 2013
@@ -78,9 +78,39 @@
channels. The old "yes" option is still accepted as a way of playing the
tone to Channel2 only.
+ * All "Reload" events have been consolidated into a single event type. This
+ event will always contain a Module field specifying the name of the module
+ and a Status field denoting the result of the reload. All modules now issue
+ this event when being reloaded.
+
+ * The "ModuleLoadReport" event has been removed. Most AMI connections would
+ fail to receive this event due to being connected after modules have loaded.
+ AMI connections that want to know when Asterisk is ready should listen for
+ the "FullyBooted" event.
+
+ * app_fax now sends the same send fax/receive fax events as res_fax. The
+ "FaxSent" event is now the "SendFAX" event, and the "FaxReceived" event is
+ now the "ReceiveFAX" event.
+
+ * The MusicOnHold event is now two events: MusicOnHoldStart and
+ MusicOnHoldStop. The sub type field has been removed.
+
+ * The JabberEvent event has been removed. It is not AMI's purpose to be a
+ carrier for another protocol.
+
+ * The Bridge Manager action's Playtone header now accepts more fine-grained
+ options. "Channel1" and "Channel2" may be specified in order to play a tone
+ to the specific channel. "Both" may be specified to play a tone to both
+ channels. The old "yes" option is still accepted as a way of playing the
+ tone to Channel2 only.
+
* The AMI 'Status' response event to the AMI Status action replaces the
BridgedChannel and BridgedUniqueid headers with the BridgeID header to
indicate what bridge the channel is currently in.
+
+ * The AMI 'Hold' event has been moved out of individual channel drivers, into
+ core, and is now two events: Hold and Unhold. The status field has been
+ removed.
Channel Drivers
------------------
Modified: team/mmichelson/more_transfer/apps/app_chanspy.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/more_transfer/apps/app_chanspy.c?view=diff&rev=389852&r1=389851&r2=389852
==============================================================================
--- team/mmichelson/more_transfer/apps/app_chanspy.c (original)
+++ team/mmichelson/more_transfer/apps/app_chanspy.c Tue May 28 09:54:32 2013
@@ -55,6 +55,8 @@
#include "asterisk/lock.h"
#include "asterisk/options.h"
#include "asterisk/autochan.h"
+#include "asterisk/stasis_channels.h"
+#include "asterisk/json.h"
#define AST_NAME_STRLEN 256
#define NUM_SPYGROUPS 128
@@ -188,6 +190,8 @@
</description>
<see-also>
<ref type="application">ExtenSpy</ref>
+ <ref type="managerEvent">ChanSpyStart</ref>
+ <ref type="managerEvent">ChanSpyStop</ref>
</see-also>
</application>
<application name="ExtenSpy" language="en_US">
@@ -322,9 +326,10 @@
</description>
<see-also>
<ref type="application">ChanSpy</ref>
+ <ref type="managerEvent">ChanSpyStart</ref>
+ <ref type="managerEvent">ChanSpyStop</ref>
</see-also>
</application>
-
<application name="DAHDIScan" language="en_US">
<synopsis>
Scan DAHDI channels to monitor calls.
@@ -338,6 +343,10 @@
<para>Allows a call center manager to monitor DAHDI channels in a
convenient way. Use <literal>#</literal> to select the next channel and use <literal>*</literal> to exit.</para>
</description>
+ <see-also>
+ <ref type="managerEvent">ChanSpyStart</ref>
+ <ref type="managerEvent">ChanSpyStop</ref>
+ </see-also>
</application>
***/
@@ -512,6 +521,68 @@
}
}
+static int pack_channel_into_message(struct ast_channel *chan, const char *role,
+ struct ast_multi_channel_blob *payload)
+{
+ RAII_VAR(struct ast_channel_snapshot *, snapshot,
+ ast_channel_snapshot_get_latest(ast_channel_uniqueid(chan)),
+ ao2_cleanup);
+
+ if (!snapshot) {
+ return -1;
+ }
+ ast_multi_channel_blob_add_channel(payload, role, snapshot);
+ return 0;
+}
+
+/*! \internal
+ * \brief Publish the chanspy message over Stasis-Core
+ * \param spyer The channel doing the spying
+ * \param spyee Who is being spied upon
+ * \start start If non-zero, the spying is starting. Otherwise, the spyer is
+ * finishing
+ */
+static void publish_chanspy_message(struct ast_channel *spyer,
+ struct ast_channel *spyee,
+ int start)
+{
+ RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
+ RAII_VAR(struct ast_multi_channel_blob *, payload, NULL, ao2_cleanup);
+ RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
+
+ if (!spyer) {
+ ast_log(AST_LOG_WARNING, "Attempt to publish ChanSpy message for NULL spyer channel\n");
+ return;
+ }
+ blob = ast_json_null();
+ if (!blob) {
+ return;
+ }
+
+ payload = ast_multi_channel_blob_create(blob);
+ if (!payload) {
+ return;
+ }
+
+ if (pack_channel_into_message(spyer, "spyer_channel", payload)) {
+ return;
+ }
+
+ if (spyee) {
+ if (pack_channel_into_message(spyee, "spyee_channel", payload)) {
+ return;
+ }
+ }
+
+ message = stasis_message_create(
+ start ? ast_channel_chanspy_start_type(): ast_channel_chanspy_stop_type(),
+ payload);
+ if (!message) {
+ return;
+ }
+ stasis_publish(ast_channel_topic(spyer), message);
+}
+
static int channel_spy(struct ast_channel *chan, struct ast_autochan *spyee_autochan,
int *volfactor, int fd, struct spy_dtmf_options *user_options, struct ast_flags *flags,
char *exitcontext)
@@ -524,38 +595,22 @@
struct ast_silence_generator *silgen = NULL;
struct ast_autochan *spyee_bridge_autochan = NULL;
const char *spyer_name;
- struct ast_channel *chans[] = { chan, spyee_autochan->chan };
+
+ if (ast_check_hangup(chan) || ast_check_hangup(spyee_autochan->chan) ||
+ ast_test_flag(ast_channel_flags(spyee_autochan->chan), AST_FLAG_ZOMBIE)) {
+ return 0;
+ }
ast_channel_lock(chan);
spyer_name = ast_strdupa(ast_channel_name(chan));
ast_channel_unlock(chan);
- /* We now hold the channel lock on spyee */
-
- if (ast_check_hangup(chan) || ast_check_hangup(spyee_autochan->chan) ||
- ast_test_flag(ast_channel_flags(spyee_autochan->chan), AST_FLAG_ZOMBIE)) {
- return 0;
- }
-
ast_channel_lock(spyee_autochan->chan);
name = ast_strdupa(ast_channel_name(spyee_autochan->chan));
ast_channel_unlock(spyee_autochan->chan);
ast_verb(2, "Spying on channel %s\n", name);
- /*** DOCUMENTATION
- <managerEventInstance>
- <synopsis>Raised when a channel has started spying on another channel.</synopsis>
- <see-also>
- <ref type="application">ChanSpy</ref>
- <ref type="application">ExtenSpy</ref>
- <ref type="managerEvent">ChanSpyStop</ref>
- </see-also>
- </managerEventInstance>
- ***/
- ast_manager_event_multichan(EVENT_FLAG_CALL, "ChanSpyStart", 2, chans,
- "SpyerChannel: %s\r\n"
- "SpyeeChannel: %s\r\n",
- spyer_name, name);
+ publish_chanspy_message(chan, spyee_autochan->chan, 1);
memset(&csth, 0, sizeof(csth));
ast_copy_flags(&csth.flags, flags, AST_FLAGS_ALL);
@@ -740,15 +795,7 @@
}
ast_verb(2, "Done Spying on channel %s\n", name);
- /*** DOCUMENTATION
- <managerEventInstance>
- <synopsis>Raised when a channel has stopped spying on another channel.</synopsis>
- <see-also>
- <ref type="managerEvent">ChanSpyStart</ref>
- </see-also>
- </managerEventInstance>
- ***/
- ast_manager_event(chan, EVENT_FLAG_CALL, "ChanSpyStop", "SpyeeChannel: %s\r\n", name);
+ publish_chanspy_message(chan, NULL, 0);
return running;
}
Modified: team/mmichelson/more_transfer/apps/app_fax.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/more_transfer/apps/app_fax.c?view=diff&rev=389852&r1=389851&r2=389852
==============================================================================
--- team/mmichelson/more_transfer/apps/app_fax.c (original)
+++ team/mmichelson/more_transfer/apps/app_fax.c Tue May 28 09:54:32 2013
@@ -43,7 +43,8 @@
#include "asterisk/app.h"
#include "asterisk/dsp.h"
#include "asterisk/module.h"
-#include "asterisk/manager.h"
+#include "asterisk/stasis.h"
+#include "asterisk/stasis_channels.h"
/*** DOCUMENTATION
<application name="SendFAX" language="en_US" module="app_fax">
@@ -202,6 +203,9 @@
static void phase_e_handler(t30_state_t *f, void *user_data, int result)
{
+ RAII_VAR(struct ast_json *, json_object, NULL, ast_json_unref);
+ RAII_VAR(struct ast_json *, json_filenames, NULL, ast_json_unref);
+ RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
const char *local_ident;
const char *far_ident;
char buf[20];
@@ -251,32 +255,24 @@
ast_debug(1, " Image resolution: %d x %d\n", stat.x_resolution, stat.y_resolution);
ast_debug(1, " Transfer Rate: %d\n", stat.bit_rate);
- ast_manager_event(s->chan, EVENT_FLAG_CALL,
- s->direction ? "FaxSent" : "FaxReceived",
- "Channel: %s\r\n"
- "Exten: %s\r\n"
- "CallerID: %s\r\n"
- "CallerIDName: %s\r\n"
- "ConnectedLineNum: %s\r\n"
- "ConnectedLineName: %s\r\n"
- "RemoteStationID: %s\r\n"
- "LocalStationID: %s\r\n"
- "PagesTransferred: %d\r\n"
- "Resolution: %d\r\n"
- "TransferRate: %d\r\n"
- "FileName: %s\r\n",
- ast_channel_name(s->chan),
- ast_channel_exten(s->chan),
- S_COR(ast_channel_caller(s->chan)->id.number.valid, ast_channel_caller(s->chan)->id.number.str, ""),
- S_COR(ast_channel_caller(s->chan)->id.name.valid, ast_channel_caller(s->chan)->id.name.str, ""),
- S_COR(ast_channel_connected(s->chan)->id.number.valid, ast_channel_connected(s->chan)->id.number.str, ""),
- S_COR(ast_channel_connected(s->chan)->id.name.valid, ast_channel_connected(s->chan)->id.name.str, ""),
- far_ident,
- local_ident,
- pages_transferred,
- stat.y_resolution,
- stat.bit_rate,
- s->file_name);
+ json_filenames = ast_json_pack("[s]", s->file_name);
+ if (!json_filenames) {
+ return;
+ }
+ ast_json_ref(json_filenames);
+ json_object = ast_json_pack("{s: s, s: s, s: s, s: i, s: i, s: i, s: o}",
+ "type", s->direction ? "send" : "receive",
+ "remote_station_id", far_ident,
+ "local_station_id", local_ident,
+ "fax_pages", pages_transferred,
+ "fax_resolution", stat.y_resolution,
+ "fax_bitrate", stat.bit_rate,
+ "filenames", json_filenames);
+ message = ast_channel_cached_blob_create(s->chan, ast_channel_fax_type(), json_object);
+ if (!message) {
+ return;
+ }
+ stasis_publish(ast_channel_topic(s->chan), message);
}
/* === Helper functions to configure fax === */
Modified: team/mmichelson/more_transfer/apps/app_minivm.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/more_transfer/apps/app_minivm.c?view=diff&rev=389852&r1=389851&r2=389852
==============================================================================
--- team/mmichelson/more_transfer/apps/app_minivm.c (original)
+++ team/mmichelson/more_transfer/apps/app_minivm.c Tue May 28 09:54:32 2013
@@ -166,14 +166,15 @@
#include "asterisk/say.h"
#include "asterisk/module.h"
#include "asterisk/app.h"
-#include "asterisk/manager.h"
#include "asterisk/dsp.h"
#include "asterisk/localtime.h"
#include "asterisk/cli.h"
#include "asterisk/utils.h"
#include "asterisk/linkedlists.h"
#include "asterisk/callerid.h"
-#include "asterisk/event.h"
+#include "asterisk/stasis.h"
+#include "asterisk/stasis_channels.h"
+#include "asterisk/json.h"
/*** DOCUMENTATION
<application name="MinivmRecord" language="en_US">
@@ -495,7 +496,23 @@
<ref type="function">MINIVMCOUNTER</ref>
</see-also>
</function>
-
+ <managerEvent language="en_US" name="MiniVoiceMail">
+ <managerEventInstance class="EVENT_FLAG_CALL">
+ <synopsis>Raised when a notification is sent out by a MiniVoiceMail application</synopsis>
+ <syntax>
+ <xi:include xpointer="xpointer(/docs/managerEvent[@name='Newchannel']/managerEventInstance/syntax/parameter)" />
+ <parameter name="Action">
+ <para>What action was taken. Currently, this will always be <literal>SentNotification</literal></para>
+ </parameter>
+ <parameter name="Mailbox">
+ <para>The mailbox that the notification was about, specified as <literal>mailbox</literal>@<literal>context</literal></para>
+ </parameter>
+ <parameter name="Counter">
+ <para>A message counter derived from the <literal>MVM_COUNTER</literal> channel variable.</para>
+ </parameter>
+ </syntax>
+ </managerEventInstance>
+ </managerEvent>
***/
#ifndef TRUE
@@ -1761,6 +1778,9 @@
* \brief Send message to voicemail account owner */
static int notify_new_message(struct ast_channel *chan, const char *templatename, struct minivm_account *vmu, const char *filename, long duration, const char *format, char *cidnum, char *cidname)
{
+ RAII_VAR(struct ast_json *, json_object, NULL, ast_json_unref);
+ RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
+ RAII_VAR(struct ast_mwi_state *, mwi_state, NULL, ao2_cleanup);
char *stringp;
struct minivm_template *etemplate;
char *messageformat;
@@ -1826,8 +1846,26 @@
res = sendmail(etemplate, vmu, cidnum, cidname, filename, messageformat, duration, etemplate->attachment, MVM_MESSAGE_PAGE, counter);
}
- ast_manager_event(chan, EVENT_FLAG_CALL, "MiniVoiceMail", "Action: SentNotification\rn\nMailbox: %s@%s\r\nCounter: %s\r\n", vmu->username, vmu->domain, counter);
-
+ mwi_state = ast_mwi_create(vmu->username, vmu->domain);
+ if (!mwi_state) {
+ goto notify_cleanup;
+ }
+ mwi_state->snapshot = ast_channel_snapshot_get_latest(ast_channel_uniqueid(chan));
+
+ json_object = ast_json_pack("{s: s, s: s}",
+ "Event", "MiniVoiceMail"
+ "Action", "SentNotification",
+ "Counter", counter);
+ if (!json_object) {
+ goto notify_cleanup;
+ }
+ message = ast_mwi_blob_create(mwi_state, ast_mwi_vm_app_type(), json_object);
+ if (!message) {
+ goto notify_cleanup;
+ }
+ stasis_publish(ast_mwi_topic(mwi_state->uniqueid), message);
+
+notify_cleanup:
run_externnotify(chan, vmu); /* Run external notification */
if (etemplate->locale) {
@@ -2011,7 +2049,7 @@
/*!\internal
* \brief Queue a message waiting event */
-static void queue_mwi_event(const char *mbx, const char *ctx, int urgent, int new, int old)
+static void queue_mwi_event(const char *channel_id, const char *mbx, const char *ctx, int urgent, int new, int old)
{
char *mailbox, *context;
@@ -2021,7 +2059,7 @@
context = "default";
}
- stasis_publish_mwi_state(mailbox, context, new + urgent, old);
+ ast_publish_mwi_state_channel(mailbox, context, new + urgent, old, channel_id);
}
/*!\internal
@@ -2056,7 +2094,7 @@
ast_log(LOG_ERROR, "Need mailbox at context as argument. Sorry. Argument 0 %s\n", argv[0]);
return -1;
}
- queue_mwi_event(mailbox, domain, atoi(argv[1]), atoi(argv[2]), atoi(argv[3]));
+ queue_mwi_event(ast_channel_uniqueid(chan), mailbox, domain, atoi(argv[1]), atoi(argv[2]), atoi(argv[3]));
return res;
}
@@ -2078,7 +2116,6 @@
const char *filename;
const char *format;
const char *duration_string;
-
if (ast_strlen_zero(data)) {
ast_log(LOG_ERROR, "Minivm needs at least an account argument \n");
return -1;
Modified: team/mmichelson/more_transfer/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/more_transfer/apps/app_voicemail.c?view=diff&rev=389852&r1=389851&r2=389852
==============================================================================
--- team/mmichelson/more_transfer/apps/app_voicemail.c (original)
+++ team/mmichelson/more_transfer/apps/app_voicemail.c Tue May 28 09:54:32 2013
@@ -7741,7 +7741,7 @@
return cmd;
}
-static void queue_mwi_event(const char *box, int urgent, int new, int old)
+static void queue_mwi_event(const char *channel_id, const char *box, int urgent, int new, int old)
{
char *mailbox, *context;
@@ -7752,7 +7752,7 @@
context = "default";
}
- stasis_publish_mwi_state(mailbox, context, new + urgent, old);
+ ast_publish_mwi_state_channel(mailbox, context, new + urgent, old, channel_id);
}
/*!
@@ -7842,32 +7842,7 @@
if (ast_app_has_voicemail(ext_context, NULL))
ast_app_inboxcount2(ext_context, &urgentmsgs, &newmsgs, &oldmsgs);
- queue_mwi_event(ext_context, urgentmsgs, newmsgs, oldmsgs);
-
- /*** DOCUMENTATION
- <managerEventInstance>
- <synopsis>Raised when a new message has been left in a voicemail mailbox.</synopsis>
- <syntax>
- <parameter name="Mailbox">
- <para>The mailbox with the new message, specified as <emphasis>mailbox</emphasis>@<emphasis>context</emphasis></para>
- </parameter>
- <parameter name="Waiting">
- <para>Whether or not the mailbox has access to a voicemail application.</para>
- </parameter>
- <parameter name="New">
- <para>The number of new messages.</para>
- </parameter>
- <parameter name="Old">
- <para>The number of old messages.</para>
- </parameter>
- </syntax>
- </managerEventInstance>
- ***/
- ast_manager_event(chan, EVENT_FLAG_CALL, "MessageWaiting",
- "Mailbox: %s@%s\r\n"
- "Waiting: %d\r\n"
- "New: %d\r\n"
- "Old: %d\r\n", vmu->mailbox, vmu->context, ast_app_has_voicemail(ext_context, NULL), newmsgs, oldmsgs);
+ queue_mwi_event(ast_channel_uniqueid(chan), ext_context, urgentmsgs, newmsgs, oldmsgs);
run_externnotify(vmu->context, vmu->mailbox, flag);
#ifdef IMAP_STORAGE
@@ -11538,16 +11513,10 @@
if (valid) {
int new = 0, old = 0, urgent = 0;
snprintf(ext_context, sizeof(ext_context), "%s@%s", vms.username, vmu->context);
- /*** DOCUMENTATION
- <managerEventInstance>
- <synopsis>Raised when a user has finished listening to their messages.</synopsis>
- </managerEventInstance>
- ***/
- ast_manager_event(chan, EVENT_FLAG_CALL, "MessageWaiting", "Mailbox: %s\r\nWaiting: %d\r\n", ext_context, has_voicemail(ext_context, NULL));
/* Urgent flag not passwd to externnotify here */
run_externnotify(vmu->context, vmu->mailbox, NULL);
ast_app_inboxcount2(ext_context, &urgent, &new, &old);
- queue_mwi_event(ext_context, urgent, new, old);
+ queue_mwi_event(ast_channel_uniqueid(chan), ext_context, urgent, new, old);
}
#ifdef IMAP_STORAGE
/* expunge message - use UID Expunge if supported on IMAP server*/
@@ -11766,7 +11735,7 @@
strcat(mailbox_full, context);
inboxcount2(mailbox_full, &urgent, &new, &old);
- queue_mwi_event(mailbox_full, urgent, new, old);
+ queue_mwi_event(NULL, mailbox_full, urgent, new, old);
return 0;
}
@@ -12502,7 +12471,7 @@
mwi_sub->old_urgent = urgent;
mwi_sub->old_new = new;
mwi_sub->old_old = old;
- queue_mwi_event(mwi_sub->mailbox, urgent, new, old);
+ queue_mwi_event(NULL, mwi_sub->mailbox, urgent, new, old);
run_externnotify(NULL, mwi_sub->mailbox, NULL);
}
}
@@ -12647,7 +12616,7 @@
}
change = stasis_message_data(msg);
- if (change->topic == stasis_mwi_topic_all()) {
+ if (change->topic == ast_mwi_topic_all()) {
return;
}
@@ -12668,10 +12637,10 @@
static void start_poll_thread(void)
{
int errcode;
- mwi_sub_sub = stasis_subscribe(stasis_mwi_topic_all(), mwi_event_cb, NULL);
+ mwi_sub_sub = stasis_subscribe(ast_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_type());
+ struct ao2_container *cached = stasis_cache_dump(ast_mwi_topic_cached(), stasis_subscription_change_type());
if (cached) {
ao2_callback(cached, OBJ_MULTIPLE | OBJ_NODATA, dump_cache, NULL);
}
@@ -15263,7 +15232,7 @@
snprintf(ext_context, sizeof(ext_context), "%s@%s", vmu->mailbox, vmu->context);
run_externnotify(vmu->context, vmu->mailbox, NULL);
ast_app_inboxcount2(ext_context, &urgent, &new, &old);
- queue_mwi_event(ext_context, urgent, new, old);
+ queue_mwi_event(NULL, ext_context, urgent, new, old);
}
static int vm_msg_forward(const char *from_mailbox,
Modified: team/mmichelson/more_transfer/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/more_transfer/channels/chan_dahdi.c?view=diff&rev=389852&r1=389851&r2=389852
==============================================================================
--- team/mmichelson/more_transfer/channels/chan_dahdi.c (original)
+++ team/mmichelson/more_transfer/channels/chan_dahdi.c Tue May 28 09:54:32 2013
@@ -3762,7 +3762,7 @@
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 @@
}
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);
@@ -6560,7 +6560,7 @@
p->owner = p->subs[SUB_REAL].owner;
if (ast_channel_state(p->owner) != AST_STATE_UP)
p->subs[SUB_REAL].needanswer = 1;
- ast_queue_control(p->subs[SUB_REAL].owner, AST_CONTROL_UNHOLD);
+ ast_queue_unhold(p->subs[SUB_REAL].owner);
} else if (p->subs[SUB_THREEWAY].dfd > -1) {
swap_subs(p, SUB_THREEWAY, SUB_REAL);
unalloc_sub(p, SUB_THREEWAY);
@@ -6582,9 +6582,7 @@
/* This is actually part of a three way, placed on hold. Place the third part
on music on hold now */
if (p->subs[SUB_THREEWAY].owner) {
- ast_queue_control_data(p->subs[SUB_THREEWAY].owner, AST_CONTROL_HOLD,
- S_OR(p->mohsuggest, NULL),
- !ast_strlen_zero(p->mohsuggest) ? strlen(p->mohsuggest) + 1 : 0);
+ ast_queue_hold(p->subs[SUB_THREEWAY].owner, p->mohsuggest);
}
p->subs[SUB_THREEWAY].inthreeway = 0;
/* Make it the call wait now */
@@ -6597,9 +6595,7 @@
/* The other party of the three way call is currently in a call-wait state.
Start music on hold for them, and take the main guy out of the third call */
if (p->subs[SUB_CALLWAIT].owner) {
- ast_queue_control_data(p->subs[SUB_CALLWAIT].owner, AST_CONTROL_HOLD,
- S_OR(p->mohsuggest, NULL),
- !ast_strlen_zero(p->mohsuggest) ? strlen(p->mohsuggest) + 1 : 0);
+ ast_queue_hold(p->subs[SUB_CALLWAIT].owner, p->mohsuggest);
}
p->subs[SUB_CALLWAIT].inthreeway = 0;
}
@@ -7851,7 +7847,7 @@
if (ast_bridged_channel(p->subs[SUB_REAL].owner)) {
/* The three-way person we're about to transfer to could still be in MOH, so
stop it now */
- ast_queue_control(p->subs[SUB_THREEWAY].owner, AST_CONTROL_UNHOLD);
+ ast_queue_unhold(p->subs[SUB_THREEWAY].owner);
if (ast_channel_state(p->subs[SUB_REAL].owner) == AST_STATE_RINGING) {
ast_queue_control(p->subs[SUB_REAL].owner, AST_CONTROL_RINGING);
}
@@ -7867,7 +7863,7 @@
ast_channel_unlock(p->subs[SUB_THREEWAY].owner);
unalloc_sub(p, SUB_THREEWAY);
} else if (ast_bridged_channel(p->subs[SUB_THREEWAY].owner)) {
- ast_queue_control(p->subs[SUB_REAL].owner, AST_CONTROL_UNHOLD);
+ ast_queue_unhold(p->subs[SUB_REAL].owner);
if (ast_channel_state(p->subs[SUB_THREEWAY].owner) == AST_STATE_RINGING) {
ast_queue_control(p->subs[SUB_THREEWAY].owner, AST_CONTROL_RINGING);
}
@@ -8535,7 +8531,7 @@
/* Make sure it stops ringing */
dahdi_set_hook(p->subs[idx].dfd, DAHDI_OFFHOOK);
/* Okay -- probably call waiting*/
- ast_queue_control(p->owner, AST_CONTROL_UNHOLD);
+ ast_queue_unhold(p->owner);
p->subs[idx].needunhold = 1;
break;
case AST_STATE_RESERVED:
@@ -8690,14 +8686,10 @@
p->cid_suppress_expire = 0;
/* Start music on hold if appropriate */
if (!p->subs[SUB_CALLWAIT].inthreeway) {
- ast_queue_control_data(p->subs[SUB_CALLWAIT].owner, AST_CONTROL_HOLD,
- S_OR(p->mohsuggest, NULL),
- !ast_strlen_zero(p->mohsuggest) ? strlen(p->mohsuggest) + 1 : 0);
+ ast_queue_hold(p->subs[SUB_CALLWAIT].owner, p->mohsuggest);
}
p->subs[SUB_CALLWAIT].needhold = 1;
- ast_queue_control_data(p->subs[SUB_REAL].owner, AST_CONTROL_HOLD,
- S_OR(p->mohsuggest, NULL),
- !ast_strlen_zero(p->mohsuggest) ? strlen(p->mohsuggest) + 1 : 0);
+ ast_queue_hold(p->subs[SUB_REAL].owner, p->mohsuggest);
p->subs[SUB_REAL].needunhold = 1;
} else if (!p->subs[SUB_THREEWAY].owner) {
if (!p->threewaycalling) {
@@ -8775,9 +8767,7 @@
ast_verb(3, "Started three way call on channel %d\n", p->channel);
/* Start music on hold */
- ast_queue_control_data(p->subs[SUB_THREEWAY].owner, AST_CONTROL_HOLD,
- S_OR(p->mohsuggest, NULL),
- !ast_strlen_zero(p->mohsuggest) ? strlen(p->mohsuggest) + 1 : 0);
+ ast_queue_hold(p->subs[SUB_THREEWAY].owner, p->mohsuggest);
p->subs[SUB_THREEWAY].needhold = 1;
}
ast_callid_threadstorage_auto_clean(callid, callid_created);
@@ -8814,8 +8804,9 @@
swap_subs(p, SUB_THREEWAY, SUB_REAL);
otherindex = SUB_REAL;
}
- if (p->subs[otherindex].owner)
- ast_queue_control(p->subs[otherindex].owner, AST_CONTROL_UNHOLD);
+ if (p->subs[otherindex].owner) {
+ ast_queue_unhold(p->subs[otherindex].owner);
+ }
p->subs[otherindex].needunhold = 1;
p->owner = p->subs[SUB_REAL].owner;
} else {
@@ -8823,8 +8814,9 @@
swap_subs(p, SUB_THREEWAY, SUB_REAL);
ast_channel_softhangup_internal_flag_add(p->subs[SUB_THREEWAY].owner, AST_SOFTHANGUP_DEV);
p->owner = p->subs[SUB_REAL].owner;
- if (p->subs[SUB_REAL].owner)
- ast_queue_control(p->subs[SUB_REAL].owner, AST_CONTROL_UNHOLD);
+ if (p->subs[SUB_REAL].owner) {
+ ast_queue_unhold(p->subs[SUB_REAL].owner);
+ }
p->subs[SUB_REAL].needunhold = 1;
dahdi_enable_ec(p);
}
@@ -9017,8 +9009,9 @@
(res != DAHDI_EVENT_HOOKCOMPLETE)) {
ast_debug(1, "Restoring owner of channel %d on event %d\n", p->channel, res);
p->owner = p->subs[SUB_REAL].owner;
- if (p->owner)
- ast_queue_control(p->owner, AST_CONTROL_UNHOLD);
+ if (p->owner) {
+ ast_queue_unhold(p->owner);
+ }
p->subs[SUB_REAL].needunhold = 1;
}
switch (res) {
@@ -9062,7 +9055,7 @@
p->callwaitingrepeat = 0;
p->cidcwexpire = 0;
p->cid_suppress_expire = 0;
- ast_queue_control(p->owner, AST_CONTROL_UNHOLD);
+ ast_queue_unhold(p->owner);
p->subs[SUB_REAL].needunhold = 1;
} else
ast_log(LOG_WARNING, "Absorbed on hook, but nobody is left!?!?\n");
@@ -10699,7 +10692,7 @@
swap_subs(p, SUB_REAL, SUB_THREEWAY);
unalloc_sub(p, SUB_THREEWAY);
p->owner = p->subs[SUB_REAL].owner;
- ast_queue_control(p->subs[SUB_REAL].owner, AST_CONTROL_UNHOLD);
+ ast_queue_unhold(p->subs[SUB_REAL].owner);
ast_hangup(chan);
goto quit;
} else {
@@ -13235,7 +13228,7 @@
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);
}
Modified: team/mmichelson/more_transfer/channels/chan_h323.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/more_transfer/channels/chan_h323.c?view=diff&rev=389852&r1=389851&r2=389852
==============================================================================
--- team/mmichelson/more_transfer/channels/chan_h323.c (original)
+++ team/mmichelson/more_transfer/channels/chan_h323.c Tue May 28 09:54:32 2013
@@ -2096,18 +2096,17 @@
ast_queue_control(pvt->owner, AST_CONTROL_PROGRESS);
switch (rtp_change) {
case NEED_HOLD:
- ast_queue_control(pvt->owner, AST_CONTROL_HOLD);
+ ast_queue_hold(pvt->owner, NULL);
break;
case NEED_UNHOLD:
- ast_queue_control(pvt->owner, AST_CONTROL_UNHOLD);
+ ast_queue_unhold(pvt->owner);
break;
default:
break;
}
ast_channel_unlock(pvt->owner);
pvt_native = ast_format_cap_destroy(pvt_native);
- }
- else {
+ } else {
if (pvt->options.progress_audio)
pvt->newcontrol = AST_CONTROL_PROGRESS;
else if (rtp_change == NEED_HOLD)
@@ -2599,10 +2598,11 @@
if (!pvt)
return;
if (pvt->owner && !ast_channel_trylock(pvt->owner)) {
- if (is_hold)
- ast_queue_control(pvt->owner, AST_CONTROL_HOLD);
- else
- ast_queue_control(pvt->owner, AST_CONTROL_UNHOLD);
+ if (is_hold) {
+ ast_queue_hold(pvt->owner, NULL);
+ } else {
+ ast_queue_unhold(pvt->owner);
+ }
ast_channel_unlock(pvt->owner);
}
else {
Modified: team/mmichelson/more_transfer/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/more_transfer/channels/chan_iax2.c?view=diff&rev=389852&r1=389851&r2=389852
==============================================================================
--- team/mmichelson/more_transfer/channels/chan_iax2.c (original)
+++ team/mmichelson/more_transfer/channels/chan_iax2.c Tue May 28 09:54:32 2013
@@ -3095,6 +3095,52 @@
}
/*!
+ * \brief Queue a hold frame on the ast_channel owner
+ *
+ * This function queues a hold frame on the owner of the IAX2 pvt struct that
+ * is active for the given call number.
+ *
+ * \pre Assumes lock for callno is already held.
+ *
+ * \note IMPORTANT NOTE!!! Any time this function is used, even if iaxs[callno]
+ * was valid before calling it, it may no longer be valid after calling it.
+ * This function may unlock and lock the mutex associated with this callno,
+ * meaning that another thread may grab it and destroy the call.
+ */
+static int iax2_queue_hold(int callno, const char *musicclass)
+{
+ iax2_lock_owner(callno);
+ if (iaxs[callno] && iaxs[callno]->owner) {
+ ast_queue_hold(iaxs[callno]->owner, musicclass);
+ ast_channel_unlock(iaxs[callno]->owner);
+ }
+ return 0;
+}
+
+/*!
+ * \brief Queue an unhold frame on the ast_channel owner
+ *
+ * This function queues an unhold frame on the owner of the IAX2 pvt struct that
+ * is active for the given call number.
+ *
+ * \pre Assumes lock for callno is already held.
+ *
+ * \note IMPORTANT NOTE!!! Any time this function is used, even if iaxs[callno]
+ * was valid before calling it, it may no longer be valid after calling it.
+ * This function may unlock and lock the mutex associated with this callno,
+ * meaning that another thread may grab it and destroy the call.
+ */
+static int iax2_queue_unhold(int callno)
+{
+ iax2_lock_owner(callno);
+ if (iaxs[callno] && iaxs[callno]->owner) {
+ ast_queue_unhold(iaxs[callno]->owner);
+ ast_channel_unlock(iaxs[callno]->owner);
+ }
+ return 0;
+}
+
+/*!
* \brief Queue a hangup frame on the ast_channel owner
*
* This function queues a hangup frame on the owner of the IAX2 pvt struct that
@@ -3112,30 +3158,6 @@
iax2_lock_owner(callno);
if (iaxs[callno] && iaxs[callno]->owner) {
ast_queue_hangup(iaxs[callno]->owner);
- ast_channel_unlock(iaxs[callno]->owner);
- }
- return 0;
-}
-
-/*!
- * \brief Queue a control frame on the ast_channel owner
- *
- * This function queues a control frame on the owner of the IAX2 pvt struct that
- * is active for the given call number.
- *
- * \pre Assumes lock for callno is already held.
- *
- * \note IMPORTANT NOTE!!! Any time this function is used, even if iaxs[callno]
- * was valid before calling it, it may no longer be valid after calling it.
- * This function may unlock and lock the mutex associated with this callno,
- * meaning that another thread may grab it and destroy the call.
- */
-static int iax2_queue_control_data(int callno,
- enum ast_control_frame_type control, const void *data, size_t datalen)
-{
- iax2_lock_owner(callno);
- if (iaxs[callno] && iaxs[callno]->owner) {
- ast_queue_control_data(iaxs[callno]->owner, control, data, datalen);
ast_channel_unlock(iaxs[callno]->owner);
}
return 0;
@@ -8772,10 +8794,10 @@
}
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 */
@@ -10302,16 +10324,6 @@
break;
case IAX_COMMAND_QUELCH:
if (ast_test_flag(&iaxs[fr->callno]->state, IAX_STATE_STARTED)) {
- /* Generate Manager Hold event, if necessary*/
- if (iaxs[fr->callno]->owner) {
- ast_manager_event(iaxs[fr->callno]->owner, EVENT_FLAG_CALL, "Hold",
- "Status: On\r\n"
- "Channel: %s\r\n"
- "Uniqueid: %s\r\n",
- ast_channel_name(iaxs[fr->callno]->owner),
- ast_channel_uniqueid(iaxs[fr->callno]->owner));
- }
-
ast_set_flag64(iaxs[fr->callno], IAX_QUELCH);
if (ies.musiconhold) {
const char *moh_suggest;
@@ -10326,9 +10338,7 @@
* need to check iaxs[fr->callno] after it returns.
*/
moh_suggest = iaxs[fr->callno]->mohsuggest;
- iax2_queue_control_data(fr->callno, AST_CONTROL_HOLD,
- S_OR(moh_suggest, NULL),
- !ast_strlen_zero(moh_suggest) ? strlen(moh_suggest) + 1 : 0);
+ iax2_queue_hold(fr->callno, moh_suggest);
ast_channel_unlock(iaxs[fr->callno]->owner);
}
}
@@ -10339,15 +10349,6 @@
if (!iaxs[fr->callno]) {
break;
}
- /* Generate Manager Unhold event, if necessary */
- if (iaxs[fr->callno]->owner && ast_test_flag64(iaxs[fr->callno], IAX_QUELCH)) {
- ast_manager_event(iaxs[fr->callno]->owner, EVENT_FLAG_CALL, "Hold",
- "Status: Off\r\n"
- "Channel: %s\r\n"
- "Uniqueid: %s\r\n",
- ast_channel_name(iaxs[fr->callno]->owner),
- ast_channel_uniqueid(iaxs[fr->callno]->owner));
- }
ast_clear_flag64(iaxs[fr->callno], IAX_QUELCH);
if (!iaxs[fr->callno]->owner) {
@@ -10358,7 +10359,7 @@
* We already hold the owner lock so we do not
* need to check iaxs[fr->callno] after it returns.
*/
- iax2_queue_control_data(fr->callno, AST_CONTROL_UNHOLD, NULL, 0);
+ iax2_queue_unhold(fr->callno);
ast_channel_unlock(iaxs[fr->callno]->owner);
}
break;
@@ -12555,7 +12556,7 @@
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);
}
Modified: team/mmichelson/more_transfer/channels/chan_mgcp.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/more_transfer/channels/chan_mgcp.c?view=diff&rev=389852&r1=389851&r2=389852
==============================================================================
--- team/mmichelson/more_transfer/channels/chan_mgcp.c (original)
+++ team/mmichelson/more_transfer/channels/chan_mgcp.c Tue May 28 09:54:32 2013
@@ -507,10 +507,10 @@
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 {
[... 5113 lines stripped ...]
More information about the asterisk-commits
mailing list