[svn-commits] branch russell/agent_function - r7507 in /team/russell/agent_function: ./ app...

svn-commits at lists.digium.com svn-commits at lists.digium.com
Fri Dec 16 10:05:01 CST 2005


Author: russell
Date: Fri Dec 16 10:04:58 2005
New Revision: 7507

URL: http://svn.digium.com/view/asterisk?rev=7507&view=rev
Log:
Merged revisions 7469,7471-7472,7481,7494,7496,7498 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r7469 | kpfleming | 2005-12-13 11:07:19 -0500 (Tue, 13 Dec 2005) | 10 lines

Merged revisions 7468 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r7468 | kpfleming | 2005-12-13 10:06:27 -0600 (Tue, 13 Dec 2005) | 2 lines

correct broken math in tvfix() for timestamp values over one million

........

................
r7471 | kpfleming | 2005-12-13 13:54:41 -0500 (Tue, 13 Dec 2005) | 10 lines

Merged revisions 7470 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r7470 | kpfleming | 2005-12-13 12:54:22 -0600 (Tue, 13 Dec 2005) | 2 lines

clarify substring documentation

........

................
r7472 | russell | 2005-12-13 17:03:06 -0500 (Tue, 13 Dec 2005) | 2 lines

reduce some duplicated code when doing a strdup (issue #5986)

................
r7481 | bweschke | 2005-12-14 21:49:17 -0500 (Wed, 14 Dec 2005) | 3 lines

 Bug #6003 - Don't free the channel structure until after having sent the manager event.


................
r7494 | tilghman | 2005-12-15 12:31:52 -0500 (Thu, 15 Dec 2005) | 2 lines

Make sure the functions CUT and SORT are built.

................
r7496 | tilghman | 2005-12-15 14:05:41 -0500 (Thu, 15 Dec 2005) | 2 lines

Properly move these functions over to the funcs directory (since they no longer contain apps)

................
r7498 | tilghman | 2005-12-15 19:55:39 -0500 (Thu, 15 Dec 2005) | 3 lines

First field was truncated.
(Don't kill me; this attempted merge didn't work because the paths changed.)

................

Added:
    team/russell/agent_function/funcs/func_cut.c
      - copied unchanged from r7498, trunk/funcs/func_cut.c
Removed:
    team/russell/agent_function/apps/app_cut.c
Modified:
    team/russell/agent_function/   (props changed)
    team/russell/agent_function/apps/app_macro.c
    team/russell/agent_function/channel.c
    team/russell/agent_function/doc/README.variables
    team/russell/agent_function/utils.c

Propchange: team/russell/agent_function/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Dec 16 10:04:58 2005
@@ -1,1 +1,1 @@
-/trunk:1-7458
+/trunk:1-7506

Modified: team/russell/agent_function/apps/app_macro.c
URL: http://svn.digium.com/view/asterisk/team/russell/agent_function/apps/app_macro.c?rev=7507&r1=7506&r2=7507&view=diff
==============================================================================
--- team/russell/agent_function/apps/app_macro.c (original)
+++ team/russell/agent_function/apps/app_macro.c Fri Dec 16 10:04:58 2005
@@ -86,6 +86,11 @@
 STANDARD_LOCAL_USER;
 
 LOCAL_USER_DECL;
+
+static char *safe_strdup(const char *s)
+{
+	return s ? strdup(s) : NULL;
+}
 
 static int macro_exec(struct ast_channel *chan, void *data)
 {
@@ -162,25 +167,17 @@
 	}
 	argc = 1;
 	/* Save old macro variables */
-	save_macro_exten = pbx_builtin_getvar_helper(chan, "MACRO_EXTEN");
-	if (save_macro_exten) 
-		save_macro_exten = strdup(save_macro_exten);
+	save_macro_exten = safe_strdup(pbx_builtin_getvar_helper(chan, "MACRO_EXTEN"));
 	pbx_builtin_setvar_helper(chan, "MACRO_EXTEN", oldexten);
 
-	save_macro_context = pbx_builtin_getvar_helper(chan, "MACRO_CONTEXT");
-	if (save_macro_context)
-		save_macro_context = strdup(save_macro_context);
+	save_macro_context = safe_strdup(pbx_builtin_getvar_helper(chan, "MACRO_CONTEXT"));
 	pbx_builtin_setvar_helper(chan, "MACRO_CONTEXT", oldcontext);
 
-	save_macro_priority = pbx_builtin_getvar_helper(chan, "MACRO_PRIORITY");
-	if (save_macro_priority) 
-		save_macro_priority = strdup(save_macro_priority);
+	save_macro_priority = safe_strdup(pbx_builtin_getvar_helper(chan, "MACRO_PRIORITY"));
 	snprintf(pc, sizeof(pc), "%d", oldpriority);
 	pbx_builtin_setvar_helper(chan, "MACRO_PRIORITY", pc);
   
-	save_macro_offset = pbx_builtin_getvar_helper(chan, "MACRO_OFFSET");
-	if (save_macro_offset) 
-		save_macro_offset = strdup(save_macro_offset);
+	save_macro_offset = safe_strdup(pbx_builtin_getvar_helper(chan, "MACRO_OFFSET"));
 	pbx_builtin_setvar_helper(chan, "MACRO_OFFSET", NULL);
 
 	/* Setup environment for new run */

Modified: team/russell/agent_function/channel.c
URL: http://svn.digium.com/view/asterisk/team/russell/agent_function/channel.c?rev=7507&r1=7506&r2=7507&view=diff
==============================================================================
--- team/russell/agent_function/channel.c (original)
+++ team/russell/agent_function/channel.c Fri Dec 16 10:04:58 2005
@@ -3055,7 +3055,6 @@
 	if (ast_test_flag(clone, AST_FLAG_ZOMBIE)) {
 		ast_log(LOG_DEBUG, "Destroying channel clone '%s'\n", clone->name);
 		ast_mutex_unlock(&clone->lock);
-		ast_channel_free(clone);
 		manager_event(EVENT_FLAG_CALL, "Hangup", 
 			"Channel: %s\r\n"
 			"Uniqueid: %s\r\n"
@@ -3066,6 +3065,7 @@
 			clone->hangupcause,
 			ast_cause2str(clone->hangupcause)
 			);
+		ast_channel_free(clone);
 	} else {
 		struct ast_frame null_frame = { AST_FRAME_NULL, };
 		ast_log(LOG_DEBUG, "Released clone lock on '%s'\n", clone->name);

Modified: team/russell/agent_function/doc/README.variables
URL: http://svn.digium.com/view/asterisk/team/russell/agent_function/doc/README.variables?rev=7507&r1=7506&r2=7507&view=diff
==============================================================================
--- team/russell/agent_function/doc/README.variables (original)
+++ team/russell/agent_function/doc/README.variables Fri Dec 16 10:04:58 2005
@@ -94,17 +94,17 @@
 
 
 
-_______________________________
-REMOVING CHARACTERS FROM STRING
--------------------------------
-
-The format for removing characters from a variable can be expressed as:
+___________________________________
+SELECTING CHARACTERS FROM VARIABLES
+-----------------------------------
+
+The format for selecting characters from a variable can be expressed as:
 
 	${variable_name[:offset[:length]]}
 
-If you want to remove the first N characters from the string assigned
+If you want to select the first N characters from the string assigned
 to a variable, simply append a colon and the number of characters to
-remove from the beginning of the string to the variable name.
+skip from the beginning of the string to the variable name.
 
 	;Remove the first character of extension, save in "number" variable
 	exten => _9X.,1,Set(number=${EXTEN:1})
@@ -115,7 +115,7 @@
 digit.
 
 If you use a negative offset number, Asterisk starts counting from the end 
-of the string and then removes everything before the new position. The following
+of the string and then selects everything after the new position. The following
 example will save the numbers 1234 to the 'number' variable, still assuming
 we've dialed 918005551234.
 

Modified: team/russell/agent_function/utils.c
URL: http://svn.digium.com/view/asterisk/team/russell/agent_function/utils.c?rev=7507&r1=7506&r2=7507&view=diff
==============================================================================
--- team/russell/agent_function/utils.c (original)
+++ team/russell/agent_function/utils.c Fri Dec 16 10:04:58 2005
@@ -613,11 +613,11 @@
 	if (a.tv_usec >= ONE_MILLION) {
 		ast_log(LOG_WARNING, "warning too large timestamp %ld.%ld\n",
 			a.tv_sec, (long int) a.tv_usec);
-		a.tv_sec += a.tv_usec % ONE_MILLION;
+		a.tv_sec += a.tv_usec / ONE_MILLION;
 		a.tv_usec %= ONE_MILLION;
 	} else if (a.tv_usec < 0) {
 		ast_log(LOG_WARNING, "warning negative timestamp %ld.%ld\n",
-				a.tv_sec, (long int) a.tv_usec);
+			a.tv_sec, (long int) a.tv_usec);
 		a.tv_usec = 0;
 	}
 	return a;



More information about the svn-commits mailing list