[asterisk-commits] eliel: branch group/appdocsxml r152687 - in /team/group/appdocsxml: ./ apps/ ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Oct 29 19:32:53 CDT 2008


Author: eliel
Date: Wed Oct 29 19:32:52 2008
New Revision: 152687

URL: http://svn.digium.com/view/asterisk?view=rev&rev=152687
Log:
Resolve automerge conflicts.

Modified:
    team/group/appdocsxml/   (props changed)
    team/group/appdocsxml/apps/app_dial.c
    team/group/appdocsxml/apps/app_directory.c
    team/group/appdocsxml/apps/app_queue.c
    team/group/appdocsxml/apps/app_stack.c
    team/group/appdocsxml/apps/app_transfer.c
    team/group/appdocsxml/apps/app_voicemail.c
    team/group/appdocsxml/channels/chan_dahdi.c
    team/group/appdocsxml/channels/chan_local.c
    team/group/appdocsxml/channels/chan_mgcp.c
    team/group/appdocsxml/channels/chan_sip.c
    team/group/appdocsxml/configs/features.conf.sample
    team/group/appdocsxml/configs/phoneprov.conf.sample
    team/group/appdocsxml/include/asterisk/features.h
    team/group/appdocsxml/include/asterisk/pbx.h
    team/group/appdocsxml/main/features.c

Propchange: team/group/appdocsxml/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/group/appdocsxml/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Oct 29 19:32:52 2008
@@ -1,1 +1,1 @@
-/trunk:1-152069
+/trunk:1-152686

Modified: team/group/appdocsxml/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/apps/app_dial.c?view=diff&rev=152687&r1=152686&r2=152687
==============================================================================
--- team/group/appdocsxml/apps/app_dial.c (original)
+++ team/group/appdocsxml/apps/app_dial.c Wed Oct 29 19:32:52 2008
@@ -1,7 +1,7 @@
 /*
  * Asterisk -- An open source telephony toolkit.
  *
- * Copyright (C) 1999 - 2006, Digium, Inc.
+ * Copyright (C) 1999 - 2008, Digium, Inc.
  *
  * Mark Spencer <markster at digium.com>
  *
@@ -189,15 +189,18 @@
 						</variable>
 						<variable name="LIMIT_TIMEOUT_FILE">
 							<value name="filename"/>
-							<para>If specified, <replaceable>filename</replaceable> specifies the sound prompt to play when the timeout is reached. If not set, the time remaining will be announced.</para>
+							<para>If specified, <replaceable>filename</replaceable> specifies the sound prompt to play when the timeout is reached.
+							If not set, the time remaining will be announced.</para>
 						</variable>
 						<variable name="LIMIT_CONNECT_FILE">
 							<value name="filename"/>
-							<para>If specified, <replaceable>filename</replaceable> specifies the sound prompt to play when the call begins. If not set, the time remaining will be announced.</para>
+							<para>If specified, <replaceable>filename</replaceable> specifies the sound prompt to play when the call begins.
+							If not set, the time remaining will be announced.</para>
 						</variable>
 						<variable name="LIMIT_WARNING_FILE">
 							<value name="filename"/>
-							<para>If specified, <replaceable>filename</replaceable> specifies the sound prompt to play as a warning when time <replaceable>x</replaceable> is reached. If not set, the time remaining will be announced.</para>
+							<para>If specified, <replaceable>filename</replaceable> specifies the sound prompt to play as
+							a warning when time <replaceable>x</replaceable> is reached. If not set, the time remaining will be announced.</para>
 						</variable>
 					</variablelist>
 				</option>
@@ -383,7 +386,7 @@
 			If the <variable>OUTBOUND_GROUP_ONCE</variable> variable is set, all peer channels created by this
 			application will be put into that group (as in Set(GROUP()=...). Unlike OUTBOUND_GROUP,
 			however, the variable will be unset after use.</para>
-			
+
 			<para>This application sets the following channel variables:</para>
 			<variablelist>
 				<variable name="DIALEDTIME">
@@ -1499,6 +1502,13 @@
 	struct ast_dial_features *caller_features;
 	int fulldial = 0, num_dialed = 0;
 
+	/* Reset all DIAL variables back to blank, to prevent confusion (in case we don't reset all of them). */
+	pbx_builtin_setvar_helper(chan, "DIALSTATUS", "");
+	pbx_builtin_setvar_helper(chan, "DIALEDPEERNUMBER", "");
+	pbx_builtin_setvar_helper(chan, "DIALEDPEERNAME", "");
+	pbx_builtin_setvar_helper(chan, "ANSWEREDTIME", "");
+	pbx_builtin_setvar_helper(chan, "DIALEDTIME", "");
+
 	if (ast_strlen_zero(data)) {
 		ast_log(LOG_WARNING, "Dial requires an argument (technology/number)\n");
 		pbx_builtin_setvar_helper(chan, "DIALSTATUS", pa.status);
@@ -2002,16 +2012,17 @@
 			struct ast_app *theapp;
 			const char *gosub_result;
 			char *gosub_args, *gosub_argstart;
-
-			res = ast_autoservice_start(chan);
-			if (res) {
+			int res9 = -1;
+
+			res9 = ast_autoservice_start(chan);
+			if (res9) {
 				ast_log(LOG_ERROR, "Unable to start autoservice on calling channel\n");
-				res = -1;
+				res9 = -1;
 			}
 
 			theapp = pbx_findapp("Gosub");
 
-			if (theapp && !res) {
+			if (theapp && !res9) {
 				replace_macro_delimiter(opt_args[OPT_ARG_CALLEE_GOSUB]);
 
 				/* Set where we came from */
@@ -2029,50 +2040,50 @@
 				}
 
 				if (gosub_args) {
-					res = pbx_exec(peer, theapp, gosub_args);
+					res9 = pbx_exec(peer, theapp, gosub_args);
 					ast_pbx_run(peer);
 					ast_free(gosub_args);
 					if (option_debug)
-						ast_log(LOG_DEBUG, "Gosub exited with status %d\n", res);
+						ast_log(LOG_DEBUG, "Gosub exited with status %d\n", res9);
 				} else
 					ast_log(LOG_ERROR, "Could not Allocate string for Gosub arguments -- Gosub Call Aborted!\n");
 
-				res = 0;
-			} else if (!res) {
+				res9 = 0;
+			} else if (!res9) {
 				ast_log(LOG_ERROR, "Could not find application Gosub\n");
-				res = -1;
+				res9 = -1;
 			}
 
 			if (ast_autoservice_stop(chan) < 0) {
 				ast_log(LOG_ERROR, "Could not stop autoservice on calling channel\n");
-				res = -1;
+				res9 = -1;
 			}
 			
 			ast_channel_lock(peer);
 
-			if (!res && (gosub_result = pbx_builtin_getvar_helper(peer, "GOSUB_RESULT"))) {
+			if (!res9 && (gosub_result = pbx_builtin_getvar_helper(peer, "GOSUB_RESULT"))) {
 				char *gosub_transfer_dest;
 
 				if (!strcasecmp(gosub_result, "BUSY")) {
 					ast_copy_string(pa.status, gosub_result, sizeof(pa.status));
 					ast_set_flag64(peerflags, OPT_GO_ON);
-					res = -1;
+					res9 = -1;
 				} else if (!strcasecmp(gosub_result, "CONGESTION") || !strcasecmp(gosub_result, "CHANUNAVAIL")) {
 					ast_copy_string(pa.status, gosub_result, sizeof(pa.status));
 					ast_set_flag64(peerflags, OPT_GO_ON);
-					res = -1;
+					res9 = -1;
 				} else if (!strcasecmp(gosub_result, "CONTINUE")) {
 					/* hangup peer and keep chan alive assuming the macro has changed
 					   the context / exten / priority or perhaps
 					   the next priority in the current exten is desired.
 					*/
 					ast_set_flag64(peerflags, OPT_GO_ON);
-					res = -1;
+					res9 = -1;
 				} else if (!strcasecmp(gosub_result, "ABORT")) {
 					/* Hangup both ends unless the caller has the g flag */
-					res = -1;
+					res9 = -1;
 				} else if (!strncasecmp(gosub_result, "GOTO:", 5) && (gosub_transfer_dest = ast_strdupa(gosub_result + 5))) {
-					res = -1;
+					res9 = -1;
 					/* perform a transfer to a new extension */
 					if (strchr(gosub_transfer_dest, '^')) { /* context^exten^priority*/
 						replace_macro_delimiter(gosub_transfer_dest);
@@ -2161,32 +2172,34 @@
 		snprintf(toast, sizeof(toast), "%ld", (long)(end_time - start_time));
 		pbx_builtin_setvar_helper(chan, "DIALEDTIME", toast);
 
-		if (ast_test_flag64(&opts, OPT_PEER_H)) {
+		if (res != AST_PBX_NO_HANGUP_PEER_PARKED && ast_test_flag64(&opts, OPT_PEER_H)) {
 			ast_log(LOG_NOTICE, "PEER context: %s; PEER exten: %s;  PEER priority: %d\n",
 				peer->context, peer->exten, peer->priority);
 		}
-
-		strcpy(peer->context, chan->context);
-
-		if (ast_test_flag64(&opts, OPT_PEER_H) && ast_exists_extension(peer, peer->context, "h", 1, peer->cid.cid_num)) {
+		if (res != AST_PBX_NO_HANGUP_PEER_PARKED)
+			strcpy(peer->context, chan->context);
+
+		if (res != AST_PBX_NO_HANGUP_PEER_PARKED && ast_test_flag64(&opts, OPT_PEER_H) && ast_exists_extension(peer, peer->context, "h", 1, peer->cid.cid_num)) {
 			int autoloopflag;
 			int found;
+			int res9;
+			
 			strcpy(peer->exten, "h");
 			peer->priority = 1;
 			autoloopflag = ast_test_flag(peer, AST_FLAG_IN_AUTOLOOP); /* save value to restore at the end */
 			ast_set_flag(peer, AST_FLAG_IN_AUTOLOOP);
 
-			while ((res = ast_spawn_extension(peer, peer->context, peer->exten, peer->priority, peer->cid.cid_num, &found, 1)) == 0)
+			while ((res9 = ast_spawn_extension(peer, peer->context, peer->exten, peer->priority, peer->cid.cid_num, &found, 1)) == 0)
 				peer->priority++;
 
-			if (found && res) {
+			if (found && res9) {
 				/* Something bad happened, or a hangup has been requested. */
 				ast_debug(1, "Spawn extension (%s,%s,%d) exited non-zero on '%s'\n", peer->context, peer->exten, peer->priority, peer->name);
 				ast_verb(2, "Spawn extension (%s, %s, %d) exited non-zero on '%s'\n", peer->context, peer->exten, peer->priority, peer->name);
 			}
 			ast_set2_flag(peer, autoloopflag, AST_FLAG_IN_AUTOLOOP);  /* set it back the way it was */
 		}
-		if (res != AST_PBX_NO_HANGUP_PEER) {
+		if (res != AST_PBX_NO_HANGUP_PEER && res != AST_PBX_NO_HANGUP_PEER_PARKED) {
 			if (!ast_check_hangup(peer) && ast_test_flag64(&opts, OPT_CALLEE_GO_ON) && !ast_strlen_zero(opt_args[OPT_ARG_CALLEE_GO_ON])) {		
 				replace_macro_delimiter(opt_args[OPT_ARG_CALLEE_GO_ON]);
 				ast_parseable_goto(peer, opt_args[OPT_ARG_CALLEE_GO_ON]);
@@ -2199,23 +2212,28 @@
 		}
 	}
 out:
-	if (moh) {
-		moh = 0;
-		ast_moh_stop(chan);
-	} else if (sentringing) {
-		sentringing = 0;
-		ast_indicate(chan, -1);
-	}
-	ast_channel_early_bridge(chan, NULL);
-	hanguptree(outgoing, NULL, 0); /* In this case, there's no answer anywhere */
-	pbx_builtin_setvar_helper(chan, "DIALSTATUS", pa.status);
-	senddialendevent(chan, 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 (calldurationlimit)
-			memset(&chan->whentohangup, 0, sizeof(chan->whentohangup));
-		res = 0;
+	/* cleaning up chan is not a good idea here if AST_PBX_KEEPALIVE
+	   is returned; chan will get the love it needs from another
+	   thread */
+	if (res != AST_PBX_KEEPALIVE) {
+		if (moh) {
+			moh = 0;
+			ast_moh_stop(chan);
+		} else if (sentringing) {
+			sentringing = 0;
+			ast_indicate(chan, -1);
+		}
+		ast_channel_early_bridge(chan, NULL);
+		hanguptree(outgoing, NULL, 0); /* In this case, there's no answer anywhere */
+		pbx_builtin_setvar_helper(chan, "DIALSTATUS", pa.status);
+		senddialendevent(chan, 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 (calldurationlimit)
+				memset(&chan->whentohangup, 0, sizeof(chan->whentohangup));
+			res = 0;
+		}
 	}
 
 done:

Modified: team/group/appdocsxml/apps/app_directory.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/apps/app_directory.c?view=diff&rev=152687&r1=152686&r2=152687
==============================================================================
--- team/group/appdocsxml/apps/app_directory.c (original)
+++ team/group/appdocsxml/apps/app_directory.c Wed Oct 29 19:32:52 2008
@@ -159,6 +159,10 @@
 {
 	char digit;
 
+	if (ast_strlen_zero(text)) {
+		return -1;
+	}
+
 	while (*template) {
 		digit = toupper(*text++);
 		switch (digit) {

Modified: team/group/appdocsxml/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/apps/app_queue.c?view=diff&rev=152687&r1=152686&r2=152687
==============================================================================
--- team/group/appdocsxml/apps/app_queue.c (original)
+++ team/group/appdocsxml/apps/app_queue.c Wed Oct 29 19:32:52 2008
@@ -3993,21 +3993,24 @@
 		/* If the queue member did an attended transfer, then the TRANSFER already was logged in the queue_log
 		 * when the masquerade occurred. These other "ending" queue_log messages are unnecessary
 		 */
-		if (!attended_transfer_occurred(qe->chan)) {
+		if (bridge != AST_PBX_KEEPALIVE && !attended_transfer_occurred(qe->chan)) {
 			struct ast_datastore *transfer_ds;
 			if (strcasecmp(oldcontext, qe->chan->context) || strcasecmp(oldexten, qe->chan->exten)) {
 				ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "TRANSFER", "%s|%s|%ld|%ld|%d",
 					qe->chan->exten, qe->chan->context, (long) (callstart - qe->start),
 					(long) (time(NULL) - callstart), qe->opos);
-				send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), TRANSFER);
+				if (bridge != AST_PBX_NO_HANGUP_PEER && bridge != AST_PBX_NO_HANGUP_PEER_PARKED)
+					send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), TRANSFER);
 			} else if (ast_check_hangup(qe->chan)) {
 				ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "COMPLETECALLER", "%ld|%ld|%d",
 					(long) (callstart - qe->start), (long) (time(NULL) - callstart), qe->opos);
-				send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), CALLER);
+				if (bridge != AST_PBX_NO_HANGUP_PEER && bridge != AST_PBX_NO_HANGUP_PEER_PARKED)
+					send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), CALLER);
 			} else {
 				ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "COMPLETEAGENT", "%ld|%ld|%d",
 					(long) (callstart - qe->start), (long) (time(NULL) - callstart), qe->opos);
-				send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), AGENT);
+				if (bridge != AST_PBX_NO_HANGUP_PEER && bridge != AST_PBX_NO_HANGUP_PEER_PARKED)
+					send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), AGENT);
 			}
 			ast_channel_lock(qe->chan);
 			transfer_ds = ast_channel_datastore_find(qe->chan, &queue_transfer_info, NULL);
@@ -4019,7 +4022,7 @@
 			update_queue(qe->parent, member, callcompletedinsl);
 		}
 
-		if (bridge != AST_PBX_NO_HANGUP_PEER)
+		if (bridge != AST_PBX_NO_HANGUP_PEER && bridge != AST_PBX_NO_HANGUP_PEER_PARKED)
 			ast_hangup(peer);
 		res = bridge ? bridge : 1;
 		ao2_ref(member, -1);

Modified: team/group/appdocsxml/apps/app_stack.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/apps/app_stack.c?view=diff&rev=152687&r1=152686&r2=152687
==============================================================================
--- team/group/appdocsxml/apps/app_stack.c (original)
+++ team/group/appdocsxml/apps/app_stack.c Wed Oct 29 19:32:52 2008
@@ -118,8 +118,6 @@
 
 static void gosub_release_frame(struct ast_channel *chan, struct gosub_stack_frame *frame)
 {
-	unsigned char i;
-	char argname[15];
 	struct ast_var_t *vardata;
 
 	/* If chan is not defined, then we're calling it as part of gosub_free,
@@ -128,14 +126,6 @@
 	 * that frame, so that we re-expose the variables from the previous frame
 	 * that were hidden by this one.
 	 */
-	if (chan) {
-		for (i = 1; i <= frame->arguments && i != 0; i++) {
-			snprintf(argname, sizeof(argname), "ARG%hhd", i);
-			pbx_builtin_setvar_helper(chan, argname, NULL);
-		}
-	}
-
-	/* Delete local variables */
 	while ((vardata = AST_LIST_REMOVE_HEAD(&frame->varshead, entries))) {
 		if (chan)
 			pbx_builtin_setvar_helper(chan, ast_var_name(vardata), NULL);	
@@ -295,6 +285,8 @@
 		frame_set_var(chan, newframe, argname, args2.argval[i]);
 		ast_debug(1, "Setting '%s' to '%s'\n", argname, args2.argval[i]);
 	}
+	snprintf(argname, sizeof(argname), "%d", args2.argc);
+	frame_set_var(chan, newframe, "ARGC", argname);
 
 	/* And finally, save our return address */
 	oldlist = stack_store->data;

Modified: team/group/appdocsxml/apps/app_transfer.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/apps/app_transfer.c?view=diff&rev=152687&r1=152686&r2=152687
==============================================================================
--- team/group/appdocsxml/apps/app_transfer.c (original)
+++ team/group/appdocsxml/apps/app_transfer.c Wed Oct 29 19:32:52 2008
@@ -42,12 +42,9 @@
 			Transfer caller to remote extension.
 		</synopsis>
 		<syntax>
-			<parameter name="destination" required="true" argsep="/">
+			<parameter name="dest" required="true" argsep="/">
 				<argument name="Tech" />
-				<argument name="dest" required="true" />
-			</parameter>
-			<parameter name="options">
-				<para>No options available.</para>
+				<argument name="destination" required="true" />
 			</parameter>
 		</syntax>
 		<description>
@@ -88,20 +85,16 @@
 	char *parse;
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(dest);
-		AST_APP_ARG(options);
 	);
 
 	if (ast_strlen_zero((char *)data)) {
-		ast_log(LOG_WARNING, "Transfer requires an argument ([Tech/]destination[,options])\n");
+		ast_log(LOG_WARNING, "Transfer requires an argument ([Tech/]destination)\n");
 		pbx_builtin_setvar_helper(chan, "TRANSFERSTATUS", "FAILURE");
 		return 0;
 	} else
 		parse = ast_strdupa(data);
 
 	AST_STANDARD_APP_ARGS(args, parse);
-
-	if (args.options) {
-	}
 
 	dest = args.dest;
 

Modified: team/group/appdocsxml/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/apps/app_voicemail.c?view=diff&rev=152687&r1=152686&r2=152687
==============================================================================
--- team/group/appdocsxml/apps/app_voicemail.c (original)
+++ team/group/appdocsxml/apps/app_voicemail.c Wed Oct 29 19:32:52 2008
@@ -3889,7 +3889,7 @@
 				}
 				fprintf(p, "%s %s <%s>" ENDL, first_line ? "From:" : "", passdata, who);
 			} else {
-				fprintf(p, "From: %s <%s>" ENDL, quote(passdata, passdata2, len_passdata2), who);
+				fprintf(p, "From: %s <%s>" ENDL, quote(passdata2, passdata, len_passdata), who);
 			}
 			ast_channel_free(ast);
 		} else {

Modified: team/group/appdocsxml/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/channels/chan_dahdi.c?view=diff&rev=152687&r1=152686&r2=152687
==============================================================================
--- team/group/appdocsxml/channels/chan_dahdi.c (original)
+++ team/group/appdocsxml/channels/chan_dahdi.c Wed Oct 29 19:32:52 2008
@@ -13763,8 +13763,6 @@
 				confp->chan.buf_no = numbufs;
 			if (!strcasecmp(policy, "full")) {
 				confp->chan.buf_policy = DAHDI_POLICY_WHEN_FULL;
-			} else if (!strcasecmp(policy, "half")) {
-				confp->chan.buf_policy = DAHDI_POLICY_IMMEDIATE /*HALF_FULL*/;
 			} else if (!strcasecmp(policy, "immediate")) {
 				confp->chan.buf_policy = DAHDI_POLICY_IMMEDIATE;
 			} else {

Modified: team/group/appdocsxml/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/channels/chan_local.c?view=diff&rev=152687&r1=152686&r2=152687
==============================================================================
--- team/group/appdocsxml/channels/chan_local.c (original)
+++ team/group/appdocsxml/channels/chan_local.c Wed Oct 29 19:32:52 2008
@@ -505,11 +505,15 @@
 	 * Note that cid_num and cid_name aren't passed in the ast_channel_alloc
 	 * call, so it's done here instead.
 	 */
+	p->chan->cid.cid_dnid = ast_strdup(p->owner->cid.cid_dnid);
 	p->chan->cid.cid_num = ast_strdup(p->owner->cid.cid_num);
 	p->chan->cid.cid_name = ast_strdup(p->owner->cid.cid_name);
 	p->chan->cid.cid_rdnis = ast_strdup(p->owner->cid.cid_rdnis);
 	p->chan->cid.cid_ani = ast_strdup(p->owner->cid.cid_ani);
 	p->chan->cid.cid_pres = p->owner->cid.cid_pres;
+	p->chan->cid.cid_ani2 = p->owner->cid.cid_ani2;
+	p->chan->cid.cid_ton = p->owner->cid.cid_ton;
+	p->chan->cid.cid_tns = p->owner->cid.cid_tns;
 	ast_string_field_set(p->chan, language, p->owner->language);
 	ast_string_field_set(p->chan, accountcode, p->owner->accountcode);
 	ast_cdr_update(p->chan);

Modified: team/group/appdocsxml/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/channels/chan_mgcp.c?view=diff&rev=152687&r1=152686&r2=152687
==============================================================================
--- team/group/appdocsxml/channels/chan_mgcp.c (original)
+++ team/group/appdocsxml/channels/chan_mgcp.c Wed Oct 29 19:32:52 2008
@@ -3431,8 +3431,9 @@
 			ast_verb(1, "Reloading MGCP\n");
 			reload_config(1);
 			/* Add an I/O event to our UDP socket */
-			if (mgcpsock > -1) 
+			if (mgcpsock > -1 && !mgcpsock_read_id) {
 				mgcpsock_read_id = ast_io_add(io, mgcpsock, mgcpsock_read, AST_IO_IN, NULL);
+			}
 		}
 
 		/* Check for interfaces needing to be killed */

Modified: team/group/appdocsxml/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/channels/chan_sip.c?view=diff&rev=152687&r1=152686&r2=152687
==============================================================================
--- team/group/appdocsxml/channels/chan_sip.c (original)
+++ team/group/appdocsxml/channels/chan_sip.c Wed Oct 29 19:32:52 2008
@@ -7264,7 +7264,7 @@
 				struct sockaddr_in peer;
 				ast_rtp_get_peer(p->rtp, &peer);
 				if (peer.sin_addr.s_addr) {
-					memcpy(&sin.sin_addr, &peer.sin_addr, sizeof(&sin.sin_addr));
+					memcpy(&sin.sin_addr, &peer.sin_addr, sizeof(sin.sin_addr));
 					if (debug) {
 						ast_log(LOG_DEBUG, "Peer T.38 UDPTL is set behind NAT and with destination, destination address now %s\n", ast_inet_ntoa(sin.sin_addr));
 					}

Modified: team/group/appdocsxml/configs/features.conf.sample
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/configs/features.conf.sample?view=diff&rev=152687&r1=152686&r2=152687
==============================================================================
--- team/group/appdocsxml/configs/features.conf.sample (original)
+++ team/group/appdocsxml/configs/features.conf.sample Wed Oct 29 19:32:52 2008
@@ -52,12 +52,12 @@
 
 
 [featuremap]
-;blindxfer => #1		; Blind transfer  (default is #)
-;disconnect => *0		; Disconnect  (default is *)
-;automon => *1			; One Touch Record a.k.a. Touch Monitor
-;atxfer => *2			; Attended transfer
-;parkcall => #72                ; Park call (one step parking)
-;automixmon => *3		; One Touch Record a.k.a. Touch MixMonitor
+;blindxfer => #1		; Blind transfer  (default is #) -- Make sure to set the T and/or t option in the Dial() or Queue() app call!
+;disconnect => *0		; Disconnect  (default is *) -- Make sure to set the H and/or h option in the Dial() or Queue() app call!
+;automon => *1			; One Touch Record a.k.a. Touch Monitor -- Make sure to set the W and/or w option in the Dial() or Queue() app call!
+;atxfer => *2			; Attended transfer  -- Make sure to set the T and/or t option in the Dial() or Queue()  app call!
+;parkcall => #72        ; Park call (one step parking)  -- Make sure to set the K and/or K option in the Dial() app call!
+;automixmon => *3		; One Touch Record a.k.a. Touch MixMonitor -- Make sure to set the X and/or x option in the Dial() or Queue() app call!
 
 [applicationmap]
 ; Note that the DYNAMIC_FEATURES channel variable must be set to use the features

Modified: team/group/appdocsxml/configs/phoneprov.conf.sample
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/configs/phoneprov.conf.sample?view=diff&rev=152687&r1=152686&r2=152687
==============================================================================
--- team/group/appdocsxml/configs/phoneprov.conf.sample (original)
+++ team/group/appdocsxml/configs/phoneprov.conf.sample Wed Oct 29 19:32:52 2008
@@ -53,6 +53,46 @@
 static_file => sip.ver,plain/text
 static_file => sip.cfg
 static_file => custom.cfg
+static_file => 2201-06642-001.bootrom.ld,application/octet-stream 
+static_file => 2201-06642-001.sip.ld,application/octet-stream 
+static_file => 2345-11000-001.bootrom.ld,application/octet-stream 
+static_file => 2345-11300-001.bootrom.ld,application/octet-stream
+static_file => 2345-11300-010.bootrom.ld,application/octet-stream
+static_file => 2345-11300-010.sip.ld,application/octet-stream
+static_file => 2345-11402-001.bootrom.ld,application/octet-stream 
+static_file => 2345-11402-001.sip.ld,application/octet-stream 
+static_file => 2345-11500-001.bootrom.ld,application/octet-stream 
+static_file => 2345-11500-010.bootrom.ld,application/octet-stream 
+static_file => 2345-11500-020.bootrom.ld,application/octet-stream 
+static_file => 2345-11500-030.bootrom.ld,application/octet-stream 
+static_file => 2345-11500-030.sip.ld,application/octet-stream 
+static_file => 2345-11500-040.bootrom.ld,application/octet-stream 
+static_file => 2345-11500-040.sip.ld,application/octet-stream 
+static_file => 2345-11600-001.bootrom.ld,application/octet-stream 
+static_file => 2345-11600-001.sip.ld,application/octet-stream 
+static_file => 2345-11605-001.bootrom.ld,application/octet-stream 
+static_file => 2345-11605-001.sip.ld,application/octet-stream 
+static_file => 2345-12200-001.bootrom.ld,application/octet-stream 
+static_file => 2345-12200-001.sip.ld,application/octet-stream 
+static_file => 2345-12200-002.bootrom.ld,application/octet-stream 
+static_file => 2345-12200-002.sip.ld,application/octet-stream 
+static_file => 2345-12200-004.bootrom.ld,application/octet-stream
+static_file => 2345-12200-004.sip.ld,application/octet-stream
+static_file => 2345-12200-005.bootrom.ld,application/octet-stream
+static_file => 2345-12200-005.sip.ld,application/octet-stream
+static_file => 2345-12500-001.bootrom.ld,application/octet-stream
+static_file => 2345-12500-001.sip.ld,application/octet-stream 
+static_file => 2345-12560-001.bootrom.ld,application/octet-stream 
+static_file => 2345-12560-001.sip.ld,application/octet-stream 
+static_file => 2345-12600-001.bootrom.ld,application/octet-stream 
+static_file => 2345-12600-001.sip.ld,application/octet-stream
+static_file => 2345-12670-001.bootrom.ld,application/octet-stream
+static_file => 2345-12670-001.sip.ld,application/octet-stream
+static_file => 3111-15600-001.bootrom.ld,application/octet-stream
+static_file => 3111-15600-001.sip.ld,application/octet-stream
+static_file => 3111-40000-001.bootrom.ld,application/octet-stream
+static_file => 3111-40000-001.sip.ld,application/octet-stream
+
 ${MAC}.cfg => 000000000000.cfg               ; Dynamically generated files.
 ${MAC}-phone.cfg => 000000000000-phone.cfg   ; (relative to AST_DATA_DIR/phoneprov)
 config/${MAC} => polycom.xml                 ; Dynamic Filename => template file 

Modified: team/group/appdocsxml/include/asterisk/features.h
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/include/asterisk/features.h?view=diff&rev=152687&r1=152686&r2=152687
==============================================================================
--- team/group/appdocsxml/include/asterisk/features.h (original)
+++ team/group/appdocsxml/include/asterisk/features.h Wed Oct 29 19:32:52 2008
@@ -61,14 +61,15 @@
 };
 
 
-#define AST_FEATURE_RETURN_HANGUP            -1
-#define AST_FEATURE_RETURN_SUCCESSBREAK      0
-#define AST_FEATURE_RETURN_PBX_KEEPALIVE     AST_PBX_KEEPALIVE
-#define AST_FEATURE_RETURN_NO_HANGUP_PEER    AST_PBX_NO_HANGUP_PEER
-#define AST_FEATURE_RETURN_PASSDIGITS        21
-#define AST_FEATURE_RETURN_STOREDIGITS       22
-#define AST_FEATURE_RETURN_SUCCESS           23
-#define AST_FEATURE_RETURN_KEEPTRYING        24
+#define AST_FEATURE_RETURN_HANGUP                   -1
+#define AST_FEATURE_RETURN_SUCCESSBREAK             0
+#define AST_FEATURE_RETURN_PBX_KEEPALIVE            AST_PBX_KEEPALIVE
+#define AST_FEATURE_RETURN_NO_HANGUP_PEER           AST_PBX_NO_HANGUP_PEER
+#define AST_FEATURE_RETURN_NO_HANGUP_PEER_PARKED    AST_PBX_NO_HANGUP_PEER_PARKED
+#define AST_FEATURE_RETURN_PASSDIGITS               21
+#define AST_FEATURE_RETURN_STOREDIGITS              22
+#define AST_FEATURE_RETURN_SUCCESS                  23
+#define AST_FEATURE_RETURN_KEEPTRYING               24
 
 
 /*!

Modified: team/group/appdocsxml/include/asterisk/pbx.h
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/include/asterisk/pbx.h?view=diff&rev=152687&r1=152686&r2=152687
==============================================================================
--- team/group/appdocsxml/include/asterisk/pbx.h (original)
+++ team/group/appdocsxml/include/asterisk/pbx.h Wed Oct 29 19:32:52 2008
@@ -38,12 +38,13 @@
 #define AST_PBX_REPLACE 1
 
 /*! \brief Special return values from applications to the PBX { */
-#define AST_PBX_HANGUP	        -1	/*!< Jump to the 'h' exten */
-#define AST_PBX_OK	        0	/*!< No errors */
-#define AST_PBX_ERROR	        1	/*!< Jump to the 'e' exten */
-#define AST_PBX_KEEPALIVE	10	/*!< Destroy the thread, but don't hang up the channel */
-#define AST_PBX_NO_HANGUP_PEER	11
-#define AST_PBX_INCOMPLETE	12	/*!< Return to PBX matching, allowing more digits for the extension */
+#define AST_PBX_HANGUP                -1    /*!< Jump to the 'h' exten */
+#define AST_PBX_OK                     0    /*!< No errors */
+#define AST_PBX_ERROR                  1    /*!< Jump to the 'e' exten */
+#define AST_PBX_KEEPALIVE              10   /*!< Destroy the thread, but don't hang up the channel */
+#define AST_PBX_NO_HANGUP_PEER         11   /*!< The peer has been involved in a transfer */
+#define AST_PBX_INCOMPLETE             12   /*!< Return to PBX matching, allowing more digits for the extension */
+#define AST_PBX_NO_HANGUP_PEER_PARKED  13   /*!< Don't touch the peer channel - it was sent to the parking lot and might be gone by now */
 /*! } */
 
 #define PRIORITY_HINT	-1	/*!< Special Priority for a hint */

Modified: team/group/appdocsxml/main/features.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/main/features.c?view=diff&rev=152687&r1=152686&r2=152687
==============================================================================
--- team/group/appdocsxml/main/features.c (original)
+++ team/group/appdocsxml/main/features.c Wed Oct 29 19:32:52 2008
@@ -836,7 +836,7 @@
 			res = ast_park_call(parkee, parker, 0, NULL);
 			if (!res) {
 				if (sense == FEATURE_SENSE_CHAN) {
-					res = AST_PBX_NO_HANGUP_PEER;
+					res = AST_PBX_NO_HANGUP_PEER_PARKED;
 				} else {
 					res = AST_PBX_KEEPALIVE;
 				}
@@ -1186,7 +1186,7 @@
 			   the thread dies -- We have to be careful now though.  We are responsible for 
 			   hanging up the channel, else it will never be hung up! */
 
-			return (transferer == peer) ? AST_PBX_KEEPALIVE : AST_PBX_NO_HANGUP_PEER;
+			return (transferer == peer) ? AST_PBX_KEEPALIVE : AST_PBX_NO_HANGUP_PEER_PARKED;
 		} else {
 			ast_log(LOG_WARNING, "Unable to park call %s\n", transferee->name);
 		}
@@ -1789,6 +1789,8 @@
 	}
 	else if (res == AST_PBX_NO_HANGUP_PEER)
 		return AST_FEATURE_RETURN_NO_HANGUP_PEER;
+	else if (res == AST_PBX_NO_HANGUP_PEER_PARKED)
+		return AST_FEATURE_RETURN_NO_HANGUP_PEER_PARKED;
 	else if (res)
 		return AST_FEATURE_RETURN_SUCCESSBREAK;
 	
@@ -2436,10 +2438,12 @@
 
 	}
    before_you_go:
-	new_chan_cdr = pick_unlocked_cdr(chan->cdr); /* the proper chan cdr, if there are forked cdrs */
-	new_peer_cdr = pick_unlocked_cdr(peer->cdr); /* the proper chan cdr, if there are forked cdrs */
-
-	if (!ast_test_flag(&(config->features_caller),AST_FEATURE_NO_H_EXTEN) && ast_exists_extension(chan, chan->context, "h", 1, chan->cid.cid_num)) {
+
+	/* run the hangup exten on the chan object IFF it was NOT involved in a parking situation 
+	 * if it were, then chan belongs to a different thread now, and might have been hung up long
+     * ago.
+	 */
+	if (res != AST_PBX_KEEPALIVE && !ast_test_flag(&(config->features_caller),AST_FEATURE_NO_H_EXTEN) && ast_exists_extension(chan, chan->context, "h", 1, chan->cid.cid_num)) {
 		struct ast_cdr *swapper;
 		char savelastapp[AST_MAX_EXTENSION];
 		char savelastdata[AST_MAX_EXTENSION];
@@ -2483,39 +2487,57 @@
 		ast_copy_string(bridge_cdr->lastdata, savelastdata, sizeof(bridge_cdr->lastdata));
 	}
 
-	/* obey the NoCDR() wishes. */
- 	if (new_chan_cdr && ast_test_flag(new_chan_cdr, AST_CDR_FLAG_POST_DISABLED) && new_peer_cdr && !ast_test_flag(new_peer_cdr, AST_CDR_FLAG_POST_DISABLED))
- 		ast_set_flag(new_peer_cdr, AST_CDR_FLAG_POST_DISABLED); /* DISABLED is viral-- it will propagate across a bridge */
- 	if (!new_chan_cdr || (new_chan_cdr && !ast_test_flag(new_chan_cdr, AST_CDR_FLAG_POST_DISABLED))) {
- 		struct ast_channel *chan_ptr = NULL;
-		
-		ast_cdr_end(bridge_cdr);
-		
-		ast_cdr_detach(bridge_cdr);
-		
- 		/* do a specialized reset on the beginning channel
- 		   CDR's, if they still exist, so as not to mess up
- 		   issues in future bridges;
-  
- 		   Here are the rules of the game:
- 		   1. The chan and peer channel pointers will not change
- 		      during the life of the bridge.
- 		   2. But, in transfers, the channel names will change.
-		      between the time the bridge is started, and the
-		      time the channel ends. 
-		      Usually, when a channel changes names, it will
-		      also change CDR pointers.
-		   3. Usually, only one of the two channels (chan or peer)
-		      will change names.
-		   4. Usually, if a channel changes names during a bridge,
-		      it is because of a transfer. Usually, in these situations,
-		      it is normal to see 2 bridges running simultaneously, and
-		      it is not unusual to see the two channels that change
-		      swapped between bridges.
- 		   5. After a bridge occurs, we have 2 or 3 channels' CDRs
- 		      to attend to; if the chan or peer changed names,
- 		      we have the before and after attached CDR's.
-		*/
+	/* obey the NoCDR() wishes. -- move the DISABLED flag to the bridge CDR if it was set on the channel during the bridge... */
+	if (res != AST_PBX_KEEPALIVE) {
+		new_chan_cdr = pick_unlocked_cdr(chan->cdr); /* the proper chan cdr, if there are forked cdrs */
+		if (new_chan_cdr && ast_test_flag(new_chan_cdr, AST_CDR_FLAG_POST_DISABLED))
+			ast_set_flag(bridge_cdr, AST_CDR_FLAG_POST_DISABLED);
+	}
+
+	/* we can post the bridge CDR at this point */
+	ast_cdr_end(bridge_cdr);
+	ast_cdr_detach(bridge_cdr);
+	
+	/* do a specialized reset on the beginning channel
+	   CDR's, if they still exist, so as not to mess up
+	   issues in future bridges;
+	   
+	   Here are the rules of the game:
+	   1. The chan and peer channel pointers will not change
+	      during the life of the bridge.
+	   2. But, in transfers, the channel names will change.
+	      between the time the bridge is started, and the
+	      time the channel ends. 
+	      Usually, when a channel changes names, it will
+	      also change CDR pointers.
+	   3. Usually, only one of the two channels (chan or peer)
+	      will change names.
+	   4. Usually, if a channel changes names during a bridge,
+	      it is because of a transfer. Usually, in these situations,
+	      it is normal to see 2 bridges running simultaneously, and
+	      it is not unusual to see the two channels that change
+	      swapped between bridges.
+	   5. After a bridge occurs, we have 2 or 3 channels' CDRs
+	      to attend to; if the chan or peer changed names,
+	      we have the before and after attached CDR's.
+	   6. Parking has to be accounted for in the code:
+	      a. Parking will cause ast_bridge_call to return
+	         either AST_PBX_NO_HANGUP_PEER or AST_PBX_NO_HANGUP_PEER_PARKED;
+			 in the latter case, peer is (most likely) a bad
+			 pointer, you can no longer deref it. If it does still
+			 exist, it is under another's thread control, and
+			 could be destroyed at any time.
+          b. The same applies to AST_PBX_KEEPALIVE, in which
+		     case, the chan ptr cannot be used, as another thread
+			 owns it and may have destroyed the channel.
+	      c. In the former case, you need to check peer to see if it 
+	         still exists before you deref it, and obtain a lock.
+	      d. In neither case should you do an ast_hangup(peer).
+		  e. Do not overwrite the result code from ast_bridge_call.
+	*/
+	
+	if (res != AST_PBX_KEEPALIVE && new_chan_cdr) {
+		struct ast_channel *chan_ptr = NULL;
  
  		if (strcasecmp(orig_channame, chan->name) != 0) { 
  			/* old channel */
@@ -2538,28 +2560,35 @@
  		} else {
  			ast_cdr_specialized_reset(chan_cdr,0); /* nothing changed, reset the chan_cdr  */
  		}
- 		if (strcasecmp(orig_peername, peer->name) != 0) { 
- 			/* old channel */
- 			chan_ptr = ast_get_channel_by_name_locked(orig_peername);
- 			if (chan_ptr) {
- 				if (!ast_bridged_channel(chan_ptr)) {
- 					struct ast_cdr *cur;
- 					for (cur = chan_ptr->cdr; cur; cur = cur->next) {
+	}
+	
+	if (res != AST_PBX_NO_HANGUP_PEER_PARKED) { /* if the peer was involved in a park, don't even touch it; it's probably gone */
+		struct ast_channel *chan_ptr = NULL;
+		new_peer_cdr = pick_unlocked_cdr(peer->cdr); /* the proper chan cdr, if there are forked cdrs */
+		if (new_chan_cdr && ast_test_flag(new_chan_cdr, AST_CDR_FLAG_POST_DISABLED) && new_peer_cdr && !ast_test_flag(new_peer_cdr, AST_CDR_FLAG_POST_DISABLED))
+			ast_set_flag(new_peer_cdr, AST_CDR_FLAG_POST_DISABLED); /* DISABLED is viral-- it will propagate across a bridge */
+		if (strcasecmp(orig_peername, peer->name) != 0) { 
+			/* old channel */
+			chan_ptr = ast_get_channel_by_name_locked(orig_peername);
+			if (chan_ptr) {
+				if (!ast_bridged_channel(chan_ptr)) {
+					struct ast_cdr *cur;
+					for (cur = chan_ptr->cdr; cur; cur = cur->next) {
 						if (cur == peer_cdr) {
- 							break;
- 						}
- 					}
- 					if (cur)
- 						ast_cdr_specialized_reset(peer_cdr,0);
- 				}
- 				ast_channel_unlock(chan_ptr);
- 			}
- 			/* new channel */
- 			ast_cdr_specialized_reset(new_peer_cdr,0);
- 		} else {
- 			ast_cdr_specialized_reset(peer_cdr,0); /* nothing changed, reset the peer_cdr  */
- 		}
- 	}
+							break;
+						}
+					}
+					if (cur)
+						ast_cdr_specialized_reset(peer_cdr,0);
+				}
+				ast_channel_unlock(chan_ptr);
+			}
+			/* new channel */
+			ast_cdr_specialized_reset(new_peer_cdr,0);
+		} else {
+			ast_cdr_specialized_reset(peer_cdr,0); /* nothing changed, reset the peer_cdr  */
+		}
+	}
 	return res;
 }
 
@@ -3014,7 +3043,7 @@
 		ast_cdr_setdestchan(chan->cdr, peer->name);
 
 		/* Simulate the PBX hanging up */
-		if (res != AST_PBX_NO_HANGUP_PEER)
+		if (res != AST_PBX_NO_HANGUP_PEER && res != AST_PBX_NO_HANGUP_PEER_PARKED)
 			ast_hangup(peer);
 		return res;
 	} else {




More information about the asterisk-commits mailing list