mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-11-04 05:15:22 +00:00 
			
		
		
		
	Merged revisions 156388 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r156388 | tilghman | 2008-11-12 15:34:51 -0600 (Wed, 12 Nov 2008) | 12 lines Merged revisions 156386 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r156386 | tilghman | 2008-11-12 15:18:57 -0600 (Wed, 12 Nov 2008) | 5 lines When using call limits under 1 second, infinite call lengths are allowed, instead. (closes issue #13851) Reported by: ruddy ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.1@156389 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
		@@ -902,7 +902,7 @@ static int valid_priv_reply(struct ast_flags64 *opts, int res)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int do_timelimit(struct ast_channel *chan, struct ast_bridge_config *config,
 | 
					static int do_timelimit(struct ast_channel *chan, struct ast_bridge_config *config,
 | 
				
			||||||
	char *parse, unsigned int *calldurationlimit)
 | 
						char *parse, struct timeval *calldurationlimit)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	char *stringp = ast_strdupa(parse);
 | 
						char *stringp = ast_strdupa(parse);
 | 
				
			||||||
	char *limit_str, *warning_str, *warnfreq_str;
 | 
						char *limit_str, *warning_str, *warnfreq_str;
 | 
				
			||||||
@@ -979,12 +979,15 @@ static int do_timelimit(struct ast_channel *chan, struct ast_bridge_config *conf
 | 
				
			|||||||
	ast_channel_unlock(chan);
 | 
						ast_channel_unlock(chan);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* undo effect of S(x) in case they are both used */
 | 
						/* undo effect of S(x) in case they are both used */
 | 
				
			||||||
	*calldurationlimit = 0;
 | 
						calldurationlimit->tv_sec = 0;
 | 
				
			||||||
 | 
						calldurationlimit->tv_usec = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* more efficient to do it like S(x) does since no advanced opts */
 | 
						/* more efficient to do it like S(x) does since no advanced opts */
 | 
				
			||||||
	if (!config->play_warning && !config->start_sound && !config->end_sound && config->timelimit) {
 | 
						if (!config->play_warning && !config->start_sound && !config->end_sound && config->timelimit) {
 | 
				
			||||||
		*calldurationlimit = config->timelimit / 1000;
 | 
							calldurationlimit->tv_sec = config->timelimit / 1000;
 | 
				
			||||||
		ast_verb(3, "Setting call duration limit to %d seconds.\n",
 | 
							calldurationlimit->tv_usec = (config->timelimit % 1000) * 1000;
 | 
				
			||||||
			*calldurationlimit);
 | 
							ast_verb(3, "Setting call duration limit to %.3lf seconds.\n",
 | 
				
			||||||
 | 
								calldurationlimit->tv_sec + calldurationlimit->tv_usec / 1000000.0);
 | 
				
			||||||
		config->timelimit = play_to_caller = play_to_callee =
 | 
							config->timelimit = play_to_caller = play_to_callee =
 | 
				
			||||||
		config->play_warning = config->warning_freq = 0;
 | 
							config->play_warning = config->warning_freq = 0;
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
@@ -1292,7 +1295,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
 | 
				
			|||||||
	char cidname[AST_MAX_EXTENSION] = "";
 | 
						char cidname[AST_MAX_EXTENSION] = "";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct ast_bridge_config config = { { 0, } };
 | 
						struct ast_bridge_config config = { { 0, } };
 | 
				
			||||||
	unsigned int calldurationlimit = 0;
 | 
						struct timeval calldurationlimit = { 0, };
 | 
				
			||||||
	char *dtmfcalled = NULL, *dtmfcalling = NULL;
 | 
						char *dtmfcalled = NULL, *dtmfcalling = NULL;
 | 
				
			||||||
	struct privacy_args pa = {
 | 
						struct privacy_args pa = {
 | 
				
			||||||
		.sentringing = 0,
 | 
							.sentringing = 0,
 | 
				
			||||||
@@ -1353,13 +1356,13 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if (ast_test_flag64(&opts, OPT_DURATION_STOP) && !ast_strlen_zero(opt_args[OPT_ARG_DURATION_STOP])) {
 | 
						if (ast_test_flag64(&opts, OPT_DURATION_STOP) && !ast_strlen_zero(opt_args[OPT_ARG_DURATION_STOP])) {
 | 
				
			||||||
		calldurationlimit = atoi(opt_args[OPT_ARG_DURATION_STOP]);
 | 
							calldurationlimit.tv_sec = atoi(opt_args[OPT_ARG_DURATION_STOP]);
 | 
				
			||||||
		if (!calldurationlimit) {
 | 
							if (!calldurationlimit.tv_sec) {
 | 
				
			||||||
			ast_log(LOG_WARNING, "Dial does not accept S(%s), hanging up.\n", opt_args[OPT_ARG_DURATION_STOP]);
 | 
								ast_log(LOG_WARNING, "Dial does not accept S(%s), hanging up.\n", opt_args[OPT_ARG_DURATION_STOP]);
 | 
				
			||||||
			pbx_builtin_setvar_helper(chan, "DIALSTATUS", pa.status);
 | 
								pbx_builtin_setvar_helper(chan, "DIALSTATUS", pa.status);
 | 
				
			||||||
			goto done;
 | 
								goto done;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		ast_verb(3, "Setting call duration limit to %d seconds.\n", calldurationlimit);
 | 
							ast_verb(3, "Setting call duration limit to %.3lf seconds.\n", calldurationlimit.tv_sec + calldurationlimit.tv_usec / 1000000.0);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (ast_test_flag64(&opts, OPT_SENDDTMF) && !ast_strlen_zero(opt_args[OPT_ARG_SENDDTMF])) {
 | 
						if (ast_test_flag64(&opts, OPT_SENDDTMF) && !ast_strlen_zero(opt_args[OPT_ARG_SENDDTMF])) {
 | 
				
			||||||
@@ -1917,8 +1920,8 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (!res) {
 | 
							if (!res) {
 | 
				
			||||||
			if (calldurationlimit > 0) {
 | 
								if (!ast_tvzero(calldurationlimit)) {
 | 
				
			||||||
				struct timeval whentohangup = { calldurationlimit, 0 };
 | 
									struct timeval whentohangup = calldurationlimit;
 | 
				
			||||||
				peer->whentohangup = ast_tvadd(ast_tvnow(), whentohangup);
 | 
									peer->whentohangup = ast_tvadd(ast_tvnow(), whentohangup);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if (!ast_strlen_zero(dtmfcalled)) {
 | 
								if (!ast_strlen_zero(dtmfcalled)) {
 | 
				
			||||||
@@ -2050,7 +2053,7 @@ out:
 | 
				
			|||||||
		ast_debug(1, "Exiting with DIALSTATUS=%s.\n", pa.status);
 | 
							ast_debug(1, "Exiting with DIALSTATUS=%s.\n", pa.status);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if ((ast_test_flag64(peerflags, OPT_GO_ON)) && !ast_check_hangup(chan) && (res != AST_PBX_KEEPALIVE) && (res != AST_PBX_INCOMPLETE)) {
 | 
							if ((ast_test_flag64(peerflags, OPT_GO_ON)) && !ast_check_hangup(chan) && (res != AST_PBX_KEEPALIVE) && (res != AST_PBX_INCOMPLETE)) {
 | 
				
			||||||
			if (calldurationlimit)
 | 
								if (!ast_tvzero(calldurationlimit))
 | 
				
			||||||
				memset(&chan->whentohangup, 0, sizeof(chan->whentohangup));
 | 
									memset(&chan->whentohangup, 0, sizeof(chan->whentohangup));
 | 
				
			||||||
			res = 0;
 | 
								res = 0;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user