[asterisk-commits] dlee: branch dlee/record-controls r395302 - in /team/dlee/record-controls: ma...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jul 24 14:40:12 CDT 2013


Author: dlee
Date: Wed Jul 24 14:40:10 2013
New Revision: 395302

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=395302
Log:
Don't include paused time when limiting the recording

Modified:
    team/dlee/record-controls/main/app.c
    team/dlee/record-controls/rest-api/api-docs/recordings.json

Modified: team/dlee/record-controls/main/app.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record-controls/main/app.c?view=diff&rev=395302&r1=395301&r2=395302
==============================================================================
--- team/dlee/record-controls/main/app.c (original)
+++ team/dlee/record-controls/main/app.c Wed Jul 24 14:40:10 2013
@@ -1348,6 +1348,8 @@
 		int paused = 0;
 		int muted = 0;
 		int running = 1;
+		time_t pause_start = 0;
+		int paused_secs = 0;
 		while (running) {
 			if (!(res = ast_waitfor(chan, 2000))) {
 				ast_debug(1, "One waitfor failed, trying another\n");
@@ -1461,6 +1463,11 @@
 					paused = !paused;
 					ast_verb(3, "Message %spaused by control\n",
 						paused ? "" : "un");
+					if (paused) {
+						pause_start = time(NULL);
+					} else {
+						paused_secs += time(NULL) - pause_start;
+					}
 					break;
 				case AST_CONTROL_RECORD_MUTE:
 					muted = !muted;
@@ -1481,9 +1488,9 @@
 					break;
 				}
 			}
-			if (maxtime) {
+			if (maxtime && !paused) {
 				end = time(NULL);
-				if (maxtime < (end - start)) {
+				if (maxtime < (end - start - paused_secs)) {
 					ast_verb(3, "Took too long, cutting it short...\n");
 					res = 't';
 					outmsg = 2;

Modified: team/dlee/record-controls/rest-api/api-docs/recordings.json
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record-controls/rest-api/api-docs/recordings.json?view=diff&rev=395302&r1=395301&r2=395302
==============================================================================
--- team/dlee/record-controls/rest-api/api-docs/recordings.json (original)
+++ team/dlee/record-controls/rest-api/api-docs/recordings.json Wed Jul 24 14:40:10 2013
@@ -152,7 +152,7 @@
 				{
 					"httpMethod": "POST",
 					"summary": "Pause a live recording.",
-					"notes": "Pausing a recording suspends silence detection, which will be restarted when the recording is unpaused.",
+					"notes": "Pausing a recording suspends silence detection, which will be restarted when the recording is unpaused. Paused time is not included in the accounting for maxDurationSeconds.",
 					"nickname": "pauseRecording",
 					"responseClass": "void",
 					"parameters": [




More information about the asterisk-commits mailing list