[Asterisk-cvs] asterisk/apps app_dial.c,1.100,1.101

markster at lists.digium.com markster at lists.digium.com
Sun Oct 31 21:20:48 CST 2004


Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv17737/apps

Modified Files:
	app_dial.c 
Log Message:
Make channel variables inheritable by _ (bug #928)


Index: app_dial.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_dial.c,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -d -r1.100 -r1.101
--- app_dial.c	31 Oct 2004 23:34:22 -0000	1.100
+++ app_dial.c	1 Nov 2004 02:23:28 -0000	1.101
@@ -48,7 +48,7 @@
 "Requests one or more channels and places specified outgoing calls on them.\n"
 "As soon as a channel answers, the Dial app will answer the originating\n"
 "channel (if it needs to be answered) and will bridge a call with the channel\n"
-"which first answered. All other calls placed by the Dial app will be hung up\n"
+"which first answered. All other calls placed by the Dial app will be hung up.\n"
 "If a timeout is not specified, the Dial application will wait indefinitely\n"
 "until either one of the called channels answers, the user hangs up, or all\n"
 "channels return busy or error. In general, the dialer will return 0 if it\n"
@@ -482,6 +482,9 @@
 	char toast[80];
 	int play_to_caller=0,play_to_callee=0;
 	int playargs=0, sentringing=0, moh=0;
+	char *varname;
+	int vartype;
+
 	int digit = 0;
 	time_t start_time, answer_time, end_time;
 
@@ -512,9 +515,12 @@
 				if (url) {
 					*url = '\0';
 					url++;
-					ast_log(LOG_DEBUG, "DIAL WITH URL=%s_\n", url);
+					if (option_debug)
+						ast_log(LOG_DEBUG, "DIAL WITH URL=%s_\n", url);
 				} else 
-					ast_log(LOG_DEBUG, "SIMPLE DIAL (NO URL)\n");
+					if (option_debug) {
+						ast_log(LOG_DEBUG, "SIMPLE DIAL (NO URL)\n");
+					}
 				/* /JDG */
 			}
 		}
@@ -792,27 +798,42 @@
 				continue;
 			}
 		}
-		/* If creating a SIP channel, look for a variable called */
-		/* VXML_URL in the calling channel and copy it to the    */
-		/* new channel.                                          */
 
-		/* Check for ALERT_INFO in the SetVar list.  This is for   */
-		/* SIP distinctive ring as per the RFC.  For Cisco 7960s,  */
-		/* SetVar(ALERT_INFO=<x>) where x is an integer value 1-5. */
-		/* However, the RFC says it should be a URL.  -km-         */
-		headp=&chan->varshead;
-		AST_LIST_TRAVERSE(headp,current,entries) {
-			if (!strcasecmp(ast_var_name(current),"VXML_URL") ||
-			    !strcasecmp(ast_var_name(current), "ALERT_INFO") ||
-				!strcasecmp(ast_var_name(current), "OSPTOKEN") ||
-				!strcasecmp(ast_var_name(current), "OSPHANDLE"))
-			{
-				newvar=ast_var_assign(ast_var_name(current),ast_var_value(current));
-				newheadp=&tmp->chan->varshead;
-				AST_LIST_INSERT_HEAD(newheadp,newvar,entries);
+		/* Contitionally copy channel variables to the newly created channel */
+		headp = &chan->varshead;
+		AST_LIST_TRAVERSE(headp, current, entries) {
+			varname = ast_var_full_name(current);
+			vartype = 0;
+			if (varname) {
+				if (varname[0] == '_') {
+					vartype = 1;
+					if (varname[1] == '_')
+						vartype = 2;
+				}
+			}
+			if (vartype == 1) {
+				newvar = ast_var_assign((char*)&(varname[1]), 
+												ast_var_value(current));
+				newheadp = &tmp->chan->varshead;
+				AST_LIST_INSERT_HEAD(newheadp, newvar, entries);
+				if (option_debug)
+					ast_log(LOG_DEBUG, "Copying soft-transferable variable %s.\n", 
+												ast_var_name(newvar));
+			} else if (vartype == 2) {
+				newvar = ast_var_assign(ast_var_full_name(current), 
+												ast_var_value(current));
+				newheadp = &tmp->chan->varshead;
+				AST_LIST_INSERT_HEAD(newheadp, newvar, entries);
+				if (option_debug)
+					ast_log(LOG_DEBUG, "Copying hard-transferable variable %s.\n", 
+												ast_var_name(newvar));
+			} else {
+				if (option_debug)
+					ast_log(LOG_DEBUG, "Not copying variable %s.\n", 
+												ast_var_name(current));
 			}
 		}
-		
+
 		tmp->chan->appl = "AppDial";
 		tmp->chan->data = "(Outgoing Line)";
 		tmp->chan->whentohangup = 0;




More information about the svn-commits mailing list