[svn-commits] dlee: branch dlee/stasis-http r380836 - in /team/dlee/stasis-http: apps/ incl...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Mon Feb 4 15:47:39 CST 2013
Author: dlee
Date: Mon Feb 4 15:47:38 2013
New Revision: 380836
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=380836
Log:
Stay in Stasis app until hangup
Modified:
team/dlee/stasis-http/apps/app_stasis.c
team/dlee/stasis-http/include/asterisk/frame.h
team/dlee/stasis-http/main/frame.c
Modified: team/dlee/stasis-http/apps/app_stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-http/apps/app_stasis.c?view=diff&rev=380836&r1=380835&r2=380836
==============================================================================
--- team/dlee/stasis-http/apps/app_stasis.c (original)
+++ team/dlee/stasis-http/apps/app_stasis.c Mon Feb 4 15:47:38 2013
@@ -96,7 +96,7 @@
ast_assert(chan != NULL);
msg = ast_json_pack("{s: s, s: s}",
- "command", "start",
+ "command", "end",
"channel", ast_channel_uniqueid(chan),
"args");
if (!msg) {
@@ -136,6 +136,21 @@
return res;
}
+ while (ast_waitfor(chan, -1) > -1) {
+ RAII_VAR(struct ast_frame *, f, ast_read(chan), ast_frame_free_cached);
+ if (!f) {
+ ast_debug(3, "%s: No more frames. Must be done, I guess.\n", ast_channel_uniqueid(chan));
+ break;
+ }
+
+ ast_log(LOG_DEBUG, "New frame: %d\n", f->frametype);
+
+ if (f->frametype == AST_FRAME_CONTROL && f->subclass.integer == AST_CONTROL_HANGUP) {
+ ast_debug(3, "%s: Received hangup\n", ast_channel_uniqueid(chan));
+ break;
+ }
+ }
+
res = send_end_msg(args.app_name, chan);
if (res != 0) {
ast_log(LOG_ERROR, "Error sending start message to %s\n", args.app_name);
Modified: team/dlee/stasis-http/include/asterisk/frame.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-http/include/asterisk/frame.h?view=diff&rev=380836&r1=380835&r2=380836
==============================================================================
--- team/dlee/stasis-http/include/asterisk/frame.h (original)
+++ team/dlee/stasis-http/include/asterisk/frame.h Mon Feb 4 15:47:38 2013
@@ -483,6 +483,13 @@
#define ast_frfree(fr) ast_frame_free(fr, 1)
+/*!
+ * \brief NULL-safe wrapper for \ref ast_frame_free, which consiters the
+ * frame for caching. Same as ast_frfree, but good for \ref RAII_VAR.
+ * \param frame Frame to free, or head of list to free.
+ */
+void ast_frame_free_cached(struct ast_frame *frame);
+
/*! \brief Makes a frame independent of any static storage
* \param fr frame to act upon
* Take a frame, and if it's not been malloc'd, make a malloc'd copy
Modified: team/dlee/stasis-http/main/frame.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-http/main/frame.c?view=diff&rev=380836&r1=380835&r2=380836
==============================================================================
--- team/dlee/stasis-http/main/frame.c (original)
+++ team/dlee/stasis-http/main/frame.c Mon Feb 4 15:47:38 2013
@@ -351,6 +351,14 @@
}
}
+void ast_frame_free_cached(struct ast_frame *frame)
+{
+ if (frame) {
+ ast_frame_free(frame, 1);
+ }
+}
+
+
/*!
* \brief 'isolates' a frame by duplicating non-malloc'ed components
* (header, src, data).
More information about the svn-commits
mailing list