[asterisk-commits] trunk - r7457 in /trunk: ./ apps/ channels/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Dec 13 00:00:18 CST 2005


Author: kpfleming
Date: Tue Dec 13 00:00:17 2005
New Revision: 7457

URL: http://svn.digium.com/view/asterisk?rev=7457&view=rev
Log:
Merged revisions 7448-7449,7451,7453 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r7448 | kpfleming | 2005-12-12 22:25:14 -0600 (Mon, 12 Dec 2005) | 2 lines

use the stream's current point when pausing/unpausing, instead of elapsed time (which doesn't work when the stream has been skipped forward or backward) (issue #5897)

........
r7449 | kpfleming | 2005-12-12 22:43:38 -0600 (Mon, 12 Dec 2005) | 2 lines

only report AGENT_IDLE for callback mode agents when they are actually idle (issue #5902)

........
r7451 | kpfleming | 2005-12-12 23:14:27 -0600 (Mon, 12 Dec 2005) | 2 lines

ensure that hangups while incoming calls are in early state are handled properly (issue #5919)

........
r7453 | kpfleming | 2005-12-12 23:53:00 -0600 (Mon, 12 Dec 2005) | 2 lines

restore ability of caller to hangup calls that are still ringing (issue #5839)

........

Modified:
    trunk/   (props changed)
    trunk/app.c
    trunk/apps/app_dial.c
    trunk/channels/chan_agent.c
    trunk/channels/chan_sip.c
    trunk/pbx.c

Propchange: trunk/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Dec 13 00:00:17 2005
@@ -1,1 +1,1 @@
-/branches/1.2:1-7435
+/branches/1.2:1-7456

Modified: trunk/app.c
URL: http://svn.digium.com/view/asterisk/trunk/app.c?rev=7457&r1=7456&r2=7457&view=diff
==============================================================================
--- trunk/app.c (original)
+++ trunk/app.c Tue Dec 13 00:00:17 2005
@@ -430,11 +430,11 @@
 			   const char *stop, const char *pause,
 			   const char *restart, int skipms) 
 {
-	long elapsed = 0, last_elapsed = 0;
 	char *breaks = NULL;
 	char *end = NULL;
 	int blen = 2;
 	int res;
+	long pause_restart_point = 0;
 
 	if (stop)
 		blen += strlen(stop);
@@ -456,9 +456,6 @@
 	if (chan->_state != AST_STATE_UP)
 		res = ast_answer(chan);
 
-	if (chan)
-		ast_stopstream(chan);
-
 	if (file) {
 		if ((end = strchr(file,':'))) {
 			if (!strcasecmp(end, ":end")) {
@@ -469,25 +466,18 @@
 	}
 
 	for (;;) {
-		struct timeval started = ast_tvnow();
-
-		if (chan)
-			ast_stopstream(chan);
+		ast_stopstream(chan);
 		res = ast_streamfile(chan, file, chan->language);
 		if (!res) {
-			if (end) {
+			if (pause_restart_point) {
+				ast_seekstream(chan->stream, pause_restart_point, SEEK_SET);
+				pause_restart_point = 0;
+			}
+			else if (end) {
 				ast_seekstream(chan->stream, 0, SEEK_END);
-				end=NULL;
-			}
-			res = 1;
-			if (elapsed) {
-				ast_stream_fastforward(chan->stream, elapsed);
-				last_elapsed = elapsed - 200;
-			}
-			if (res)
-				res = ast_waitstream_fr(chan, breaks, fwd, rev, skipms);
-			else
-				break;
+				end = NULL;
+			};
+			res = ast_waitstream_fr(chan, breaks, fwd, rev, skipms);
 		}
 
 		if (res < 1)
@@ -496,17 +486,16 @@
 		/* We go at next loop if we got the restart char */
 		if (restart && strchr(restart, res)) {
 			ast_log(LOG_DEBUG, "we'll restart the stream here at next loop\n");
-			elapsed=0; /* To make sure the next stream will start at beginning */
+			pause_restart_point = 0;
 			continue;
 		}
 
-		if (pause != NULL && strchr(pause, res)) {
-			elapsed = ast_tvdiff_ms(ast_tvnow(), started) + last_elapsed;
-			for(;;) {
-				if (chan)
-					ast_stopstream(chan);
+		if (pause && strchr(pause, res)) {
+			pause_restart_point = ast_tellstream(chan->stream);
+			for (;;) {
+				ast_stopstream(chan);
 				res = ast_waitfordigit(chan, 1000);
-				if (res == 0)
+				if (!res)
 					continue;
 				else if (res == -1 || strchr(pause, res) || (stop && strchr(stop, res)))
 					break;
@@ -516,17 +505,16 @@
 				continue;
 			}
 		}
+
 		if (res == -1)
 			break;
 
 		/* if we get one of our stop chars, return it to the calling function */
-		if (stop && strchr(stop, res)) {
-			/* res = 0; */
-			break;
-		}
-	}
-	if (chan)
-		ast_stopstream(chan);
+		if (stop && strchr(stop, res))
+			break;
+	}
+
+	ast_stopstream(chan);
 
 	return res;
 }

Modified: trunk/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_dial.c?rev=7457&r1=7456&r2=7457&view=diff
==============================================================================
--- trunk/apps/app_dial.c (original)
+++ trunk/apps/app_dial.c Tue Dec 13 00:00:17 2005
@@ -962,7 +962,7 @@
 	/* If a channel group has been specified, get it for use when we create peer channels */
 	outbound_group = pbx_builtin_getvar_helper(chan, "OUTBOUND_GROUP");
 
-	ast_copy_flags(peerflags, &opts, OPT_DTMF_EXIT | OPT_GO_ON | OPT_ORIGINAL_CLID);
+	ast_copy_flags(peerflags, &opts, OPT_DTMF_EXIT | OPT_GO_ON | OPT_ORIGINAL_CLID | OPT_CALLER_HANGUP);
 	cur = args.peers;
 	do {
 		/* Remember where to start next time */

Modified: trunk/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_agent.c?rev=7457&r1=7456&r2=7457&view=diff
==============================================================================
--- trunk/channels/chan_agent.c (original)
+++ trunk/channels/chan_agent.c Tue Dec 13 00:00:17 2005
@@ -1417,7 +1417,7 @@
 		/* Set a default status. It 'should' get changed. */
 		status = "AGENT_UNKNOWN";
 
-		if (!ast_strlen_zero(p->loginchan)) {
+		if (!ast_strlen_zero(p->loginchan) && !p->chan) {
 			loginChan = p->loginchan;
 			talkingtoChan = "n/a";
 			status = "AGENT_IDLE";

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?rev=7457&r1=7456&r2=7457&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Tue Dec 13 00:00:17 2005
@@ -2279,6 +2279,7 @@
 /* Possible values taken from causes.h */
 
 	switch(cause) {
+		case 603:	/* Declined */
 		case 403:	/* Not found */
 			return AST_CAUSE_CALL_REJECTED;
 		case 404:	/* Not found */
@@ -2458,7 +2459,7 @@
 				if (ast->hangupcause && ((res = hangup_cause2sip(ast->hangupcause)))) {
 					transmit_response_reliable(p, res, &p->initreq, 1);
 				} else 
-					transmit_response_reliable(p, "403 Forbidden", &p->initreq, 1);
+					transmit_response_reliable(p, "603 Declined", &p->initreq, 1);
 			}
 		} else {	/* Call is in UP state, send BYE */
 			if (!p->pendinginvite) {

Modified: trunk/pbx.c
URL: http://svn.digium.com/view/asterisk/trunk/pbx.c?rev=7457&r1=7456&r2=7457&view=diff
==============================================================================
--- trunk/pbx.c (original)
+++ trunk/pbx.c Tue Dec 13 00:00:17 2005
@@ -5443,6 +5443,8 @@
 static int pbx_builtin_hangup(struct ast_channel *chan, void *data)
 {
 	/* Just return non-zero and it will hang up */
+	if (!chan->hangupcause)
+		chan->hangupcause = AST_CAUSE_NORMAL_CLEARING;
 	return -1;
 }
 



More information about the asterisk-commits mailing list