[asterisk-commits] file: branch group/pimp_my_sip r389847 - in /team/group/pimp_my_sip: ./ apps/...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue May 28 09:32:40 CDT 2013
Author: file
Date: Tue May 28 09:32:12 2013
New Revision: 389847
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=389847
Log:
Multiple revisions 389492,389505,389519,389551,389567-389569,389587,389603,389609,389618,389623,389639,389663,389680,389733,389738,389746,389748,389770,389785,389799,389813,389827
........
r389492 | qwell | 2013-05-22 15:11:57 -0300 (Wed, 22 May 2013) | 9 lines
Add dial events to app_queue and app_followme.
Also fixes an issue in app_dial, where the channels were swapped on dial events.
(closes issue ASTERISK-21551)
(closes issue ASTERISK-21550)
Review: https://reviewboard.asterisk.org/r/2549/
........
r389505 | qwell | 2013-05-22 15:20:53 -0300 (Wed, 22 May 2013) | 1 line
Remove bad props, before anybody notices.
........
r389519 | dlee | 2013-05-22 16:15:16 -0300 (Wed, 22 May 2013) | 7 lines
Fixed startup race condition which caused occasional stasis_mwi_state_type assertions.
The caching topic (which refers to the message type) was created before the
message type. If the initial subscription message gets processed before
the type can be initialized, the assertion about using an uninitialized type
fires.
........
r389551 | file | 2013-05-23 12:51:05 -0300 (Thu, 23 May 2013) | 2 lines
Fix a bug where the codec order as configured was not being obeyed.
........
r389567 | file | 2013-05-23 15:19:27 -0300 (Thu, 23 May 2013) | 2 lines
Fix a bug with applying the end result of the codec negotiation to the Asterisk channel.
........
r389568 | file | 2013-05-23 15:39:05 -0300 (Thu, 23 May 2013) | 2 lines
Fix a bug where the DTMF mode was not set on newly created RTP instances in the res_sip_sdp_rtp module.
........
r389569 | rmudgett | 2013-05-23 15:40:50 -0300 (Thu, 23 May 2013) | 1 line
Fix inverted test preventing DTMF disconnect from working.
........
r389587 | dlee | 2013-05-23 17:11:35 -0300 (Thu, 23 May 2013) | 18 lines
This patch implements the REST API's for POST /channels/{channelId}/play
and GET /playback/{playbackId}.
This allows an external application to initiate playback of a sound on a
channel while the channel is in the Stasis application.
/play commands are issued asynchronously, and return immediately with
the URL of the associated /playback resource. Playback commands queue up,
playing in succession. The /playback resource shows the state of a
playback operation as enqueued, playing or complete. (Although the
operation will only be in the 'complete' state for a very short time,
since it is almost immediately freed up).
(closes issue ASTERISK-21283)
(closes issue ASTERISK-21586)
Review: https://reviewboard.asterisk.org/r/2531/
........
r389603 | dlee | 2013-05-23 17:21:16 -0300 (Thu, 23 May 2013) | 18 lines
This patch adds support for controlling a playback operation from the
Asterisk REST interface.
This adds the /playback/{playbackId}/control resource, which may be
POSTed to to pause, unpause, reverse, forward or restart the media
playback.
Attempts to control a playback that is not currently playing will
either return a 404 Not Found (because the playback object no longer
exists) or a 409 Conflict (because the playback object is still in the
queue to be played).
This patch also adds skipms and offsetms parameters to the
/channels/{channelId}/play resource.
(closes issue ASTERISK-21587)
Review: https://reviewboard.asterisk.org/r/2559
........
r389609 | file | 2013-05-23 17:25:48 -0300 (Thu, 23 May 2013) | 8 lines
Fix a crash due to the INVITE session being destroyed before the session.
This change ensures that the INVITE session remains valid for the lifetime
of the session object itself by increasing the session count on the dialog that
the INVITE session is allocated from. Once this reaches zero (normally as a result
of decrementing it within the session destructor) the dialog, and INVITE session,
are destroyed.
........
r389618 | jrose | 2013-05-23 17:48:41 -0300 (Thu, 23 May 2013) | 9 lines
res_parking: Fix some simple bugs
Both of them are covered in the dynamic parking review on
https://reviewboard.asterisk.org/r/2550 - Remove unref against
parking lot that the bridge did on dissolve since the reference
wasn't taken in the first place. On a swap, reapply bridge roles
in order to get music on hold and such playing on the channel that
swaps into the bridge.
........
r389623 | jrose | 2013-05-23 18:11:18 -0300 (Thu, 23 May 2013) | 2 lines
res_parking: Add a verbose message when a channel is parked
........
r389639 | dlee | 2013-05-23 18:46:38 -0300 (Thu, 23 May 2013) | 1 line
stasis-http: Provide a response body for 201 created responses
........
r389663 | igorg | 2013-05-24 07:23:48 -0300 (Fri, 24 May 2013) | 10 lines
Fix several problems caused by multiple line usage with i2004 phones.
Reported by: Daniel Bohling, MihaiMircea
(closes issue ASTERISK-21061)
(closes issue ASTERISK-21120)
........
Merged revisions 389661 from http://svn.asterisk.org/svn/asterisk/branches/11
........
r389680 | mjordan | 2013-05-24 08:57:48 -0300 (Fri, 24 May 2013) | 18 lines
Print all logger messages on shutdown
When Asterisk shuts down and shuts down the loggin gsubsystem, any
messages currently in flight will not get logged. This patch prevents the
loop writing messages from breaking out prematurely, such that all of the
messages are logged.
(closes issue ASTERISK-21716)
Reported by: Corey Farrell
patches:
logger-process-all-messages.patch uploaded by Corey Farrell (license 5909)
........
Merged revisions 389676 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 389677 from http://svn.asterisk.org/svn/asterisk/branches/11
........
r389733 | mjordan | 2013-05-24 17:44:07 -0300 (Fri, 24 May 2013) | 20 lines
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)
........
r389738 | kmoore | 2013-05-24 18:01:30 -0300 (Fri, 24 May 2013) | 5 lines
Remove a junk define
BLOB_HANDLER_BUCKETS is a remnant of using "type" fields in
JSON/snapshot blobs and is no longer used.
........
r389746 | qwell | 2013-05-24 18:21:25 -0300 (Fri, 24 May 2013) | 5 lines
Split Hold event into Hold/Unhold, and move it into core.
(closes issue ASTERISK-21487)
Review: https://reviewboard.asterisk.org/r/2565/
........
r389748 | qwell | 2013-05-24 18:23:19 -0300 (Fri, 24 May 2013) | 1 line
grr, props.
........
r389770 | mjordan | 2013-05-25 14:41:25 -0300 (Sat, 25 May 2013) | 4 lines
Restore initialization of security topics
During a merge the security topic initialization got blown away.
This patch restores it.
........
r389785 | mjordan | 2013-05-26 01:47:17 -0300 (Sun, 26 May 2013) | 12 lines
Fix a variety of memory corruption/assertion errors
* Initialize a Stasis-Core message type prior to initializing a caching topic.
The caching topic will attempt to use the message type.
* Don't attempt to publish Stasis-Core messages from remote console connections.
They aren't the main process; they shouldn't attempt to behave as it (they also
don't have the infrastructure to do so)
* Don't treat a JSON object as an ao2 object (whoops)
* In asterisk.c, ref bump the JSON even package that is distributed with the
event meta data. The callers assume that they own the reference, and the packing
routine steals references.
........
r389799 | mjordan | 2013-05-26 13:49:28 -0300 (Sun, 26 May 2013) | 11 lines
Fix a few fax gateway failures
Fax gateway requires knowledge of a channel's peer in a bridge. This patch
now uses the supported mechanisms to get this information.
This is acceptable for a few reasons:
* Fax gateway can only ever work in a 2-party bridge
* Fax gateway cannot work when not in a bridge
* Fax gateway cannot work without knowledge of the capabilities of both
channels in the fax operation (it is, after all, a gateway)
........
r389813 | mjordan | 2013-05-26 21:06:40 -0300 (Sun, 26 May 2013) | 5 lines
Initialize the message type before the topic
Caching topics will during initialization attempt to reference
their message type. The message type therefore has to be
initialized prior to the topic to prevent the dreaded assertion.
........
r389827 | mjordan | 2013-05-26 22:33:12 -0300 (Sun, 26 May 2013) | 14 lines
Fix some more fax test errors due to needing the peer in a bridge
In r389799, a number of fax errors in gateway mode were fixed by using the
appropriate function to get a channel's peer while in a bridge. This patch
does two things:
(1) It uses the same function in res_fax_spandsp while starting the fax
gateway. Without this, the fax gateway will not actually start up, as
res_fax_spandsp also must inspect the channel's peer in a two-party
bridge
(2) It refactors some ao2 objects in sendfax_exec to use RAII_VAR. This was
reverted in r389799 as some off nominal paths were getting hit without
the fix in (1) that indicated an ao2 object issue; this turned out to
be a red herring (which is an odd phrase)
........
Merged revisions 389492,389505,389519,389551,389567-389569,389587,389603,389609,389618,389623,389639,389663,389680,389733,389738,389746,389748,389770,389785,389799,389813,389827 from http://svn.asterisk.org/svn/asterisk/trunk
Added:
team/group/pimp_my_sip/include/asterisk/stasis_app_playback.h
- copied unchanged from r389827, trunk/include/asterisk/stasis_app_playback.h
team/group/pimp_my_sip/main/manager_mwi.c
- copied unchanged from r389827, trunk/main/manager_mwi.c
team/group/pimp_my_sip/res/res_stasis_playback.c
- copied unchanged from r389827, trunk/res/res_stasis_playback.c
team/group/pimp_my_sip/res/res_stasis_playback.exports.in
- copied unchanged from r389827, trunk/res/res_stasis_playback.exports.in
Modified:
team/group/pimp_my_sip/ (props changed)
team/group/pimp_my_sip/CHANGES
team/group/pimp_my_sip/apps/app_chanspy.c
team/group/pimp_my_sip/apps/app_dial.c
team/group/pimp_my_sip/apps/app_fax.c
team/group/pimp_my_sip/apps/app_followme.c
team/group/pimp_my_sip/apps/app_minivm.c
team/group/pimp_my_sip/apps/app_queue.c
team/group/pimp_my_sip/apps/app_voicemail.c
team/group/pimp_my_sip/channels/chan_dahdi.c
team/group/pimp_my_sip/channels/chan_h323.c
team/group/pimp_my_sip/channels/chan_iax2.c
team/group/pimp_my_sip/channels/chan_mgcp.c
team/group/pimp_my_sip/channels/chan_misdn.c
team/group/pimp_my_sip/channels/chan_motif.c
team/group/pimp_my_sip/channels/chan_sip.c
team/group/pimp_my_sip/channels/chan_skinny.c
team/group/pimp_my_sip/channels/chan_unistim.c
team/group/pimp_my_sip/channels/sig_analog.c
team/group/pimp_my_sip/channels/sig_pri.c
team/group/pimp_my_sip/include/asterisk/_private.h
team/group/pimp_my_sip/include/asterisk/app.h
team/group/pimp_my_sip/include/asterisk/channel.h
team/group/pimp_my_sip/include/asterisk/dial.h
team/group/pimp_my_sip/include/asterisk/json.h
team/group/pimp_my_sip/include/asterisk/manager.h
team/group/pimp_my_sip/include/asterisk/stasis_app.h
team/group/pimp_my_sip/include/asterisk/stasis_channels.h
team/group/pimp_my_sip/include/asterisk/stasis_http.h
team/group/pimp_my_sip/main/app.c
team/group/pimp_my_sip/main/asterisk.c
team/group/pimp_my_sip/main/cdr.c
team/group/pimp_my_sip/main/channel.c
team/group/pimp_my_sip/main/channel_internal_api.c
team/group/pimp_my_sip/main/cli.c
team/group/pimp_my_sip/main/devicestate.c
team/group/pimp_my_sip/main/dial.c
team/group/pimp_my_sip/main/dnsmgr.c
team/group/pimp_my_sip/main/enum.c
team/group/pimp_my_sip/main/features.c
team/group/pimp_my_sip/main/json.c
team/group/pimp_my_sip/main/loader.c
team/group/pimp_my_sip/main/logger.c
team/group/pimp_my_sip/main/manager.c
team/group/pimp_my_sip/main/manager_channels.c
team/group/pimp_my_sip/main/pbx.c
team/group/pimp_my_sip/main/stasis_channels.c
team/group/pimp_my_sip/main/stasis_endpoints.c
team/group/pimp_my_sip/res/parking/parking_bridge.c
team/group/pimp_my_sip/res/parking/parking_manager.c
team/group/pimp_my_sip/res/res_fax.c
team/group/pimp_my_sip/res/res_fax_spandsp.c
team/group/pimp_my_sip/res/res_jabber.c
team/group/pimp_my_sip/res/res_monitor.c
team/group/pimp_my_sip/res/res_musiconhold.c
team/group/pimp_my_sip/res/res_sip_mwi.c
team/group/pimp_my_sip/res/res_sip_sdp_rtp.c
team/group/pimp_my_sip/res/res_sip_session.c
team/group/pimp_my_sip/res/res_stasis.c
team/group/pimp_my_sip/res/res_stasis_http.c
team/group/pimp_my_sip/res/res_stasis_http_channels.c
team/group/pimp_my_sip/res/res_stasis_json_events.c
team/group/pimp_my_sip/res/res_stasis_json_events.exports.in
team/group/pimp_my_sip/res/res_xmpp.c
team/group/pimp_my_sip/res/stasis/control.c
team/group/pimp_my_sip/res/stasis_http/resource_channels.c
team/group/pimp_my_sip/res/stasis_http/resource_channels.h
team/group/pimp_my_sip/res/stasis_http/resource_playback.c
team/group/pimp_my_sip/res/stasis_json/resource_channels.h
team/group/pimp_my_sip/res/stasis_json/resource_events.h
team/group/pimp_my_sip/rest-api/api-docs/channels.json
team/group/pimp_my_sip/rest-api/api-docs/events.json
team/group/pimp_my_sip/rest-api/api-docs/playback.json
Propchange: team/group/pimp_my_sip/
------------------------------------------------------------------------------
automerge = *
Propchange: team/group/pimp_my_sip/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.
Propchange: team/group/pimp_my_sip/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue May 28 09:32:12 2013
@@ -1,1 +1,1 @@
-/trunk:1-389456
+/trunk:1-389846
Modified: team/group/pimp_my_sip/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/CHANGES?view=diff&rev=389847&r1=389846&r2=389847
==============================================================================
--- team/group/pimp_my_sip/CHANGES (original)
+++ team/group/pimp_my_sip/CHANGES Tue May 28 09:32:12 2013
@@ -72,9 +72,33 @@
event, the various ChanVariable fields will contain a suffix that specifies
which channel they correspond to.
+ * 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 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/group/pimp_my_sip/apps/app_chanspy.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/apps/app_chanspy.c?view=diff&rev=389847&r1=389846&r2=389847
==============================================================================
--- team/group/pimp_my_sip/apps/app_chanspy.c (original)
+++ team/group/pimp_my_sip/apps/app_chanspy.c Tue May 28 09:32:12 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/group/pimp_my_sip/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/apps/app_dial.c?view=diff&rev=389847&r1=389846&r2=389847
==============================================================================
--- team/group/pimp_my_sip/apps/app_dial.c (original)
+++ team/group/pimp_my_sip/apps/app_dial.c Tue May 28 09:32:12 2013
@@ -66,8 +66,9 @@
#include "asterisk/ccss.h"
#include "asterisk/indications.h"
#include "asterisk/framehook.h"
+#include "asterisk/dial.h"
+#include "asterisk/stasis_channels.h"
#include "asterisk/bridging.h"
-#include "asterisk/stasis_channels.h"
/*** DOCUMENTATION
<application name="Dial" language="en_US">
@@ -1014,9 +1015,15 @@
num->nochan++;
} else {
ast_channel_lock_both(c, in);
- ast_channel_publish_dial(c, in, stuff, NULL);
+ ast_channel_publish_dial(in, c, stuff, NULL);
ast_channel_unlock(in);
ast_channel_unlock(c);
+
+ ast_channel_lock_both(original, in);
+ ast_channel_publish_dial(in, original, NULL, "CANCEL");
+ ast_channel_unlock(in);
+ ast_channel_unlock(original);
+
/* Hangup the original channel now, in case we needed it */
ast_hangup(original);
}
@@ -1034,22 +1041,6 @@
char privintro[1024];
char status[256];
};
-
-static const char *hangup_cause_to_dial_status(int hangup_cause)
-{
- switch(hangup_cause) {
- case AST_CAUSE_BUSY:
- return "BUSY";
- case AST_CAUSE_CONGESTION:
- return "CONGESTION";
- case AST_CAUSE_NO_ROUTE_DESTINATION:
- case AST_CAUSE_UNREGISTERED:
- return "CHANUNAVAIL";
- case AST_CAUSE_NO_ANSWER:
- default:
- return "NOANSWER";
- }
-}
static void publish_dial_end_event(struct ast_channel *in, struct dial_head *out_chans, struct ast_channel *exception, const char *status)
{
@@ -1266,7 +1257,7 @@
#ifdef HAVE_EPOLL
ast_poll_channel_del(in, c);
#endif
- ast_channel_publish_dial(in, c, NULL, hangup_cause_to_dial_status(ast_channel_hangupcause(c)));
+ ast_channel_publish_dial(in, c, NULL, ast_hangup_cause_to_dial_status(ast_channel_hangupcause(c)));
ast_hangup(c);
c = o->chan = NULL;
ast_clear_flag64(o, DIAL_STILLGOING);
@@ -1334,7 +1325,7 @@
case AST_CONTROL_BUSY:
ast_verb(3, "%s is busy\n", ast_channel_name(c));
ast_channel_hangupcause_set(in, ast_channel_hangupcause(c));
- ast_channel_publish_dial(in, c, NULL, hangup_cause_to_dial_status(ast_channel_hangupcause(c)));
+ ast_channel_publish_dial(in, c, NULL, ast_hangup_cause_to_dial_status(ast_channel_hangupcause(c)));
ast_hangup(c);
c = o->chan = NULL;
ast_clear_flag64(o, DIAL_STILLGOING);
@@ -1343,7 +1334,7 @@
case AST_CONTROL_CONGESTION:
ast_verb(3, "%s is circuit-busy\n", ast_channel_name(c));
ast_channel_hangupcause_set(in, ast_channel_hangupcause(c));
- ast_channel_publish_dial(in, c, NULL, hangup_cause_to_dial_status(ast_channel_hangupcause(c)));
+ ast_channel_publish_dial(in, c, NULL, ast_hangup_cause_to_dial_status(ast_channel_hangupcause(c)));
ast_hangup(c);
c = o->chan = NULL;
ast_clear_flag64(o, DIAL_STILLGOING);
Modified: team/group/pimp_my_sip/apps/app_fax.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/apps/app_fax.c?view=diff&rev=389847&r1=389846&r2=389847
==============================================================================
--- team/group/pimp_my_sip/apps/app_fax.c (original)
+++ team/group/pimp_my_sip/apps/app_fax.c Tue May 28 09:32:12 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/group/pimp_my_sip/apps/app_followme.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/apps/app_followme.c?view=diff&rev=389847&r1=389846&r2=389847
==============================================================================
--- team/group/pimp_my_sip/apps/app_followme.c (original)
+++ team/group/pimp_my_sip/apps/app_followme.c Tue May 28 09:32:12 2013
@@ -63,6 +63,7 @@
#include "asterisk/astdb.h"
#include "asterisk/dsp.h"
#include "asterisk/app.h"
+#include "asterisk/stasis_channels.h"
/*** DOCUMENTATION
<application name="FollowMe" language="en_US">
@@ -556,6 +557,17 @@
return 1;
}
+static void publish_dial_end_event(struct ast_channel *in, struct findme_user_listptr *findme_user_list, struct ast_channel *exception, const char *status)
+{
+ struct findme_user *tmpuser;
+
+ AST_LIST_TRAVERSE(findme_user_list, tmpuser, entry) {
+ if (tmpuser->ochan && tmpuser->ochan != exception) {
+ ast_channel_publish_dial(in, tmpuser->ochan, NULL, status);
+ }
+ }
+}
+
static void clear_caller(struct findme_user *tmpuser)
{
struct ast_channel *outbound;
@@ -777,6 +789,7 @@
}
if (!tmpuser) {
ast_verb(3, "The calling channel hungup. Need to drop everyone.\n");
+ publish_dial_end_event(caller, findme_user_list, NULL, "CANCEL");
ast_frfree(f);
return NULL;
}
@@ -788,6 +801,8 @@
break;
}
ast_verb(3, "%s answered %s\n", ast_channel_name(winner), ast_channel_name(caller));
+ ast_channel_publish_dial(caller, winner, NULL, "ANSWER");
+ publish_dial_end_event(caller, findme_user_list, winner, "CANCEL");
tmpuser->answered = 1;
/* If call has been answered, then the eventual hangup is likely to be normal hangup */
ast_channel_hangupcause_set(winner, AST_CAUSE_NORMAL_CLEARING);
@@ -815,6 +830,7 @@
ast_verb(3, "%s is busy\n", ast_channel_name(winner));
if (tmpuser) {
/* Outbound call was busy. Drop it. */
+ ast_channel_publish_dial(caller, winner, NULL, "BUSY");
clear_caller(tmpuser);
}
break;
@@ -822,6 +838,7 @@
ast_verb(3, "%s is circuit-busy\n", ast_channel_name(winner));
if (tmpuser) {
/* Outbound call was congested. Drop it. */
+ ast_channel_publish_dial(caller, winner, NULL, "CONGESTION");
clear_caller(tmpuser);
}
break;
@@ -970,6 +987,7 @@
return NULL;
}
/* Outgoing channel hung up. */
+ ast_channel_publish_dial(caller, winner, NULL, "NOANSWER");
clear_caller(tmpuser);
}
} else {
@@ -1141,7 +1159,10 @@
}
ast_channel_unlock(tmpuser->ochan);
destroy_calling_node(tmpuser);
- }
+ continue;
+ }
+
+ ast_channel_publish_dial(caller, tmpuser->ochan, tmpuser->dialarg, NULL);
}
AST_LIST_TRAVERSE_SAFE_END;
Modified: team/group/pimp_my_sip/apps/app_minivm.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/apps/app_minivm.c?view=diff&rev=389847&r1=389846&r2=389847
==============================================================================
--- team/group/pimp_my_sip/apps/app_minivm.c (original)
+++ team/group/pimp_my_sip/apps/app_minivm.c Tue May 28 09:32:12 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/group/pimp_my_sip/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/group/pimp_my_sip/apps/app_queue.c?view=diff&rev=389847&r1=389846&r2=389847
==============================================================================
--- team/group/pimp_my_sip/apps/app_queue.c (original)
+++ team/group/pimp_my_sip/apps/app_queue.c Tue May 28 09:32:12 2013
@@ -106,6 +106,8 @@
#include "asterisk/cel.h"
#include "asterisk/data.h"
#include "asterisk/term.h"
+#include "asterisk/dial.h"
+#include "asterisk/stasis_channels.h"
#include "asterisk/bridging.h"
/* Define, to debug reference counts on queues, without debugging reference counts on queue members */
@@ -3330,8 +3332,19 @@
ast_free(doomed);
}
+static void publish_dial_end_event(struct ast_channel *in, struct callattempt *outgoing, struct ast_channel *exception, const char *status)
+{
+ struct callattempt *cur;
+
+ for (cur = outgoing; cur; cur = cur->q_next) {
+ if (cur->chan && cur->chan != exception) {
+ ast_channel_publish_dial(in, cur->chan, NULL, status);
+ }
+ }
+}
+
/*! \brief Hang up a list of outgoing calls */
-static void hangupcalls(struct callattempt *outgoing, struct ast_channel *exception, int cancel_answered_elsewhere)
+static void hangupcalls(struct queue_ent *qe, struct callattempt *outgoing, struct ast_channel *exception, int cancel_answered_elsewhere)
{
struct callattempt *oo;
@@ -3342,6 +3355,7 @@
if (exception || cancel_answered_elsewhere) {
ast_channel_hangupcause_set(outgoing->chan, AST_CAUSE_ANSWERED_ELSEWHERE);
}
+ ast_channel_publish_dial(qe->chan, outgoing->chan, outgoing->interface, "CANCEL");
ast_hangup(outgoing->chan);
}
oo = outgoing;
@@ -3712,10 +3726,10 @@
return 0;
}
+ ast_channel_lock_both(tmp->chan, qe->chan);
+
if (qe->parent->eventwhencalled) {
char vars[2048];
-
- ast_channel_lock_both(tmp->chan, qe->chan);
/*** DOCUMENTATION
<managerEventInstance>
@@ -3761,12 +3775,14 @@
S_COR(ast_channel_connected(qe->chan)->id.name.valid, ast_channel_connected(qe->chan)->id.name.str, "unknown"),
ast_channel_context(qe->chan), ast_channel_exten(qe->chan), ast_channel_priority(qe->chan), ast_channel_uniqueid(qe->chan),
qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : "");
-
- ast_channel_unlock(tmp->chan);
- ast_channel_unlock(qe->chan);
-
- ast_verb(3, "Called %s\n", tmp->interface);
- }
+ }
+
+ ast_channel_publish_dial(qe->chan, tmp->chan, tmp->interface, NULL);
+
+ ast_channel_unlock(tmp->chan);
+ ast_channel_unlock(qe->chan);
+
+ ast_verb(3, "Called %s\n", tmp->interface);
member_call_pending_clear(tmp->member);
return 1;
@@ -4334,6 +4350,15 @@
numnochan++;
}
}
+ ast_channel_lock_both(qe->chan, o->chan);
+ ast_channel_publish_dial(qe->chan, o->chan, stuff, NULL);
+ ast_channel_unlock(o->chan);
+ ast_channel_unlock(qe->chan);
+
+ ast_channel_lock_both(qe->chan, original);
+ ast_channel_publish_dial(qe->chan, original, NULL, "CANCEL");
+ ast_channel_unlock(original);
+ ast_channel_unlock(qe->chan);
/* Hangup the original channel now, in case we needed it */
ast_hangup(winner);
continue;
@@ -4346,6 +4371,8 @@
/* This is our guy if someone answered. */
if (!peer) {
ast_verb(3, "%s answered %s\n", ochan_name, inchan_name);
+ ast_channel_publish_dial(qe->chan, o->chan, on, "ANSWER");
+ publish_dial_end_event(qe->chan, outgoing, o->chan, "CANCEL");
if (!o->block_connected_update) {
if (o->pending_connected_update) {
if (ast_channel_connected_line_sub(o->chan, in, &o->connected, 0) &&
@@ -4380,6 +4407,7 @@
if (ast_channel_cdr(in)) {
ast_cdr_busy(ast_channel_cdr(in));
}
+ ast_channel_publish_dial(qe->chan, o->chan, on, "BUSY");
do_hang(o);
endtime = (long) time(NULL);
endtime -= starttime;
@@ -4401,6 +4429,7 @@
if (ast_channel_cdr(in)) {
ast_cdr_failed(ast_channel_cdr(in));
}
+ ast_channel_publish_dial(qe->chan, o->chan, on, "CONGESTION");
endtime = (long) time(NULL);
endtime -= starttime;
rna(endtime * 1000, qe, on, membername, qe->parent->autopauseunavail);
@@ -4498,6 +4527,7 @@
ast_frfree(f);
} else { /* ast_read() returned NULL */
[... 7397 lines stripped ...]
More information about the asterisk-commits
mailing list