[asterisk-commits] dlee: branch dlee/playback-rebase r388793 - in /team/dlee/playback-rebase: in...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 15 08:25:59 CDT 2013


Author: dlee
Date: Wed May 15 08:25:57 2013
New Revision: 388793

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=388793
Log:
Replaces ast_streamfile with ast_control_streamfile

Modified:
    team/dlee/playback-rebase/include/asterisk/app.h
    team/dlee/playback-rebase/main/stasis_channels.c
    team/dlee/playback-rebase/res/res_stasis_playback.c

Modified: team/dlee/playback-rebase/include/asterisk/app.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-rebase/include/asterisk/app.h?view=diff&rev=388793&r1=388792&r2=388793
==============================================================================
--- team/dlee/playback-rebase/include/asterisk/app.h (original)
+++ team/dlee/playback-rebase/include/asterisk/app.h Wed May 15 08:25:57 2013
@@ -636,14 +636,19 @@
 
 /*!
  * \brief Stream a file with fast forward, pause, reverse, restart.
- * \param chan
- * \param file filename
- * \param fwd, rev, stop, pause, restart, skipms, offsetms
+ * \param chan Channel
+ * \param file File to play.
+ * \param fwd, rev, stop, pause, restart DTMF keys for media control
+ * \param skipms Number of milliseconds to skip for fwd/rev.
+ * \param offsetms Number of milliseconds to skip when starting the media.
  *
  * Before calling this function, set this to be the number
  * of ms to start from the beginning of the file.  When the function
  * returns, it will be the number of ms from the beginning where the
  * playback stopped.  Pass NULL if you don't care.
+ *
+ * \retval 0 on success
+ * \retval Non-zero on failure
  */
 int ast_control_streamfile(struct ast_channel *chan, const char *file, const char *fwd, const char *rev, const char *stop, const char *pause, const char *restart, int skipms, long *offsetms);
 

Modified: team/dlee/playback-rebase/main/stasis_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-rebase/main/stasis_channels.c?view=diff&rev=388793&r1=388792&r2=388793
==============================================================================
--- team/dlee/playback-rebase/main/stasis_channels.c (original)
+++ team/dlee/playback-rebase/main/stasis_channels.c Wed May 15 08:25:57 2013
@@ -448,7 +448,6 @@
 
 	snapshot = ast_channel_snapshot_create(chan);
 	if (!snapshot) {
-		ast_log(LOG_ERROR, "Allocation error\n");
 		return;
 	}
 

Modified: team/dlee/playback-rebase/res/res_stasis_playback.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/playback-rebase/res/res_stasis_playback.c?view=diff&rev=388793&r1=388792&r2=388793
==============================================================================
--- team/dlee/playback-rebase/res/res_stasis_playback.c (original)
+++ team/dlee/playback-rebase/res/res_stasis_playback.c Wed May 15 08:25:57 2013
@@ -32,6 +32,7 @@
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
+#include "asterisk/app.h"
 #include "asterisk/astobj2.h"
 #include "asterisk/file.h"
 #include "asterisk/logger.h"
@@ -44,6 +45,9 @@
 
 /*! Number of hash buckets for playback container. Keep it prime! */
 #define PLAYBACK_BUCKETS 127
+
+/*! Number of milliseconds of media to skip */
+#define PLAYBACK_SKIPMS 250
 
 #define SOUND_URI_SCHEME "sound:"
 #define RECORDING_URI_SCHEME "recording:"
@@ -164,6 +168,16 @@
 	RAII_VAR(struct ast_json *, json, NULL, ast_json_unref);
 	const char *file;
 	int res;
+	/* Even though these local variables look fairly pointless, the avoid
+	 * having a bunch of NULL's passed directly into
+	 * ast_control_streamfile() */
+	const char *fwd = NULL;
+	const char *rev = NULL;
+	const char *stop = NULL;
+	const char *pause = NULL;
+	const char *restart = NULL;
+	int skipms = PLAYBACK_SKIPMS;
+	long offsetms = 0;
 
 	playback = data;
 	ast_assert(playback != NULL);
@@ -186,11 +200,9 @@
 		return NULL;
 	}
 
-	res = ast_streamfile(chan, file, playback->language);
-	if (res == 0) {
-		res = ast_waitstream(chan, "");
-		ast_stopstream(chan);
-	}
+	res = ast_control_streamfile(chan, file, fwd, rev, stop, pause,
+		restart, skipms, &offsetms);
+
 	if (res != 0) {
 		ast_log(LOG_WARNING, "%s: Playback failed for %s",
 			ast_channel_uniqueid(chan), playback->media);




More information about the asterisk-commits mailing list