[asterisk-commits] file: branch file/stasis-tweaking r400670 - in /team/file/stasis-tweaking: in...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Oct 8 08:44:39 CDT 2013


Author: file
Date: Tue Oct  8 08:44:36 2013
New Revision: 400670

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=400670
Log:
Add the ability for a playback on a channel to send early media.

Modified:
    team/file/stasis-tweaking/include/asterisk/stasis_app_playback.h
    team/file/stasis-tweaking/res/ari/resource_bridges.c
    team/file/stasis-tweaking/res/ari/resource_channels.c
    team/file/stasis-tweaking/res/ari/resource_channels.h
    team/file/stasis-tweaking/res/res_ari_channels.c
    team/file/stasis-tweaking/res/res_stasis_playback.c
    team/file/stasis-tweaking/rest-api/api-docs/channels.json

Modified: team/file/stasis-tweaking/include/asterisk/stasis_app_playback.h
URL: http://svnview.digium.com/svn/asterisk/team/file/stasis-tweaking/include/asterisk/stasis_app_playback.h?view=diff&rev=400670&r1=400669&r2=400670
==============================================================================
--- team/file/stasis-tweaking/include/asterisk/stasis_app_playback.h (original)
+++ team/file/stasis-tweaking/include/asterisk/stasis_app_playback.h Tue Oct  8 08:44:36 2013
@@ -90,6 +90,7 @@
  * \param target_type What the target type is
  * \param skipms Number of milliseconds to skip for forward/reverse operations.
  * \param offsetms Number of milliseconds to skip before playing.
+ * \param answer Whether to implicitly answer the channel or not.
  * \return Playback control object.
  * \return \c NULL on error.
  */
@@ -97,7 +98,7 @@
 	struct stasis_app_control *control, const char *file,
 	const char *language, const char *target_id,
 	enum stasis_app_playback_target_type target_type,
-	int skipms, long offsetms);
+	int skipms, long offsetms, int answer);
 
 /*!
  * \brief Gets the current state of a playback operation.

Modified: team/file/stasis-tweaking/res/ari/resource_bridges.c
URL: http://svnview.digium.com/svn/asterisk/team/file/stasis-tweaking/res/ari/resource_bridges.c?view=diff&rev=400670&r1=400669&r2=400670
==============================================================================
--- team/file/stasis-tweaking/res/ari/resource_bridges.c (original)
+++ team/file/stasis-tweaking/res/ari/resource_bridges.c Tue Oct  8 08:44:36 2013
@@ -341,7 +341,7 @@
 
 	playback = stasis_app_control_play_uri(control, args->media, language,
 		args->bridge_id, STASIS_PLAYBACK_TARGET_BRIDGE, args->skipms,
-		args->offsetms);
+		args->offsetms, 1);
 
 	if (!playback) {
 		ast_ari_response_alloc_failed(response);

Modified: team/file/stasis-tweaking/res/ari/resource_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/file/stasis-tweaking/res/ari/resource_channels.c?view=diff&rev=400670&r1=400669&r2=400670
==============================================================================
--- team/file/stasis-tweaking/res/ari/resource_channels.c (original)
+++ team/file/stasis-tweaking/res/ari/resource_channels.c Tue Oct  8 08:44:36 2013
@@ -315,7 +315,8 @@
 	language = S_OR(args->lang, snapshot->language);
 
 	playback = stasis_app_control_play_uri(control, args->media, language,
-		args->channel_id, STASIS_PLAYBACK_TARGET_CHANNEL, args->skipms, args->offsetms);
+		args->channel_id, STASIS_PLAYBACK_TARGET_CHANNEL, args->skipms, args->offsetms,
+		args->answer);
 	if (!playback) {
 		ast_ari_response_error(
 			response, 500, "Internal Server Error",

Modified: team/file/stasis-tweaking/res/ari/resource_channels.h
URL: http://svnview.digium.com/svn/asterisk/team/file/stasis-tweaking/res/ari/resource_channels.h?view=diff&rev=400670&r1=400669&r2=400670
==============================================================================
--- team/file/stasis-tweaking/res/ari/resource_channels.h (original)
+++ team/file/stasis-tweaking/res/ari/resource_channels.h Tue Oct  8 08:44:36 2013
@@ -258,6 +258,8 @@
 	int offsetms;
 	/*! \brief Number of milliseconds to skip for forward/reverse operations. */
 	int skipms;
+	/*! \brief Whether to answer the channel implicitly or not. */
+	int answer;
 };
 /*!
  * \brief Start playback of media.

Modified: team/file/stasis-tweaking/res/res_ari_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/file/stasis-tweaking/res/res_ari_channels.c?view=diff&rev=400670&r1=400669&r2=400670
==============================================================================
--- team/file/stasis-tweaking/res/res_ari_channels.c (original)
+++ team/file/stasis-tweaking/res/res_ari_channels.c Tue Oct  8 08:44:36 2013
@@ -892,6 +892,9 @@
 		} else
 		if (strcmp(i->name, "skipms") == 0) {
 			args.skipms = atoi(i->value);
+		} else
+		if (strcmp(i->name, "answer") == 0) {
+			args.answer = ast_true(i->value);
 		} else
 		{}
 	}

Modified: team/file/stasis-tweaking/res/res_stasis_playback.c
URL: http://svnview.digium.com/svn/asterisk/team/file/stasis-tweaking/res/res_stasis_playback.c?view=diff&rev=400670&r1=400669&r2=400670
==============================================================================
--- team/file/stasis-tweaking/res/res_stasis_playback.c (original)
+++ team/file/stasis-tweaking/res/res_stasis_playback.c Tue Oct  8 08:44:36 2013
@@ -76,6 +76,8 @@
 	long offsetms;
 	/*! Number of milliseconds to skip for forward/reverse operations */
 	int skipms;
+	/*! Whether to answer the channel or not */
+	int answer;
 
 	/*! Set when playback has been completed */
 	int done;
@@ -272,7 +274,7 @@
 		return;
 	}
 
-	if (ast_channel_state(chan) != AST_STATE_UP) {
+	if ((ast_channel_state(chan) != AST_STATE_UP) && playback->answer) {
 		ast_answer(chan);
 	}
 
@@ -413,7 +415,7 @@
 	struct stasis_app_control *control, const char *uri,
 	const char *language, const char *target_id,
 	enum stasis_app_playback_target_type target_type,
-	int skipms, long offsetms)
+	int skipms, long offsetms, int answer)
 {
 	RAII_VAR(struct stasis_app_playback *, playback, NULL, ao2_cleanup);
 
@@ -435,6 +437,7 @@
 	set_target_uri(playback, target_type, target_id);
 	playback->skipms = skipms;
 	playback->offsetms = offsetms;
+	playback->answer = answer;
 	ao2_link(playbacks, playback);
 
 	playback->state = STASIS_PLAYBACK_STATE_QUEUED;

Modified: team/file/stasis-tweaking/rest-api/api-docs/channels.json
URL: http://svnview.digium.com/svn/asterisk/team/file/stasis-tweaking/rest-api/api-docs/channels.json?view=diff&rev=400670&r1=400669&r2=400670
==============================================================================
--- team/file/stasis-tweaking/rest-api/api-docs/channels.json (original)
+++ team/file/stasis-tweaking/rest-api/api-docs/channels.json Tue Oct  8 08:44:36 2013
@@ -596,6 +596,15 @@
 							"allowMultiple": false,
 							"dataType": "int",
 							"defaultValue": 3000
+						},
+						{
+							"name": "answer",
+							"description": "Whether to answer the channel implicitly or not.",
+							"paramType": "query",
+							"required": false,
+							"allowMultiple": false,
+							"dataType": "boolean",
+							"defaultValue": true
 						}
 					],
 					"errorResponses": [




More information about the asterisk-commits mailing list