[asterisk-commits] kmoore: branch kmoore/cel_backend_refactor r395927 - in /team/kmoore/cel_back...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jul 31 22:12:01 CDT 2013


Author: kmoore
Date: Wed Jul 31 22:11:59 2013
New Revision: 395927

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=395927
Log:
Pull in changes up to trunk

Removed:
    team/kmoore/cel_backend_refactor/res/res_pjsip_endpoint_identifier_constant.c
Modified:
    team/kmoore/cel_backend_refactor/   (props changed)
    team/kmoore/cel_backend_refactor/CHANGES
    team/kmoore/cel_backend_refactor/bridges/bridge_native_rtp.c
    team/kmoore/cel_backend_refactor/channels/chan_pjsip.c
    team/kmoore/cel_backend_refactor/channels/chan_sip.c
    team/kmoore/cel_backend_refactor/configs/pjsip.conf.sample
    team/kmoore/cel_backend_refactor/include/asterisk/res_pjsip.h
    team/kmoore/cel_backend_refactor/include/asterisk/res_pjsip_exten_state.h
    team/kmoore/cel_backend_refactor/include/asterisk/res_pjsip_pubsub.h
    team/kmoore/cel_backend_refactor/include/asterisk/res_pjsip_session.h
    team/kmoore/cel_backend_refactor/res/res_agi.c
    team/kmoore/cel_backend_refactor/res/res_pjsip/include/res_pjsip_private.h
    team/kmoore/cel_backend_refactor/res/res_pjsip/pjsip_options.c
    team/kmoore/cel_backend_refactor/tests/test_cel.c

Propchange: team/kmoore/cel_backend_refactor/
------------------------------------------------------------------------------
--- cel_integrated (original)
+++ cel_integrated Wed Jul 31 22:11:59 2013
@@ -1,1 +1,1 @@
-/team/kmoore/event_system_strip:1-395850
+/team/kmoore/event_system_strip:1-395926

Modified: team/kmoore/cel_backend_refactor/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/CHANGES?view=diff&rev=395927&r1=395926&r2=395927
==============================================================================
--- team/kmoore/cel_backend_refactor/CHANGES (original)
+++ team/kmoore/cel_backend_refactor/CHANGES Wed Jul 31 22:11:59 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/kmoore/cel_backend_refactor/bridges/bridge_native_rtp.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/bridges/bridge_native_rtp.c?view=diff&rev=395927&r1=395926&r2=395927
==============================================================================
--- team/kmoore/cel_backend_refactor/bridges/bridge_native_rtp.c (original)
+++ team/kmoore/cel_backend_refactor/bridges/bridge_native_rtp.c Wed Jul 31 22:11:59 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/kmoore/cel_backend_refactor/channels/chan_pjsip.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/channels/chan_pjsip.c?view=diff&rev=395927&r1=395926&r2=395927
==============================================================================
--- team/kmoore/cel_backend_refactor/channels/chan_pjsip.c (original)
+++ team/kmoore/cel_backend_refactor/channels/chan_pjsip.c Wed Jul 31 22:11:59 2013
@@ -577,7 +577,7 @@
 		return NULL;
 	}
 
-	/* If res_sip_session is ever updated to create/destroy ast_sip_session_media
+	/* If res_pjsip_session is ever updated to create/destroy ast_sip_session_media
 	 * during a call such as if multiple same-type stream support is introduced,
 	 * these will need to be recaptured as well */
 	pvt->media[SIP_MEDIA_AUDIO] = ao2_find(session->media, "audio", OBJ_KEY);

Modified: team/kmoore/cel_backend_refactor/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/channels/chan_sip.c?view=diff&rev=395927&r1=395926&r2=395927
==============================================================================
--- team/kmoore/cel_backend_refactor/channels/chan_sip.c (original)
+++ team/kmoore/cel_backend_refactor/channels/chan_sip.c Wed Jul 31 22:11:59 2013
@@ -23666,6 +23666,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 */
@@ -23674,6 +23675,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 */
@@ -23714,6 +23716,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/kmoore/cel_backend_refactor/configs/pjsip.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/configs/pjsip.conf.sample?view=diff&rev=395927&r1=395926&r2=395927
==============================================================================
--- team/kmoore/cel_backend_refactor/configs/pjsip.conf.sample (original)
+++ team/kmoore/cel_backend_refactor/configs/pjsip.conf.sample Wed Jul 31 22:11:59 2013
@@ -1,4 +1,4 @@
-; This is an in-flux configuration file for the res_sip module, it will change as things progress
+; This is an in-flux configuration file for the res_pjsip module, it will change as things progress
 
 ;;; Transports
 ;[local]

Modified: team/kmoore/cel_backend_refactor/include/asterisk/res_pjsip.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/include/asterisk/res_pjsip.h?view=diff&rev=395927&r1=395926&r2=395927
==============================================================================
--- team/kmoore/cel_backend_refactor/include/asterisk/res_pjsip.h (original)
+++ team/kmoore/cel_backend_refactor/include/asterisk/res_pjsip.h Wed Jul 31 22:11:59 2013
@@ -16,8 +16,8 @@
  * at the top of the source tree.
  */
 
-#ifndef _RES_SIP_H
-#define _RES_SIP_H
+#ifndef _RES_PJSIP_H
+#define _RES_PJSIP_H
 
 #include "asterisk/stringfields.h"
 /* Needed for struct ast_sockaddr */
@@ -1499,4 +1499,4 @@
 
 int ast_sip_initialize_sorcery_global(struct ast_sorcery *sorcery);
 
-#endif /* _RES_SIP_H */
+#endif /* _RES_PJSIP_H */

Modified: team/kmoore/cel_backend_refactor/include/asterisk/res_pjsip_exten_state.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/include/asterisk/res_pjsip_exten_state.h?view=diff&rev=395927&r1=395926&r2=395927
==============================================================================
--- team/kmoore/cel_backend_refactor/include/asterisk/res_pjsip_exten_state.h (original)
+++ team/kmoore/cel_backend_refactor/include/asterisk/res_pjsip_exten_state.h Wed Jul 31 22:11:59 2013
@@ -16,8 +16,8 @@
  * at the top of the source tree.
  */
 
-#ifndef _RES_SIP_EXTEN_STATE_H
-#define _RES_SIP_EXTEN_STATE_H
+#ifndef _RES_PJSIP_EXTEN_STATE_H
+#define _RES_PJSIP_EXTEN_STATE_H
 
 #include "asterisk/stringfields.h"
 #include "asterisk/linkedlists.h"
@@ -91,4 +91,4 @@
  */
 void ast_sip_unregister_exten_state_provider(struct ast_sip_exten_state_provider *obj);
 
-#endif
+#endif /* _RES_PJSIP_EXTEN_STATE_H */

Modified: team/kmoore/cel_backend_refactor/include/asterisk/res_pjsip_pubsub.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/include/asterisk/res_pjsip_pubsub.h?view=diff&rev=395927&r1=395926&r2=395927
==============================================================================
--- team/kmoore/cel_backend_refactor/include/asterisk/res_pjsip_pubsub.h (original)
+++ team/kmoore/cel_backend_refactor/include/asterisk/res_pjsip_pubsub.h Wed Jul 31 22:11:59 2013
@@ -16,8 +16,8 @@
  * at the top of the source tree.
  */
 
-#ifndef _RES_SIP_PUBSUB_H
-#define _RES_SIP_PUBSUB_H
+#ifndef _RES_PJSIP_PUBSUB_H
+#define _RES_PJSIP_PUBSUB_H
 
 #include "asterisk/linkedlists.h"
 
@@ -513,4 +513,4 @@
  */
 void ast_sip_unregister_subscription_handler(struct ast_sip_subscription_handler *handler);
 
-#endif /* RES_SIP_PUBSUB_H */
+#endif /* RES_PJSIP_PUBSUB_H */

Modified: team/kmoore/cel_backend_refactor/include/asterisk/res_pjsip_session.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/include/asterisk/res_pjsip_session.h?view=diff&rev=395927&r1=395926&r2=395927
==============================================================================
--- team/kmoore/cel_backend_refactor/include/asterisk/res_pjsip_session.h (original)
+++ team/kmoore/cel_backend_refactor/include/asterisk/res_pjsip_session.h Wed Jul 31 22:11:59 2013
@@ -16,8 +16,8 @@
  * at the top of the source tree.
  */
 
-#ifndef _RES_SIP_SESSION_H
-#define _RES_SIP_SESSION_H
+#ifndef _RES_PJSIP_SESSION_H
+#define _RES_PJSIP_SESSION_H
 
 /* Needed for pj_timer_entry definition */
 #include "pjlib.h"
@@ -141,7 +141,7 @@
 	/*! Top priority. Supplements with this priority are those that need to run before any others */
 	AST_SIP_SESSION_SUPPLEMENT_PRIORITY_FIRST = 0,
 	/*! Channel creation priority.
-	 * chan_gulp creates a channel at this priority. If your supplement depends on being run before
+	 * chan_pjsip creates a channel at this priority. If your supplement depends on being run before
 	 * or after channel creation, then set your priority to be lower or higher than this value.
 	 */
 	AST_SIP_SESSION_SUPPLEMENT_PRIORITY_CHANNEL = 1000000,
@@ -466,7 +466,7 @@
  * \brief Send a reinvite or UPDATE on a session
  *
  * This method will inspect the session in order to construct an appropriate
- * session refresh request. As with any outgoing request in res_sip_session,
+ * session refresh request. As with any outgoing request in res_pjsip_session,
  * this will call into registered supplements in case they wish to add anything.
  *
  * Note: The on_request_creation callback may or may not be called in the same
@@ -558,4 +558,4 @@
  */
 void ast_sip_session_resume_reinvite(struct ast_sip_session *session);
 
-#endif /* _RES_SIP_SESSION_H */
+#endif /* _RES_PJSIP_SESSION_H */

Modified: team/kmoore/cel_backend_refactor/res/res_agi.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/res/res_agi.c?view=diff&rev=395927&r1=395926&r2=395927
==============================================================================
--- team/kmoore/cel_backend_refactor/res/res_agi.c (original)
+++ team/kmoore/cel_backend_refactor/res/res_agi.c Wed Jul 31 22:11:59 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 (;;) {

Modified: team/kmoore/cel_backend_refactor/res/res_pjsip/include/res_pjsip_private.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/res/res_pjsip/include/res_pjsip_private.h?view=diff&rev=395927&r1=395926&r2=395927
==============================================================================
--- team/kmoore/cel_backend_refactor/res/res_pjsip/include/res_pjsip_private.h (original)
+++ team/kmoore/cel_backend_refactor/res/res_pjsip/include/res_pjsip_private.h Wed Jul 31 22:11:59 2013
@@ -5,8 +5,8 @@
  *      Author: mjordan
  */
 
-#ifndef RES_SIP_PRIVATE_H_
-#define RES_SIP_PRIVATE_H_
+#ifndef RES_PJSIP_PRIVATE_H_
+#define RES_PJSIP_PRIVATE_H_
 
 struct ao2_container;
 
@@ -71,4 +71,4 @@
  */
 int ast_sip_initialize_global(void);
 
-#endif /* RES_SIP_PRIVATE_H_ */
+#endif /* RES_PJSIP_PRIVATE_H_ */

Modified: team/kmoore/cel_backend_refactor/res/res_pjsip/pjsip_options.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/res/res_pjsip/pjsip_options.c?view=diff&rev=395927&r1=395926&r2=395927
==============================================================================
--- team/kmoore/cel_backend_refactor/res/res_pjsip/pjsip_options.c (original)
+++ team/kmoore/cel_backend_refactor/res/res_pjsip/pjsip_options.c Wed Jul 31 22:11:59 2013
@@ -625,9 +625,9 @@
 
 	switch (cmd) {
 	case CLI_INIT:
-		e->command = "sip qualify";
+		e->command = "pjsip qualify";
 		e->usage =
-			"Usage: sip qualify <endpoint>\n"
+			"Usage: pjsip qualify <endpoint>\n"
 			"       Send a SIP OPTIONS request to all contacts on the endpoint.\n";
 		return NULL;
 	case CLI_GENERATE:
@@ -653,7 +653,7 @@
 }
 
 static struct ast_cli_entry cli_options[] = {
-	AST_CLI_DEFINE(cli_qualify, "Send an OPTIONS request to a SIP endpoint")
+	AST_CLI_DEFINE(cli_qualify, "Send an OPTIONS request to a PJSIP endpoint")
 };
 
 static int sched_qualifies_hash_fn(const void *obj, int flags)

Modified: team/kmoore/cel_backend_refactor/tests/test_cel.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/tests/test_cel.c?view=diff&rev=395927&r1=395926&r2=395927
==============================================================================
--- team/kmoore/cel_backend_refactor/tests/test_cel.c (original)
+++ team/kmoore/cel_backend_refactor/tests/test_cel.c Wed Jul 31 22:11:59 2013
@@ -561,6 +561,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);
@@ -623,6 +627,7 @@
 
 	return AST_TEST_PASS;
 }
+#endif
 
 #define EMULATE_DIAL(channel, dialstring) do { \
 	EMULATE_APP_DATA(channel, 1, "Dial", dialstring); \
@@ -1014,6 +1019,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);
@@ -1097,6 +1103,7 @@
 
 	return AST_TEST_PASS;
 }
+#endif
 
 AST_TEST_DEFINE(test_cel_blind_transfer)
 {
@@ -1891,7 +1898,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);
@@ -1902,7 +1909,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);
@@ -1964,7 +1971,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);
@@ -1975,7 +1982,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