[svn-commits] dlee: branch dlee/ari-async-bridge r395930 - in /team/dlee/ari-async-bridge: ...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Jul 31 22:18:26 CDT 2013


Author: dlee
Date: Wed Jul 31 22:18:23 2013
New Revision: 395930

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=395930
Log:
Merged revisions 395906-395907 from http://svn.asterisk.org/svn/asterisk/trunk

Modified:
    team/dlee/ari-async-bridge/   (props changed)
    team/dlee/ari-async-bridge/CHANGES
    team/dlee/ari-async-bridge/channels/chan_sip.c
    team/dlee/ari-async-bridge/res/res_agi.c

Propchange: team/dlee/ari-async-bridge/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Jul 31 22:18:23 2013
@@ -1,1 +1,1 @@
-/trunk:1-395902
+/trunk:1-395929

Modified: team/dlee/ari-async-bridge/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-async-bridge/CHANGES?view=diff&rev=395930&r1=395929&r2=395930
==============================================================================
--- team/dlee/ari-async-bridge/CHANGES (original)
+++ team/dlee/ari-async-bridge/CHANGES Wed Jul 31 22:18:23 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/dlee/ari-async-bridge/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-async-bridge/channels/chan_sip.c?view=diff&rev=395930&r1=395929&r2=395930
==============================================================================
--- team/dlee/ari-async-bridge/channels/chan_sip.c (original)
+++ team/dlee/ari-async-bridge/channels/chan_sip.c Wed Jul 31 22:18:23 2013
@@ -23667,6 +23667,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 */
@@ -23675,6 +23676,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 */
@@ -23715,6 +23717,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/dlee/ari-async-bridge/res/res_agi.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ari-async-bridge/res/res_agi.c?view=diff&rev=395930&r1=395929&r2=395930
==============================================================================
--- team/dlee/ari-async-bridge/res/res_agi.c (original)
+++ team/dlee/ari-async-bridge/res/res_agi.c Wed Jul 31 22:18:23 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 (;;) {




More information about the svn-commits mailing list