[svn-commits] kharwell: branch kharwell/pimp_sip_state r390342 - in /team/kharwell/pimp_sip...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Fri May 31 15:30:35 CDT 2013
Author: kharwell
Date: Fri May 31 15:30:30 2013
New Revision: 390342
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=390342
Log: (empty)
Added:
team/kharwell/pimp_sip_state/include/asterisk/stasis_app_playback.h
- copied unchanged from r390319, team/group/pimp_my_sip/include/asterisk/stasis_app_playback.h
team/kharwell/pimp_sip_state/main/manager_mwi.c
- copied unchanged from r390319, team/group/pimp_my_sip/main/manager_mwi.c
team/kharwell/pimp_sip_state/res/res_sip_refer.c
- copied unchanged from r390319, team/group/pimp_my_sip/res/res_sip_refer.c
team/kharwell/pimp_sip_state/res/res_stasis_playback.c
- copied unchanged from r390319, team/group/pimp_my_sip/res/res_stasis_playback.c
team/kharwell/pimp_sip_state/res/res_stasis_playback.exports.in
- copied unchanged from r390319, team/group/pimp_my_sip/res/res_stasis_playback.exports.in
Modified:
team/kharwell/pimp_sip_state/ (props changed)
team/kharwell/pimp_sip_state/CHANGES
team/kharwell/pimp_sip_state/Makefile
team/kharwell/pimp_sip_state/addons/chan_ooh323.c
team/kharwell/pimp_sip_state/apps/app_chanspy.c
team/kharwell/pimp_sip_state/apps/app_confbridge.c
team/kharwell/pimp_sip_state/apps/app_dial.c
team/kharwell/pimp_sip_state/apps/app_fax.c
team/kharwell/pimp_sip_state/apps/app_followme.c
team/kharwell/pimp_sip_state/apps/app_minivm.c
team/kharwell/pimp_sip_state/apps/app_queue.c
team/kharwell/pimp_sip_state/apps/app_userevent.c
team/kharwell/pimp_sip_state/apps/app_voicemail.c
team/kharwell/pimp_sip_state/apps/confbridge/confbridge_manager.c
team/kharwell/pimp_sip_state/apps/confbridge/include/confbridge.h
team/kharwell/pimp_sip_state/bridges/bridge_builtin_features.c
team/kharwell/pimp_sip_state/channels/chan_dahdi.c
team/kharwell/pimp_sip_state/channels/chan_gulp.c
team/kharwell/pimp_sip_state/channels/chan_h323.c
team/kharwell/pimp_sip_state/channels/chan_iax2.c
team/kharwell/pimp_sip_state/channels/chan_mgcp.c
team/kharwell/pimp_sip_state/channels/chan_misdn.c
team/kharwell/pimp_sip_state/channels/chan_motif.c
team/kharwell/pimp_sip_state/channels/chan_sip.c
team/kharwell/pimp_sip_state/channels/chan_skinny.c
team/kharwell/pimp_sip_state/channels/chan_unistim.c
team/kharwell/pimp_sip_state/channels/sig_analog.c
team/kharwell/pimp_sip_state/channels/sig_pri.c
team/kharwell/pimp_sip_state/channels/sip/include/sip.h
team/kharwell/pimp_sip_state/include/asterisk.h
team/kharwell/pimp_sip_state/include/asterisk/_private.h
team/kharwell/pimp_sip_state/include/asterisk/app.h
team/kharwell/pimp_sip_state/include/asterisk/bridging.h
team/kharwell/pimp_sip_state/include/asterisk/channel.h
team/kharwell/pimp_sip_state/include/asterisk/dial.h
team/kharwell/pimp_sip_state/include/asterisk/json.h
team/kharwell/pimp_sip_state/include/asterisk/manager.h
team/kharwell/pimp_sip_state/include/asterisk/res_sip.h
team/kharwell/pimp_sip_state/include/asterisk/res_sip_session.h
team/kharwell/pimp_sip_state/include/asterisk/security_events.h
team/kharwell/pimp_sip_state/include/asterisk/stasis.h
team/kharwell/pimp_sip_state/include/asterisk/stasis_app.h
team/kharwell/pimp_sip_state/include/asterisk/stasis_bridging.h
team/kharwell/pimp_sip_state/include/asterisk/stasis_channels.h
team/kharwell/pimp_sip_state/include/asterisk/stasis_http.h
team/kharwell/pimp_sip_state/main/app.c
team/kharwell/pimp_sip_state/main/asterisk.c
team/kharwell/pimp_sip_state/main/bridging.c
team/kharwell/pimp_sip_state/main/cdr.c
team/kharwell/pimp_sip_state/main/channel.c
team/kharwell/pimp_sip_state/main/channel_internal_api.c
team/kharwell/pimp_sip_state/main/cli.c
team/kharwell/pimp_sip_state/main/devicestate.c
team/kharwell/pimp_sip_state/main/dial.c
team/kharwell/pimp_sip_state/main/dnsmgr.c
team/kharwell/pimp_sip_state/main/enum.c
team/kharwell/pimp_sip_state/main/features.c
team/kharwell/pimp_sip_state/main/json.c
team/kharwell/pimp_sip_state/main/loader.c
team/kharwell/pimp_sip_state/main/logger.c
team/kharwell/pimp_sip_state/main/manager.c
team/kharwell/pimp_sip_state/main/manager_channels.c
team/kharwell/pimp_sip_state/main/named_acl.c
team/kharwell/pimp_sip_state/main/pbx.c
team/kharwell/pimp_sip_state/main/presencestate.c
team/kharwell/pimp_sip_state/main/security_events.c
team/kharwell/pimp_sip_state/main/slinfactory.c
team/kharwell/pimp_sip_state/main/stasis.c
team/kharwell/pimp_sip_state/main/stasis_bridging.c
team/kharwell/pimp_sip_state/main/stasis_cache.c
team/kharwell/pimp_sip_state/main/stasis_channels.c
team/kharwell/pimp_sip_state/main/stasis_endpoints.c
team/kharwell/pimp_sip_state/main/test.c
team/kharwell/pimp_sip_state/res/parking/parking_bridge.c
team/kharwell/pimp_sip_state/res/parking/parking_manager.c
team/kharwell/pimp_sip_state/res/res_fax.c
team/kharwell/pimp_sip_state/res/res_fax_spandsp.c
team/kharwell/pimp_sip_state/res/res_jabber.c
team/kharwell/pimp_sip_state/res/res_monitor.c
team/kharwell/pimp_sip_state/res/res_musiconhold.c
team/kharwell/pimp_sip_state/res/res_sip.c
team/kharwell/pimp_sip_state/res/res_sip/sip_configuration.c
team/kharwell/pimp_sip_state/res/res_sip_mwi.c
team/kharwell/pimp_sip_state/res/res_sip_sdp_rtp.c
team/kharwell/pimp_sip_state/res/res_sip_session.c
team/kharwell/pimp_sip_state/res/res_sip_session.exports.in
team/kharwell/pimp_sip_state/res/res_stasis.c
team/kharwell/pimp_sip_state/res/res_stasis_http.c
team/kharwell/pimp_sip_state/res/res_stasis_http_channels.c
team/kharwell/pimp_sip_state/res/res_stasis_json_events.c
team/kharwell/pimp_sip_state/res/res_stasis_json_events.exports.in
team/kharwell/pimp_sip_state/res/res_xmpp.c
team/kharwell/pimp_sip_state/res/stasis/control.c
team/kharwell/pimp_sip_state/res/stasis_http/resource_channels.c
team/kharwell/pimp_sip_state/res/stasis_http/resource_channels.h
team/kharwell/pimp_sip_state/res/stasis_http/resource_playback.c
team/kharwell/pimp_sip_state/res/stasis_json/resource_channels.h
team/kharwell/pimp_sip_state/res/stasis_json/resource_events.h
team/kharwell/pimp_sip_state/rest-api/api-docs/channels.json
team/kharwell/pimp_sip_state/rest-api/api-docs/events.json
team/kharwell/pimp_sip_state/rest-api/api-docs/playback.json
Propchange: team/kharwell/pimp_sip_state/
------------------------------------------------------------------------------
automerge = *
Propchange: team/kharwell/pimp_sip_state/
------------------------------------------------------------------------------
--- pimp_sip_state-integrated (original)
+++ pimp_sip_state-integrated Fri May 31 15:30:30 2013
@@ -1,1 +1,1 @@
-/team/group/pimp_my_sip:1-389640
+/team/group/pimp_my_sip:1-390339
Modified: team/kharwell/pimp_sip_state/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_state/CHANGES?view=diff&rev=390342&r1=390341&r2=390342
==============================================================================
--- team/kharwell/pimp_sip_state/CHANGES (original)
+++ team/kharwell/pimp_sip_state/CHANGES Fri May 31 15:30:30 2013
@@ -72,9 +72,39 @@
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 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/kharwell/pimp_sip_state/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_state/Makefile?view=diff&rev=390342&r1=390341&r2=390342
==============================================================================
--- team/kharwell/pimp_sip_state/Makefile (original)
+++ team/kharwell/pimp_sip_state/Makefile Fri May 31 15:30:30 2013
@@ -468,7 +468,7 @@
@echo "<docs xmlns:xi=\"http://www.w3.org/2001/XInclude\">" >> $@
@for x in $(MOD_SUBDIRS); do \
printf "$$x " ; \
- for i in `find $$x -name *.c`; do \
+ for i in `find $$x -name '*.c'`; do \
$(AWK) -f build_tools/get_documentation $$i >> $@ ; \
done ; \
done
Modified: team/kharwell/pimp_sip_state/addons/chan_ooh323.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_state/addons/chan_ooh323.c?view=diff&rev=390342&r1=390341&r2=390342
==============================================================================
--- team/kharwell/pimp_sip_state/addons/chan_ooh323.c (original)
+++ team/kharwell/pimp_sip_state/addons/chan_ooh323.c Fri May 31 15:30:30 2013
@@ -307,6 +307,8 @@
int onCallCleared(ooCallData *call);
void onModeChanged(ooCallData *call, int t38mode);
+extern OOH323EndPoint gH323ep;
+
static char gLogFile[256] = DEFAULT_LOGFILE;
static int gPort = 1720;
static char gIP[2+8*4+7]; /* Max for IPv6 addr */
@@ -642,6 +644,7 @@
ooh323_destroy(p);
ast_mutex_unlock(&iflock);
ast_log(LOG_ERROR, "Destination format is not supported\n");
+ *cause = AST_CAUSE_INVALID_NUMBER_FORMAT;
return NULL;
}
@@ -688,6 +691,10 @@
ast_mutex_unlock(&p->lock);
ooh323_destroy(p);
ast_mutex_unlock(&iflock);
+ return NULL;
+ } else if (gH323ep.gkClient && gH323ep.gkClient->state != GkClientRegistered) {
+ ast_log(LOG_ERROR, "Gatekeeper client is configured but not registered\n");
+ *cause = AST_CAUSE_NORMAL_TEMPORARY_FAILURE;
return NULL;
}
p->g729onlyA = g729onlyA;
@@ -2615,8 +2622,6 @@
static int ooh323_do_reload(void)
{
- extern OOH323EndPoint gH323ep;
-
if (gH323Debug) {
ast_verb(0, "--- ooh323_do_reload\n");
}
@@ -3369,7 +3374,6 @@
static char *handle_cli_ooh323_show_gk(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
char value[FORMAT_STRING_SIZE];
- extern OOH323EndPoint gH323ep;
switch (cmd) {
case CLI_INIT:
Modified: team/kharwell/pimp_sip_state/apps/app_chanspy.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_state/apps/app_chanspy.c?view=diff&rev=390342&r1=390341&r2=390342
==============================================================================
--- team/kharwell/pimp_sip_state/apps/app_chanspy.c (original)
+++ team/kharwell/pimp_sip_state/apps/app_chanspy.c Fri May 31 15:30:30 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/kharwell/pimp_sip_state/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_state/apps/app_confbridge.c?view=diff&rev=390342&r1=390341&r2=390342
==============================================================================
--- team/kharwell/pimp_sip_state/apps/app_confbridge.c (original)
+++ team/kharwell/pimp_sip_state/apps/app_confbridge.c Fri May 31 15:30:30 2013
@@ -415,13 +415,12 @@
return "";
}
-static void send_conf_stasis(struct confbridge_conference *conference, struct ast_channel *chan, const char *type, struct ast_json *extras, int channel_topic)
+static void send_conf_stasis(struct confbridge_conference *conference, struct ast_channel *chan, struct stasis_message_type *type, struct ast_json *extras, int channel_topic)
{
RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
RAII_VAR(struct ast_json *, json_object, NULL, ast_json_unref);
- json_object = ast_json_pack("{s: s, s: s}",
- "type", type,
+ json_object = ast_json_pack("{s: s}",
"conference", conference->name);
if (!json_object) {
@@ -432,10 +431,10 @@
ast_json_object_update(json_object, extras);
}
- msg = ast_bridge_blob_create(confbridge_message_type(),
- conference->bridge,
- chan,
- json_object);
+ msg = ast_bridge_blob_create(type,
+ conference->bridge,
+ chan,
+ json_object);
if (!msg) {
return;
}
@@ -450,42 +449,42 @@
static void send_conf_start_event(struct confbridge_conference *conference)
{
- send_conf_stasis(conference, NULL, "confbridge_start", NULL, 0);
+ send_conf_stasis(conference, NULL, confbridge_start_type(), NULL, 0);
}
static void send_conf_end_event(struct confbridge_conference *conference)
{
- send_conf_stasis(conference, NULL, "confbridge_end", NULL, 0);
+ send_conf_stasis(conference, NULL, confbridge_end_type(), NULL, 0);
}
static void send_join_event(struct ast_channel *chan, struct confbridge_conference *conference)
{
- send_conf_stasis(conference, chan, "confbridge_join", NULL, 0);
+ send_conf_stasis(conference, chan, confbridge_join_type(), NULL, 0);
}
static void send_leave_event(struct ast_channel *chan, struct confbridge_conference *conference)
{
- send_conf_stasis(conference, chan, "confbridge_leave", NULL, 0);
+ send_conf_stasis(conference, chan, confbridge_leave_type(), NULL, 0);
}
static void send_start_record_event(struct confbridge_conference *conference)
{
- send_conf_stasis(conference, NULL, "confbridge_record", NULL, 0);
+ send_conf_stasis(conference, NULL, confbridge_start_record_type(), NULL, 0);
}
static void send_stop_record_event(struct confbridge_conference *conference)
{
- send_conf_stasis(conference, NULL, "confbridge_stop_record", NULL, 0);
+ send_conf_stasis(conference, NULL, confbridge_stop_record_type(), NULL, 0);
}
static void send_mute_event(struct ast_channel *chan, struct confbridge_conference *conference)
{
- send_conf_stasis(conference, chan, "confbridge_mute", NULL, 1);
+ send_conf_stasis(conference, chan, confbridge_mute_type(), NULL, 1);
}
static void send_unmute_event(struct ast_channel *chan, struct confbridge_conference *conference)
{
- send_conf_stasis(conference, chan, "confbridge_unmute", NULL, 1);
+ send_conf_stasis(conference, chan, confbridge_unmute_type(), NULL, 1);
}
static void set_rec_filename(struct confbridge_conference *conference, struct ast_str **filename, int is_new)
@@ -1420,7 +1419,7 @@
return;
}
- send_conf_stasis(conference, bridge_channel->chan, "confbridge_talking", talking_extras, 0);
+ send_conf_stasis(conference, bridge_channel->chan, confbridge_talking_type(), talking_extras, 0);
ast_json_unref(talking_extras);
}
Modified: team/kharwell/pimp_sip_state/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_state/apps/app_dial.c?view=diff&rev=390342&r1=390341&r2=390342
==============================================================================
--- team/kharwell/pimp_sip_state/apps/app_dial.c (original)
+++ team/kharwell/pimp_sip_state/apps/app_dial.c Fri May 31 15:30:30 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/kharwell/pimp_sip_state/apps/app_fax.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_state/apps/app_fax.c?view=diff&rev=390342&r1=390341&r2=390342
==============================================================================
--- team/kharwell/pimp_sip_state/apps/app_fax.c (original)
+++ team/kharwell/pimp_sip_state/apps/app_fax.c Fri May 31 15:30:30 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_blob_create_from_cache(ast_channel_uniqueid(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/kharwell/pimp_sip_state/apps/app_followme.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_state/apps/app_followme.c?view=diff&rev=390342&r1=390341&r2=390342
==============================================================================
--- team/kharwell/pimp_sip_state/apps/app_followme.c (original)
+++ team/kharwell/pimp_sip_state/apps/app_followme.c Fri May 31 15:30:30 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/kharwell/pimp_sip_state/apps/app_minivm.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_state/apps/app_minivm.c?view=diff&rev=390342&r1=390341&r2=390342
==============================================================================
--- team/kharwell/pimp_sip_state/apps/app_minivm.c (original)
+++ team/kharwell/pimp_sip_state/apps/app_minivm.c Fri May 31 15:30:30 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/kharwell/pimp_sip_state/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_state/apps/app_queue.c?view=diff&rev=390342&r1=390341&r2=390342
==============================================================================
--- team/kharwell/pimp_sip_state/apps/app_queue.c (original)
+++ team/kharwell/pimp_sip_state/apps/app_queue.c Fri May 31 15:30:30 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 */
endtime = (long) time(NULL) - starttime;
+ ast_channel_publish_dial(qe->chan, o->chan, on, "NOANSWER");
rna(endtime * 1000, qe, on, membername, 1);
do_hang(o);
if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
@@ -4519,6 +4549,7 @@
if (!f || ((f->frametype == AST_FRAME_CONTROL) && (f->subclass.integer == AST_CONTROL_HANGUP))) {
/* Got hung up */
*to = -1;
+ publish_dial_end_event(in, outgoing, NULL, "CANCEL");
if (f) {
if (f->data.uint32) {
ast_channel_hangupcause_set(in, f->data.uint32);
@@ -4531,6 +4562,7 @@
if ((f->frametype == AST_FRAME_DTMF) && caller_disconnect && (f->subclass.integer == '*')) {
ast_verb(3, "User hit %c to disconnect call.\n", f->subclass.integer);
*to = 0;
+ publish_dial_end_event(in, outgoing, NULL, "CANCEL");
ast_frfree(f);
if (ast_channel_cdr(in) && ast_channel_state(in) != AST_STATE_UP) {
ast_cdr_noanswer(ast_channel_cdr(in));
@@ -4540,6 +4572,7 @@
if ((f->frametype == AST_FRAME_DTMF) && valid_exit(qe, f->subclass.integer)) {
ast_verb(3, "User pressed digit: %c\n", f->subclass.integer);
*to = 0;
+ publish_dial_end_event(in, outgoing, NULL, "CANCEL");
*digit = f->subclass.integer;
[... 12887 lines stripped ...]
More information about the svn-commits
mailing list