[asterisk-commits] dlee: branch dlee/stasis-cache-split r395953 - in /team/dlee/stasis-cache-spl...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Aug 1 08:42:30 CDT 2013
Author: dlee
Date: Thu Aug 1 08:42:27 2013
New Revision: 395953
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=395953
Log:
Merged revisions 395728-395938 from http://svn.asterisk.org/svn/asterisk/trunk
Added:
team/dlee/stasis-cache-split/channels/chan_pjsip.c
- copied unchanged from r395938, trunk/channels/chan_pjsip.c
team/dlee/stasis-cache-split/configs/pjsip.conf.sample
- copied unchanged from r395938, trunk/configs/pjsip.conf.sample
team/dlee/stasis-cache-split/include/asterisk/res_pjsip.h
- copied unchanged from r395938, trunk/include/asterisk/res_pjsip.h
team/dlee/stasis-cache-split/include/asterisk/res_pjsip_exten_state.h
- copied unchanged from r395938, trunk/include/asterisk/res_pjsip_exten_state.h
team/dlee/stasis-cache-split/include/asterisk/res_pjsip_pubsub.h
- copied unchanged from r395938, trunk/include/asterisk/res_pjsip_pubsub.h
team/dlee/stasis-cache-split/include/asterisk/res_pjsip_session.h
- copied unchanged from r395938, trunk/include/asterisk/res_pjsip_session.h
team/dlee/stasis-cache-split/res/res_pjsip/ (props changed)
- copied from r395938, trunk/res/res_pjsip/
team/dlee/stasis-cache-split/res/res_pjsip.c
- copied unchanged from r395938, trunk/res/res_pjsip.c
team/dlee/stasis-cache-split/res/res_pjsip.exports.in
- copied unchanged from r395938, trunk/res/res_pjsip.exports.in
team/dlee/stasis-cache-split/res/res_pjsip_acl.c
- copied unchanged from r395938, trunk/res/res_pjsip_acl.c
team/dlee/stasis-cache-split/res/res_pjsip_authenticator_digest.c
- copied unchanged from r395938, trunk/res/res_pjsip_authenticator_digest.c
team/dlee/stasis-cache-split/res/res_pjsip_caller_id.c
- copied unchanged from r395938, trunk/res/res_pjsip_caller_id.c
team/dlee/stasis-cache-split/res/res_pjsip_diversion.c
- copied unchanged from r395938, trunk/res/res_pjsip_diversion.c
team/dlee/stasis-cache-split/res/res_pjsip_dtmf_info.c
- copied unchanged from r395938, trunk/res/res_pjsip_dtmf_info.c
team/dlee/stasis-cache-split/res/res_pjsip_endpoint_identifier_anonymous.c
- copied unchanged from r395938, trunk/res/res_pjsip_endpoint_identifier_anonymous.c
team/dlee/stasis-cache-split/res/res_pjsip_endpoint_identifier_ip.c
- copied unchanged from r395938, trunk/res/res_pjsip_endpoint_identifier_ip.c
team/dlee/stasis-cache-split/res/res_pjsip_endpoint_identifier_user.c
- copied unchanged from r395938, trunk/res/res_pjsip_endpoint_identifier_user.c
team/dlee/stasis-cache-split/res/res_pjsip_exten_state.c
- copied unchanged from r395938, trunk/res/res_pjsip_exten_state.c
team/dlee/stasis-cache-split/res/res_pjsip_exten_state.exports.in
- copied unchanged from r395938, trunk/res/res_pjsip_exten_state.exports.in
team/dlee/stasis-cache-split/res/res_pjsip_logger.c
- copied unchanged from r395938, trunk/res/res_pjsip_logger.c
team/dlee/stasis-cache-split/res/res_pjsip_messaging.c
- copied unchanged from r395938, trunk/res/res_pjsip_messaging.c
team/dlee/stasis-cache-split/res/res_pjsip_mwi.c
- copied unchanged from r395938, trunk/res/res_pjsip_mwi.c
team/dlee/stasis-cache-split/res/res_pjsip_nat.c
- copied unchanged from r395938, trunk/res/res_pjsip_nat.c
team/dlee/stasis-cache-split/res/res_pjsip_notify.c
- copied unchanged from r395938, trunk/res/res_pjsip_notify.c
team/dlee/stasis-cache-split/res/res_pjsip_one_touch_record_info.c
- copied unchanged from r395938, trunk/res/res_pjsip_one_touch_record_info.c
team/dlee/stasis-cache-split/res/res_pjsip_outbound_authenticator_digest.c
- copied unchanged from r395938, trunk/res/res_pjsip_outbound_authenticator_digest.c
team/dlee/stasis-cache-split/res/res_pjsip_outbound_registration.c
- copied unchanged from r395938, trunk/res/res_pjsip_outbound_registration.c
team/dlee/stasis-cache-split/res/res_pjsip_pidf.c
- copied unchanged from r395938, trunk/res/res_pjsip_pidf.c
team/dlee/stasis-cache-split/res/res_pjsip_pubsub.c
- copied unchanged from r395938, trunk/res/res_pjsip_pubsub.c
team/dlee/stasis-cache-split/res/res_pjsip_pubsub.exports.in
- copied unchanged from r395938, trunk/res/res_pjsip_pubsub.exports.in
team/dlee/stasis-cache-split/res/res_pjsip_refer.c
- copied unchanged from r395938, trunk/res/res_pjsip_refer.c
team/dlee/stasis-cache-split/res/res_pjsip_registrar.c
- copied unchanged from r395938, trunk/res/res_pjsip_registrar.c
team/dlee/stasis-cache-split/res/res_pjsip_registrar_expire.c
- copied unchanged from r395938, trunk/res/res_pjsip_registrar_expire.c
team/dlee/stasis-cache-split/res/res_pjsip_rfc3326.c
- copied unchanged from r395938, trunk/res/res_pjsip_rfc3326.c
team/dlee/stasis-cache-split/res/res_pjsip_sdp_rtp.c
- copied unchanged from r395938, trunk/res/res_pjsip_sdp_rtp.c
team/dlee/stasis-cache-split/res/res_pjsip_session.c
- copied unchanged from r395938, trunk/res/res_pjsip_session.c
team/dlee/stasis-cache-split/res/res_pjsip_session.exports.in
- copied unchanged from r395938, trunk/res/res_pjsip_session.exports.in
team/dlee/stasis-cache-split/res/res_pjsip_t38.c
- copied unchanged from r395938, trunk/res/res_pjsip_t38.c
team/dlee/stasis-cache-split/res/res_pjsip_transport_websocket.c
- copied unchanged from r395938, trunk/res/res_pjsip_transport_websocket.c
Removed:
team/dlee/stasis-cache-split/channels/chan_gulp.c
team/dlee/stasis-cache-split/configs/res_sip.conf.sample
team/dlee/stasis-cache-split/include/asterisk/res_sip.h
team/dlee/stasis-cache-split/include/asterisk/res_sip_exten_state.h
team/dlee/stasis-cache-split/include/asterisk/res_sip_pubsub.h
team/dlee/stasis-cache-split/include/asterisk/res_sip_session.h
team/dlee/stasis-cache-split/res/res_sip/
team/dlee/stasis-cache-split/res/res_sip.c
team/dlee/stasis-cache-split/res/res_sip.exports.in
team/dlee/stasis-cache-split/res/res_sip_acl.c
team/dlee/stasis-cache-split/res/res_sip_authenticator_digest.c
team/dlee/stasis-cache-split/res/res_sip_caller_id.c
team/dlee/stasis-cache-split/res/res_sip_diversion.c
team/dlee/stasis-cache-split/res/res_sip_dtmf_info.c
team/dlee/stasis-cache-split/res/res_sip_endpoint_identifier_anonymous.c
team/dlee/stasis-cache-split/res/res_sip_endpoint_identifier_constant.c
team/dlee/stasis-cache-split/res/res_sip_endpoint_identifier_ip.c
team/dlee/stasis-cache-split/res/res_sip_endpoint_identifier_user.c
team/dlee/stasis-cache-split/res/res_sip_exten_state.c
team/dlee/stasis-cache-split/res/res_sip_exten_state.exports.in
team/dlee/stasis-cache-split/res/res_sip_logger.c
team/dlee/stasis-cache-split/res/res_sip_messaging.c
team/dlee/stasis-cache-split/res/res_sip_mwi.c
team/dlee/stasis-cache-split/res/res_sip_nat.c
team/dlee/stasis-cache-split/res/res_sip_notify.c
team/dlee/stasis-cache-split/res/res_sip_one_touch_record_info.c
team/dlee/stasis-cache-split/res/res_sip_outbound_authenticator_digest.c
team/dlee/stasis-cache-split/res/res_sip_outbound_registration.c
team/dlee/stasis-cache-split/res/res_sip_pidf.c
team/dlee/stasis-cache-split/res/res_sip_pubsub.c
team/dlee/stasis-cache-split/res/res_sip_pubsub.exports.in
team/dlee/stasis-cache-split/res/res_sip_refer.c
team/dlee/stasis-cache-split/res/res_sip_registrar.c
team/dlee/stasis-cache-split/res/res_sip_registrar_expire.c
team/dlee/stasis-cache-split/res/res_sip_rfc3326.c
team/dlee/stasis-cache-split/res/res_sip_sdp_rtp.c
team/dlee/stasis-cache-split/res/res_sip_session.c
team/dlee/stasis-cache-split/res/res_sip_session.exports.in
team/dlee/stasis-cache-split/res/res_sip_transport_websocket.c
Modified:
team/dlee/stasis-cache-split/ (props changed)
team/dlee/stasis-cache-split/CHANGES
team/dlee/stasis-cache-split/bridges/bridge_native_rtp.c
team/dlee/stasis-cache-split/channels/chan_sip.c
team/dlee/stasis-cache-split/main/abstract_jb.c
team/dlee/stasis-cache-split/res/Makefile
team/dlee/stasis-cache-split/res/res_agi.c
team/dlee/stasis-cache-split/res/res_pktccops.c
team/dlee/stasis-cache-split/tests/test_cel.c
Propchange: team/dlee/stasis-cache-split/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Aug 1 08:42:27 2013
@@ -1,1 +1,1 @@
-/trunk:1-395705
+/trunk:1-395952
Modified: team/dlee/stasis-cache-split/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/CHANGES?view=diff&rev=395953&r1=395952&r2=395953
==============================================================================
--- team/dlee/stasis-cache-split/CHANGES (original)
+++ team/dlee/stasis-cache-split/CHANGES Thu Aug 1 08:42:27 2013
@@ -304,6 +304,10 @@
* The manager event AsyncAGI has been split into AsyncAGIStart, AsyncAGIExec,
and AsyncAGIEnd.
+
+ * The CONTROL STREAM FILE command now accepts an offsetms parameter. This
+ will start the playback of the audio at the position specified. It will
+ also return the final position of the file in 'endpos'.
CDR (Call Detail Records)
------------------
Modified: team/dlee/stasis-cache-split/bridges/bridge_native_rtp.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/bridges/bridge_native_rtp.c?view=diff&rev=395953&r1=395952&r2=395953
==============================================================================
--- team/dlee/stasis-cache-split/bridges/bridge_native_rtp.c (original)
+++ team/dlee/stasis-cache-split/bridges/bridge_native_rtp.c Thu Aug 1 08:42:27 2013
@@ -46,46 +46,11 @@
#include "asterisk/frame.h"
#include "asterisk/rtp_engine.h"
-/*! \brief Forward declarations for frame hook usage */
-static int native_rtp_bridge_join(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel);
-static void native_rtp_bridge_leave(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel);
-
/*! \brief Internal structure which contains information about bridged RTP channels */
struct native_rtp_bridge_data {
/*! \brief Framehook used to intercept certain control frames */
int id;
};
-
-/*! \brief Frame hook that is called to intercept hold/unhold */
-static struct ast_frame *native_rtp_framehook(struct ast_channel *chan, struct ast_frame *f, enum ast_framehook_event event, void *data)
-{
- RAII_VAR(struct ast_bridge *, bridge, NULL, ao2_cleanup);
-
- if (!f || (event != AST_FRAMEHOOK_EVENT_WRITE)) {
- return f;
- }
-
- ast_channel_lock(chan);
- bridge = ast_channel_get_bridge(chan);
- ast_channel_unlock(chan);
-
- /* It's safe for NULL to be passed to both of these, bridge_channel isn't used at all */
- if (bridge) {
- if (f->subclass.integer == AST_CONTROL_HOLD) {
- native_rtp_bridge_leave(ast_channel_internal_bridge(chan), NULL);
- } else if ((f->subclass.integer == AST_CONTROL_UNHOLD) || (f->subclass.integer == AST_CONTROL_UPDATE_RTP_PEER)) {
- native_rtp_bridge_join(ast_channel_internal_bridge(chan), NULL);
- }
- }
-
- return f;
-}
-
-/*! \brief Internal helper function which checks whether the channels are compatible with our native bridging */
-static int native_rtp_bridge_capable(struct ast_channel *chan)
-{
- return !ast_channel_has_audio_frame_or_monitor(chan);
-}
/*! \brief Internal helper function which gets all RTP information (glue and instances) relating to the given channels */
static enum ast_rtp_glue_result native_rtp_bridge_get(struct ast_channel *c0, struct ast_channel *c1, struct ast_rtp_glue **glue0,
@@ -140,6 +105,130 @@
}
return audio_glue0_res;
+}
+
+/*! \brief Start RTP native bridging */
+static int native_rtp_bridge_start(struct ast_bridge *bridge)
+{
+ struct ast_bridge_channel *c0 = AST_LIST_FIRST(&bridge->channels);
+ struct ast_bridge_channel *c1 = AST_LIST_LAST(&bridge->channels);
+ enum ast_rtp_glue_result native_type;
+ struct ast_rtp_glue *glue0, *glue1;
+ struct ast_rtp_instance *instance0 = NULL, *instance1 = NULL, *vinstance0 = NULL;
+ struct ast_rtp_instance *vinstance1 = NULL, *tinstance0 = NULL, *tinstance1 = NULL;
+ RAII_VAR(struct ast_format_cap *, cap0, ast_format_cap_alloc_nolock(), ast_format_cap_destroy);
+ RAII_VAR(struct ast_format_cap *, cap1, ast_format_cap_alloc_nolock(), ast_format_cap_destroy);
+
+ if (c0 == c1) {
+ return 0;
+ }
+
+ native_type = native_rtp_bridge_get(c0->chan, c1->chan, &glue0, &glue1, &instance0, &instance1, &vinstance0, &vinstance1);
+
+ if (glue0->get_codec) {
+ glue0->get_codec(c0->chan, cap0);
+ }
+ if (glue1->get_codec) {
+ glue1->get_codec(c1->chan, cap1);
+ }
+
+ switch (native_type) {
+ case AST_RTP_GLUE_RESULT_LOCAL:
+ if (ast_rtp_instance_get_engine(instance0)->local_bridge) {
+ ast_rtp_instance_get_engine(instance0)->local_bridge(instance0, instance1);
+ }
+ if (ast_rtp_instance_get_engine(instance1)->local_bridge) {
+ ast_rtp_instance_get_engine(instance1)->local_bridge(instance1, instance0);
+ }
+ ast_rtp_instance_set_bridged(instance0, instance1);
+ ast_rtp_instance_set_bridged(instance1, instance0);
+ ast_debug(2, "Locally RTP bridged '%s' and '%s' in stack\n",
+ ast_channel_name(c0->chan), ast_channel_name(c1->chan));
+ break;
+
+ case AST_RTP_GLUE_RESULT_REMOTE:
+ glue0->update_peer(c0->chan, instance1, vinstance1, tinstance1, cap1, 0);
+ glue1->update_peer(c1->chan, instance0, vinstance0, tinstance0, cap0, 0);
+ ast_debug(2, "Remotely bridged '%s' and '%s' - media will flow directly between them\n",
+ ast_channel_name(c0->chan), ast_channel_name(c1->chan));
+ break;
+ case AST_RTP_GLUE_RESULT_FORBID:
+ break;
+ }
+
+ return 0;
+}
+
+/*! \brief Stop RTP native bridging */
+static void native_rtp_bridge_stop(struct ast_bridge *bridge)
+{
+ struct ast_bridge_channel *c0 = AST_LIST_FIRST(&bridge->channels);
+ struct ast_bridge_channel *c1 = AST_LIST_LAST(&bridge->channels);
+ enum ast_rtp_glue_result native_type;
+ struct ast_rtp_glue *glue0, *glue1 = NULL;
+ struct ast_rtp_instance *instance0 = NULL, *instance1 = NULL, *vinstance0 = NULL, *vinstance1 = NULL;
+
+ if (c0 == c1) {
+ return;
+ }
+
+ native_type = native_rtp_bridge_get(c0->chan, c1 ? c1->chan : NULL, &glue0, &glue1, &instance0, &instance1, &vinstance0, &vinstance1);
+
+ switch (native_type) {
+ case AST_RTP_GLUE_RESULT_LOCAL:
+ if (ast_rtp_instance_get_engine(instance0)->local_bridge) {
+ ast_rtp_instance_get_engine(instance0)->local_bridge(instance0, NULL);
+ }
+ if (instance1 && ast_rtp_instance_get_engine(instance1)->local_bridge) {
+ ast_rtp_instance_get_engine(instance1)->local_bridge(instance1, NULL);
+ }
+ ast_rtp_instance_set_bridged(instance0, NULL);
+ if (instance1) {
+ ast_rtp_instance_set_bridged(instance1, NULL);
+ }
+ break;
+ case AST_RTP_GLUE_RESULT_REMOTE:
+ glue0->update_peer(c0->chan, NULL, NULL, NULL, NULL, 0);
+ if (glue1) {
+ glue1->update_peer(c1->chan, NULL, NULL, NULL, NULL, 0);
+ }
+ break;
+ case AST_RTP_GLUE_RESULT_FORBID:
+ break;
+ }
+
+ ast_debug(2, "Discontinued RTP bridging of '%s' and '%s' - media will flow through Asterisk core\n",
+ ast_channel_name(c0->chan), ast_channel_name(c1->chan));
+}
+
+/*! \brief Frame hook that is called to intercept hold/unhold */
+static struct ast_frame *native_rtp_framehook(struct ast_channel *chan, struct ast_frame *f, enum ast_framehook_event event, void *data)
+{
+ RAII_VAR(struct ast_bridge *, bridge, NULL, ao2_cleanup);
+
+ if (!f || (event != AST_FRAMEHOOK_EVENT_WRITE)) {
+ return f;
+ }
+
+ ast_channel_lock(chan);
+ bridge = ast_channel_get_bridge(chan);
+ ast_channel_unlock(chan);
+
+ if (bridge) {
+ if (f->subclass.integer == AST_CONTROL_HOLD) {
+ native_rtp_bridge_stop(bridge);
+ } else if ((f->subclass.integer == AST_CONTROL_UNHOLD) || (f->subclass.integer == AST_CONTROL_UPDATE_RTP_PEER)) {
+ native_rtp_bridge_start(bridge);
+ }
+ }
+
+ return f;
+}
+
+/*! \brief Internal helper function which checks whether the channels are compatible with our native bridging */
+static int native_rtp_bridge_capable(struct ast_channel *chan)
+{
+ return !ast_channel_has_audio_frame_or_monitor(chan);
}
static int native_rtp_bridge_compatible(struct ast_bridge *bridge)
@@ -254,15 +343,7 @@
return -1;
}
-/*
- * BUGBUG The RTP native bridge technology should use tech_pvt not bridge_pvt.
- *
- * This technology needs to be reworked to not change the
- * tech_pvt of channels other than the one that is currently
- * entering/leaving before it can actually use the correct
- * pointer.
- */
- bridge_channel->bridge_pvt = data;
+ bridge_channel->tech_pvt = data;
return 0;
}
@@ -270,7 +351,7 @@
/*! \brief Helper function which removes frame hook from bridge channel */
static void native_rtp_bridge_framehook_detach(struct ast_bridge_channel *bridge_channel)
{
- RAII_VAR(struct native_rtp_bridge_data *, data, bridge_channel->bridge_pvt, ao2_cleanup);
+ RAII_VAR(struct native_rtp_bridge_data *, data, bridge_channel->tech_pvt, ao2_cleanup);
if (!data) {
return;
@@ -279,65 +360,17 @@
ast_channel_lock(bridge_channel->chan);
ast_framehook_detach(bridge_channel->chan, data->id);
ast_channel_unlock(bridge_channel->chan);
- bridge_channel->bridge_pvt = NULL;
+ bridge_channel->tech_pvt = NULL;
}
static int native_rtp_bridge_join(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
{
- struct ast_bridge_channel *c0 = AST_LIST_FIRST(&bridge->channels);
- struct ast_bridge_channel *c1 = AST_LIST_LAST(&bridge->channels);
- enum ast_rtp_glue_result native_type;
- struct ast_rtp_glue *glue0, *glue1;
- struct ast_rtp_instance *instance0 = NULL, *instance1 = NULL, *vinstance0 = NULL;
- struct ast_rtp_instance *vinstance1 = NULL, *tinstance0 = NULL, *tinstance1 = NULL;
- RAII_VAR(struct ast_format_cap *, cap0, ast_format_cap_alloc_nolock(), ast_format_cap_destroy);
- RAII_VAR(struct ast_format_cap *, cap1, ast_format_cap_alloc_nolock(), ast_format_cap_destroy);
-
- native_rtp_bridge_framehook_detach(c0);
- if (native_rtp_bridge_framehook_attach(c0)) {
+ native_rtp_bridge_framehook_detach(bridge_channel);
+ if (native_rtp_bridge_framehook_attach(bridge_channel)) {
return -1;
}
- native_rtp_bridge_framehook_detach(c1);
- if (native_rtp_bridge_framehook_attach(c1)) {
- native_rtp_bridge_framehook_detach(c0);
- return -1;
- }
-
- native_type = native_rtp_bridge_get(c0->chan, c1->chan, &glue0, &glue1, &instance0, &instance1, &vinstance0, &vinstance1);
-
- if (glue0->get_codec) {
- glue0->get_codec(c0->chan, cap0);
- }
- if (glue1->get_codec) {
- glue1->get_codec(c1->chan, cap1);
- }
-
- switch (native_type) {
- case AST_RTP_GLUE_RESULT_LOCAL:
- if (ast_rtp_instance_get_engine(instance0)->local_bridge) {
- ast_rtp_instance_get_engine(instance0)->local_bridge(instance0, instance1);
- }
- if (ast_rtp_instance_get_engine(instance1)->local_bridge) {
- ast_rtp_instance_get_engine(instance1)->local_bridge(instance1, instance0);
- }
- ast_rtp_instance_set_bridged(instance0, instance1);
- ast_rtp_instance_set_bridged(instance1, instance0);
- ast_debug(2, "Locally RTP bridged '%s' and '%s' in stack\n",
- ast_channel_name(c0->chan), ast_channel_name(c1->chan));
- break;
-
- case AST_RTP_GLUE_RESULT_REMOTE:
- glue0->update_peer(c0->chan, instance1, vinstance1, tinstance1, cap1, 0);
- glue1->update_peer(c1->chan, instance0, vinstance0, tinstance0, cap0, 0);
- ast_debug(2, "Remotely bridged '%s' and '%s' - media will flow directly between them\n",
- ast_channel_name(c0->chan), ast_channel_name(c1->chan));
- break;
- case AST_RTP_GLUE_RESULT_FORBID:
- break;
- }
-
- return 0;
+ return native_rtp_bridge_start(bridge);
}
static void native_rtp_bridge_unsuspend(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
@@ -347,44 +380,9 @@
static void native_rtp_bridge_leave(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
{
- struct ast_bridge_channel *c0 = AST_LIST_FIRST(&bridge->channels) ? AST_LIST_FIRST(&bridge->channels) : bridge_channel;
- struct ast_bridge_channel *c1 = AST_LIST_LAST(&bridge->channels);
- enum ast_rtp_glue_result native_type;
- struct ast_rtp_glue *glue0, *glue1 = NULL;
- struct ast_rtp_instance *instance0 = NULL, *instance1 = NULL, *vinstance0 = NULL, *vinstance1 = NULL;
-
- native_rtp_bridge_framehook_detach(c0);
- if (c1) {
- native_rtp_bridge_framehook_detach(c1);
- }
-
- native_type = native_rtp_bridge_get(c0->chan, c1 ? c1->chan : NULL, &glue0, &glue1, &instance0, &instance1, &vinstance0, &vinstance1);
-
- switch (native_type) {
- case AST_RTP_GLUE_RESULT_LOCAL:
- if (ast_rtp_instance_get_engine(instance0)->local_bridge) {
- ast_rtp_instance_get_engine(instance0)->local_bridge(instance0, NULL);
- }
- if (instance1 && ast_rtp_instance_get_engine(instance1)->local_bridge) {
- ast_rtp_instance_get_engine(instance1)->local_bridge(instance1, NULL);
- }
- ast_rtp_instance_set_bridged(instance0, instance1);
- if (instance1) {
- ast_rtp_instance_set_bridged(instance1, instance0);
- }
- break;
- case AST_RTP_GLUE_RESULT_REMOTE:
- glue0->update_peer(c0->chan, NULL, NULL, NULL, NULL, 0);
- if (glue1) {
- glue1->update_peer(c1->chan, NULL, NULL, NULL, NULL, 0);
- }
- break;
- case AST_RTP_GLUE_RESULT_FORBID:
- break;
- }
-
- ast_debug(2, "Discontinued RTP bridging of '%s' and '%s' - media will flow through Asterisk core\n",
- ast_channel_name(c0->chan), ast_channel_name(c1->chan));
+ native_rtp_bridge_framehook_detach(bridge_channel);
+
+ native_rtp_bridge_stop(bridge);
}
static int native_rtp_bridge_write(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
Modified: team/dlee/stasis-cache-split/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/channels/chan_sip.c?view=diff&rev=395953&r1=395952&r2=395953
==============================================================================
--- team/dlee/stasis-cache-split/channels/chan_sip.c (original)
+++ team/dlee/stasis-cache-split/channels/chan_sip.c Thu Aug 1 08:42:27 2013
@@ -23667,6 +23667,7 @@
ast_log(LOG_WARNING, "Forbidden - wrong password on authentication for REGISTER for '%s' to '%s'\n", p->registry->username, p->registry->hostname);
AST_SCHED_DEL_UNREF(sched, r->timeout, registry_unref(r, "reg ptr unref from handle_response_register 403"));
r->regstate = REG_STATE_NOAUTH;
+ sip_publish_registry(r->username, r->hostname, regstate2str(r->regstate));
pvt_set_needdestroy(p, "received 403 response");
break;
case 404: /* Not found */
@@ -23675,6 +23676,7 @@
if (r->call)
r->call = dialog_unref(r->call, "unsetting registry->call pointer-- case 404");
r->regstate = REG_STATE_REJECTED;
+ sip_publish_registry(r->username, r->hostname, regstate2str(r->regstate));
AST_SCHED_DEL_UNREF(sched, r->timeout, registry_unref(r, "reg ptr unref from handle_response_register 404"));
break;
case 407: /* Proxy auth */
@@ -23715,6 +23717,7 @@
if (r->call)
r->call = dialog_unref(r->call, "unsetting registry->call pointer-- case 479");
r->regstate = REG_STATE_REJECTED;
+ sip_publish_registry(r->username, r->hostname, regstate2str(r->regstate));
AST_SCHED_DEL_UNREF(sched, r->timeout, registry_unref(r, "reg ptr unref from handle_response_register 479"));
break;
case 200: /* 200 OK */
Modified: team/dlee/stasis-cache-split/main/abstract_jb.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/main/abstract_jb.c?view=diff&rev=395953&r1=395952&r2=395953
==============================================================================
--- team/dlee/stasis-cache-split/main/abstract_jb.c (original)
+++ team/dlee/stasis-cache-split/main/abstract_jb.c Thu Aug 1 08:42:27 2013
@@ -409,7 +409,6 @@
struct ast_jb_conf *jbconf = &jb->conf;
const struct ast_jb_impl *jbimpl = jb->impl;
void *jbobj;
- struct ast_channel *bridged;
long now;
char logfile_pathname[20 + AST_JB_IMPL_NAME_SIZE + 2*AST_CHANNEL_NAME + 1];
char name1[AST_CHANNEL_NAME], name2[AST_CHANNEL_NAME], *tmp;
@@ -442,14 +441,15 @@
/* Create a frame log file */
if (ast_test_flag(jbconf, AST_JB_LOG)) {
+ RAII_VAR(struct ast_channel *, bridged, ast_channel_bridge_peer(chan), ast_channel_cleanup);
char safe_logfile[30] = "/tmp/logfile-XXXXXX";
int safe_fd;
+
snprintf(name2, sizeof(name2), "%s", ast_channel_name(chan));
if ((tmp = strchr(name2, '/'))) {
*tmp = '#';
}
- bridged = ast_bridged_channel(chan);
/* We should always have bridged chan if a jitterbuffer is in use */
ast_assert(bridged != NULL);
Modified: team/dlee/stasis-cache-split/res/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/res/Makefile?view=diff&rev=395953&r1=395952&r2=395953
==============================================================================
--- team/dlee/stasis-cache-split/res/Makefile (original)
+++ team/dlee/stasis-cache-split/res/Makefile Thu Aug 1 08:42:27 2013
@@ -43,8 +43,8 @@
$(if $(filter res_ael_share,$(EMBEDDED_MODS)),modules.link,res_ael_share.so): ael/ael_lex.o ael/ael.tab.o ael/pval.o
ael/ael_lex.o ael/ael.tab.o ael/pval.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_ael_share)
-$(if $(filter res_sip,$(EMBEDDED_MODS)),modules.link,res_sip.so): $(subst .c,.o,$(wildcard res_sip/*.c))
-$(subst .c,.o,$(wildcard res_sip/*.c)): _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_sip)
+$(if $(filter res_pjsip,$(EMBEDDED_MODS)),modules.link,res_pjsip.so): $(subst .c,.o,$(wildcard res_pjsip/*.c))
+$(subst .c,.o,$(wildcard res_pjsip/*.c)): _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_pjsip)
$(if $(filter res_stasis,$(EMBEDDED_MODS)),modules.link,res_stasis.so): $(subst .c,.o,$(wildcard stasis/*.c))
$(subst .c,.o,$(wildcard stasis/*.c)): _ASTCFLAGS+=$(call MOD_ASTCFLAGS,res_stasis)
@@ -74,7 +74,7 @@
clean::
rm -f snmp/*.[oi] ael/*.[oi] ais/*.[oi] ari/*.[oi]
- rm -f res_sip/*.[oi] stasis/*.[oi]
+ rm -f res_pjsip/*.[oi] stasis/*.[oi]
rm -f parking/*.o parking/*.i
$(if $(filter res_parking,$(EMBEDDED_MODS)),modules.link,res_parking.so): $(subst .c,.o,$(wildcard parking/*.c))
Modified: team/dlee/stasis-cache-split/res/res_agi.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/res/res_agi.c?view=diff&rev=395953&r1=395952&r2=395953
==============================================================================
--- team/dlee/stasis-cache-split/res/res_agi.c (original)
+++ team/dlee/stasis-cache-split/res/res_agi.c Thu Aug 1 08:42:27 2013
@@ -155,13 +155,19 @@
<para>Defaults to <literal>#</literal></para>
</parameter>
<parameter name="pausechr" />
+ <parameter name="offsetms">
+ <para>Offset, in milliseconds, to start the audio playback</para>
+ </parameter>
</syntax>
<description>
<para>Send the given file, allowing playback to be controlled by the given
digits, if any. Use double quotes for the digits if you wish none to be
- permitted. Returns <literal>0</literal> if playback completes without a digit
+ permitted. If offsetms is provided then the audio will seek to offsetms
+ before play starts. Returns <literal>0</literal> if playback completes without a digit
being pressed, or the ASCII numerical value of the digit if one was pressed,
- or <literal>-1</literal> on error or if the channel was disconnected.</para>
+ or <literal>-1</literal> on error or if the channel was disconnected. Returns the
+ position where playback was terminated as endpos.</para>
+
<para>It sets the following channel variables upon completion:</para>
<variablelist>
<variable name="CPLAYBACKSTATUS">
@@ -368,9 +374,9 @@
</parameter>
</syntax>
<description>
- <para>Receives a string of text on a channel. Most channels
+ <para>Receives a string of text on a channel. Most channels
do not support the reception of text. Returns <literal>-1</literal> for failure
- or <literal>1</literal> for success, and the string in parenthesis.</para>
+ or <literal>1</literal> for success, and the string in parenthesis.</para>
</description>
</agi>
<agi name="record file" language="en_US">
@@ -2092,7 +2098,7 @@
long offsetms = 0;
char offsetbuf[20];
- if (argc < 5 || argc > 9) {
+ if (argc < 5 || argc > 10) {
return RESULT_SHOWUSAGE;
}
@@ -2116,7 +2122,11 @@
suspend = argv[8];
}
- res = ast_control_streamfile(chan, argv[3], fwd, rev, stop, suspend, NULL, skipms, NULL);
+ if (argc > 9 && (sscanf(argv[9], "%30ld", &offsetms) != 1)) {
+ return RESULT_SHOWUSAGE;
+ }
+
+ res = ast_control_streamfile(chan, argv[3], fwd, rev, stop, suspend, NULL, skipms, &offsetms);
/* If we stopped on one of our stop keys, return 0 */
if (res > 0 && stop && strchr(stop, res)) {
@@ -2137,7 +2147,7 @@
snprintf(offsetbuf, sizeof(offsetbuf), "%ld", offsetms);
pbx_builtin_setvar_helper(chan, "CPLAYBACKOFFSET", offsetbuf);
- ast_agi_send(agi->fd, chan, "200 result=%d\n", res);
+ ast_agi_send(agi->fd, chan, "200 result=%d endpos=%ld\n", res, offsetms);
return (res >= 0) ? RESULT_SUCCESS : RESULT_FAILURE;
}
@@ -2518,7 +2528,7 @@
}
ast_dsp_set_threshold(sildet, ast_dsp_get_threshold_from_settings(THRESHOLD_SILENCE));
}
-
+
/* backward compatibility, if no offset given, arg[6] would have been
* caught below and taken to be a beep, else if it is a digit then it is a
* offset */
@@ -2881,7 +2891,7 @@
break;
}
} while (1);
-
+
if (res)
ast_agi_send(agi->fd, chan, "200 result=0\n");
else
@@ -3294,15 +3304,15 @@
{ { "noop", NULL }, handle_noop, NULL, NULL, 1 },
{ { "receive", "char", NULL }, handle_recvchar, NULL, NULL, 0 },
{ { "receive", "text", NULL }, handle_recvtext, NULL, NULL, 0 },
- { { "record", "file", NULL }, handle_recordfile, NULL, NULL, 0 },
+ { { "record", "file", NULL }, handle_recordfile, NULL, NULL, 0 },
{ { "say", "alpha", NULL }, handle_sayalpha, NULL, NULL, 0},
{ { "say", "digits", NULL }, handle_saydigits, NULL, NULL, 0 },
{ { "say", "number", NULL }, handle_saynumber, NULL, NULL, 0 },
- { { "say", "phonetic", NULL }, handle_sayphonetic, NULL, NULL, 0},
- { { "say", "date", NULL }, handle_saydate, NULL, NULL, 0},
- { { "say", "time", NULL }, handle_saytime, NULL, NULL, 0},
+ { { "say", "phonetic", NULL }, handle_sayphonetic, NULL, NULL, 0},
+ { { "say", "date", NULL }, handle_saydate, NULL, NULL, 0},
+ { { "say", "time", NULL }, handle_saytime, NULL, NULL, 0},
{ { "say", "datetime", NULL }, handle_saydatetime, NULL, NULL, 0},
- { { "send", "image", NULL }, handle_sendimage, NULL, NULL, 0},
+ { { "send", "image", NULL }, handle_sendimage, NULL, NULL, 0},
{ { "send", "text", NULL }, handle_sendtext, NULL, NULL, 0},
{ { "set", "autohangup", NULL }, handle_autohangup, NULL, NULL, 0},
{ { "set", "callerid", NULL }, handle_setcallerid, NULL, NULL, 0},
@@ -3706,7 +3716,7 @@
const char *sighup_str;
const char *exit_on_hangup_str;
int exit_on_hangup;
-
+
ast_channel_lock(chan);
sighup_str = pbx_builtin_getvar_helper(chan, "AGISIGHUP");
send_sighup = !ast_false(sighup_str);
@@ -3721,7 +3731,7 @@
close(agi->ctrl);
return AGI_RESULT_FAILURE;
}
-
+
setlinebuf(readf);
setup_env(chan, request, agi->fd, (agi->audio > -1), argc, argv);
for (;;) {
Propchange: team/dlee/stasis-cache-split/res/res_pjsip/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Aug 1 08:42:27 2013
@@ -1,0 +1,2 @@
+*.i
+*.o
Modified: team/dlee/stasis-cache-split/res/res_pktccops.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/res/res_pktccops.c?view=diff&rev=395953&r1=395952&r2=395953
==============================================================================
--- team/dlee/stasis-cache-split/res/res_pktccops.c (original)
+++ team/dlee/stasis-cache-split/res/res_pktccops.c Thu Aug 1 08:42:27 2013
@@ -1347,7 +1347,7 @@
if (a->argc < 9)
return CLI_SHOWUSAGE;
- if (!strncmp(a->argv[2], "null", sizeof(a->argv[2]))) {
+ if (!strcmp(a->argv[2], "null")) {
cmts = NULL;
} else {
AST_LIST_LOCK(&cmts_list);
Modified: team/dlee/stasis-cache-split/tests/test_cel.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/tests/test_cel.c?view=diff&rev=395953&r1=395952&r2=395953
==============================================================================
--- team/dlee/stasis-cache-split/tests/test_cel.c (original)
+++ team/dlee/stasis-cache-split/tests/test_cel.c Thu Aug 1 08:42:27 2013
@@ -61,6 +61,18 @@
/*! \brief The CEL config used for CEL unit tests */
static struct ast_cel_general_config *cel_test_config;
+/*! \brief Lock used for synchronizing test execution stages with received events */
+ast_mutex_t mid_test_sync_lock;
+
+/*! \brief Lock used with sync_out for checking the end of test execution */
+ast_mutex_t sync_lock;
+
+/*! \brief Condition used for checking the end of test execution */
+ast_cond_t sync_out;
+
+/*! \brief Flag used to trigger a mid-test synchronization, access controlled by mid_test_sync_lock */
+int do_mid_test_sync = 0;
+
/*! \brief A channel technology used for the unit tests */
static struct ast_channel_tech test_cel_chan_tech = {
.type = CHANNEL_TECH_NAME,
@@ -96,6 +108,7 @@
#define CONF_EXIT(channel, bridge) do { \
ast_test_validate(test, 0 == ast_bridge_depart(channel)); \
CONF_EXIT_EVENT(channel, bridge); \
+ mid_test_sync(); \
} while (0)
#define CONF_EXIT_EVENT(channel, bridge) do { \
@@ -228,6 +241,8 @@
APPEND_EVENT(channel, AST_CEL_HANGUP, NULL, extra, NULL); \
} while (0)
+static void mid_test_sync(void);
+
static int append_expected_event(
struct ast_channel *chan,
enum ast_cel_event_type type,
@@ -545,6 +560,10 @@
return AST_TEST_PASS;
}
+/* XXX Validation needs to be reworked on a per-channel basis before
+ * test_cel_single_multiparty_bridge and test_cel_dial_answer_multiparty
+ * can operate properly. */
+#if 0
AST_TEST_DEFINE(test_cel_single_multiparty_bridge)
{
RAII_VAR(struct ast_channel *, chan_alice, NULL, safe_channel_release);
@@ -598,11 +617,8 @@
BRIDGE_TO_CONF(chan_alice, chan_bob, chan_charlie, bridge);
CONF_EXIT(chan_alice, bridge);
- do_sleep();
CONF_EXIT(chan_bob, bridge);
- do_sleep();
CONF_EXIT(chan_charlie, bridge);
- do_sleep();
HANGUP_CHANNEL(chan_alice, AST_CAUSE_NORMAL, "");
HANGUP_CHANNEL(chan_bob, AST_CAUSE_NORMAL, "");
@@ -610,6 +626,7 @@
return AST_TEST_PASS;
}
+#endif
#define EMULATE_DIAL(channel, dialstring) do { \
EMULATE_APP_DATA(channel, 1, "Dial", dialstring); \
@@ -1001,6 +1018,7 @@
return AST_TEST_PASS;
}
+#if 0
AST_TEST_DEFINE(test_cel_dial_answer_multiparty)
{
RAII_VAR(struct ast_channel *, chan_alice, NULL, safe_channel_release);
@@ -1073,11 +1091,8 @@
CONF_ENTER_EVENT(chan_alice, bridge);
CONF_EXIT(chan_alice, bridge);
- do_sleep();
CONF_EXIT(chan_bob, bridge);
- do_sleep();
CONF_EXIT(chan_charlie, bridge);
- do_sleep();
CONF_EXIT(chan_david, bridge);
HANGUP_CHANNEL(chan_alice, AST_CAUSE_NORMAL, "ANSWER");
@@ -1087,6 +1102,7 @@
return AST_TEST_PASS;
}
+#endif
AST_TEST_DEFINE(test_cel_blind_transfer)
{
@@ -1213,10 +1229,8 @@
do_sleep();
CONF_EXIT(chan_bob, bridge2);
- do_sleep();
CONF_EXIT(chan_charlie, bridge2);
- do_sleep();
HANGUP_CHANNEL(chan_alice, AST_CAUSE_NORMAL, "");
do_sleep();
HANGUP_CHANNEL(chan_bob, AST_CAUSE_NORMAL, "");
@@ -1301,10 +1315,8 @@
do_sleep();
CONF_EXIT(chan_bob, bridge1);
- do_sleep();
CONF_EXIT(chan_charlie, bridge1);
- do_sleep();
HANGUP_CHANNEL(chan_alice, AST_CAUSE_NORMAL, "");
do_sleep();
HANGUP_CHANNEL(chan_bob, AST_CAUSE_NORMAL, "");
@@ -1412,10 +1424,8 @@
do_sleep();
CONF_EXIT(chan_bob, bridge1);
- do_sleep();
CONF_EXIT(chan_charlie, bridge2);
- do_sleep();
HANGUP_CHANNEL(chan_alice, AST_CAUSE_NORMAL, "");
do_sleep();
HANGUP_CHANNEL(chan_bob, AST_CAUSE_NORMAL, "");
@@ -1559,6 +1569,29 @@
return event_dup;
}
+static void mid_test_sync(void)
+{
+ ast_mutex_lock(&mid_test_sync_lock);
+ if (ao2_container_count(cel_expected_events) <= ao2_container_count(cel_received_events)) {
+ ast_mutex_unlock(&mid_test_sync_lock);
+ return;
+ }
+
+ do_mid_test_sync = 1;
+ ast_mutex_unlock(&mid_test_sync_lock);
+
+ {
+ struct timeval start = ast_tvnow();
+ struct timespec end = {
+ .tv_sec = start.tv_sec + 15,
+ .tv_nsec = start.tv_usec * 1000
+ };
+
+ SCOPED_MUTEX(lock, &sync_lock);
+ ast_cond_timedwait(&sync_out, &sync_lock, &end);
+ }
+}
+
static int append_event(struct ast_event *ev)
{
RAII_VAR(struct ast_event *, ao2_ev, NULL, ao2_cleanup);
@@ -1614,13 +1647,12 @@
return append_expected_event_snapshot(snapshot, type, userdefevname, extra, peer);
}
-ast_mutex_t sync_lock;
-ast_cond_t sync_out;
-
static void test_sub(const struct ast_event *event, void *data)
{
struct ast_event *event_dup = ao2_dup_event(event);
const char *sync_tag;
+ SCOPED_MUTEX(mid_test_lock, &mid_test_sync_lock);
+
if (!event_dup) {
return;
}
@@ -1634,8 +1666,21 @@
return;
}
}
+
/* save the event for later processing */
ao2_link(cel_received_events, event_dup);
+
+ if (do_mid_test_sync) {
+ int expected = ao2_container_count(cel_expected_events);
+ int received = ao2_container_count(cel_received_events);
+ if (expected <= received) {
+ {
+ SCOPED_MUTEX(lock, &sync_lock);
+ ast_cond_signal(&sync_out);
+ do_mid_test_sync = 0;
+ }
+ }
+ }
}
/*!
@@ -1647,6 +1692,7 @@
ast_assert(cel_received_events == NULL);
ast_assert(cel_expected_events == NULL);
+ ast_mutex_init(&mid_test_sync_lock);
ast_mutex_init(&sync_lock);
ast_cond_init(&sync_out, NULL);
@@ -1886,7 +1932,7 @@
} else {
struct timeval start = ast_tvnow();
struct timespec end = {
- .tv_sec = start.tv_sec + 30,
+ .tv_sec = start.tv_sec + 15,
.tv_nsec = start.tv_usec * 1000
};
@@ -1912,6 +1958,7 @@
/* clean up the locks */
ast_mutex_destroy(&sync_lock);
+ ast_mutex_destroy(&mid_test_sync_lock);
ast_cond_destroy(&sync_out);
return 0;
}
@@ -1926,7 +1973,7 @@
AST_TEST_UNREGISTER(test_cel_single_bridge_continue);
AST_TEST_UNREGISTER(test_cel_single_twoparty_bridge_a);
AST_TEST_UNREGISTER(test_cel_single_twoparty_bridge_b);
- AST_TEST_UNREGISTER(test_cel_single_multiparty_bridge);
+ /*AST_TEST_UNREGISTER(test_cel_single_multiparty_bridge);*/
AST_TEST_UNREGISTER(test_cel_dial_unanswered);
AST_TEST_UNREGISTER(test_cel_dial_congestion);
@@ -1937,7 +1984,7 @@
AST_TEST_UNREGISTER(test_cel_dial_answer_no_bridge);
AST_TEST_UNREGISTER(test_cel_dial_answer_twoparty_bridge_a);
AST_TEST_UNREGISTER(test_cel_dial_answer_twoparty_bridge_b);
- AST_TEST_UNREGISTER(test_cel_dial_answer_multiparty);
+ /*AST_TEST_UNREGISTER(test_cel_dial_answer_multiparty);*/
AST_TEST_UNREGISTER(test_cel_blind_transfer);
AST_TEST_UNREGISTER(test_cel_attended_transfer_bridges_swap);
@@ -1999,7 +2046,7 @@
AST_TEST_REGISTER(test_cel_single_bridge_continue);
AST_TEST_REGISTER(test_cel_single_twoparty_bridge_a);
AST_TEST_REGISTER(test_cel_single_twoparty_bridge_b);
- AST_TEST_REGISTER(test_cel_single_multiparty_bridge);
+ /*AST_TEST_REGISTER(test_cel_single_multiparty_bridge);*/
AST_TEST_REGISTER(test_cel_dial_unanswered);
AST_TEST_REGISTER(test_cel_dial_congestion);
@@ -2010,7 +2057,7 @@
AST_TEST_REGISTER(test_cel_dial_answer_no_bridge);
AST_TEST_REGISTER(test_cel_dial_answer_twoparty_bridge_a);
AST_TEST_REGISTER(test_cel_dial_answer_twoparty_bridge_b);
- AST_TEST_REGISTER(test_cel_dial_answer_multiparty);
+ /*AST_TEST_REGISTER(test_cel_dial_answer_multiparty);*/
AST_TEST_REGISTER(test_cel_blind_transfer);
AST_TEST_REGISTER(test_cel_attended_transfer_bridges_swap);
More information about the asterisk-commits
mailing list