[asterisk-commits] russell: branch russell/ast_channel_ao2 r185843 - in /team/russell/ast_channe...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Apr 1 13:51:05 CDT 2009


Author: russell
Date: Wed Apr  1 13:51:02 2009
New Revision: 185843

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=185843
Log:
resolve, reset

Modified:
    team/russell/ast_channel_ao2/   (props changed)
    team/russell/ast_channel_ao2/CHANGES
    team/russell/ast_channel_ao2/include/asterisk/stringfields.h
    team/russell/ast_channel_ao2/main/channel.c
    team/russell/ast_channel_ao2/main/manager.c

Propchange: team/russell/ast_channel_ao2/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/russell/ast_channel_ao2/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/russell/ast_channel_ao2/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Apr  1 13:51:02 2009
@@ -1,1 +1,1 @@
-/trunk:1-185696
+/trunk:1-185839

Modified: team/russell/ast_channel_ao2/CHANGES
URL: http://svn.digium.com/svn-view/asterisk/team/russell/ast_channel_ao2/CHANGES?view=diff&rev=185843&r1=185842&r2=185843
==============================================================================
--- team/russell/ast_channel_ao2/CHANGES (original)
+++ team/russell/ast_channel_ao2/CHANGES Wed Apr  1 13:51:02 2009
@@ -26,6 +26,11 @@
 Functions
 ---------
  * The CHANNEL() function now supports the "name" option.
+
+Asterisk Manager Interface
+--------------------------
+ * The Hangup action now accepts a Cause header which may be used to
+   set the channel's hangup cause.
 
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 1.6.1 to Asterisk 1.6.2  -------------

Modified: team/russell/ast_channel_ao2/include/asterisk/stringfields.h
URL: http://svn.digium.com/svn-view/asterisk/team/russell/ast_channel_ao2/include/asterisk/stringfields.h?view=diff&rev=185843&r1=185842&r2=185843
==============================================================================
--- team/russell/ast_channel_ao2/include/asterisk/stringfields.h (original)
+++ team/russell/ast_channel_ao2/include/asterisk/stringfields.h Wed Apr  1 13:51:02 2009
@@ -290,7 +290,7 @@
 		if (*__p__ != (*ptr)) {											\
 			__ast_string_field_release_active((x)->__field_mgr_pool, (*ptr));				\
 		}													\
-		memcpy((void *) *__p__, __d__, __dlen__);								\
+		memcpy(* (void **) __p__, __d__, __dlen__);								\
 	}														\
 	} while (0)
 

Modified: team/russell/ast_channel_ao2/main/channel.c
URL: http://svn.digium.com/svn-view/asterisk/team/russell/ast_channel_ao2/main/channel.c?view=diff&rev=185843&r1=185842&r2=185843
==============================================================================
--- team/russell/ast_channel_ao2/main/channel.c (original)
+++ team/russell/ast_channel_ao2/main/channel.c Wed Apr  1 13:51:02 2009
@@ -2847,6 +2847,13 @@
 					ast_clear_flag(chan, AST_FLAG_EMULATE_DTMF);
 					chan->emulate_dtmf_digit = 0;
 					ast_log(LOG_DTMF, "DTMF end emulation of '%c' queued on %s\n", f->subclass, chan->name);
+					if (chan->audiohooks) {
+						struct ast_frame *old_frame = f;
+						f = ast_audiohook_write_list(chan, chan->audiohooks, AST_AUDIOHOOK_DIRECTION_READ, f);
+						if (old_frame != f) {
+							ast_frfree(old_frame);
+						}
+					}
 				}
 			}
 			break;

Modified: team/russell/ast_channel_ao2/main/manager.c
URL: http://svn.digium.com/svn-view/asterisk/team/russell/ast_channel_ao2/main/manager.c?view=diff&rev=185843&r1=185842&r2=185843
==============================================================================
--- team/russell/ast_channel_ao2/main/manager.c (original)
+++ team/russell/ast_channel_ao2/main/manager.c Wed Apr  1 13:51:02 2009
@@ -1759,24 +1759,44 @@
 static char mandescr_hangup[] =
 "Description: Hangup a channel\n"
 "Variables: \n"
-"	Channel: The channel name to be hungup\n";
+"	Channel: The channel name to be hungup\n"
+"	Cause: numeric hangup cause\n";
 
 static int action_hangup(struct mansession *s, const struct message *m)
 {
 	struct ast_channel *c = NULL;
+	int causecode = 0; /* all values <= 0 mean 'do not set hangupcause in channel' */
 	const char *name = astman_get_header(m, "Channel");
+	const char *cause = astman_get_header(m, "Cause");
 
 	if (ast_strlen_zero(name)) {
 		astman_send_error(s, m, "No channel specified");
 		return 0;
 	}
 
+	if (!ast_strlen_zero(cause)) {
+		char *endptr;
+		causecode = strtol(cause, &endptr, 10);
+		if (causecode < 0 || causecode > 127 || *endptr != '\0') {
+			ast_log(LOG_NOTICE, "Invalid 'Cause: %s' in manager action Hangup\n", cause);
+			/* keep going, better to hangup without cause than to not hang up at all */
+			causecode = 0; /* do not set channel's hangupcause */
+		}
+	}
+
 	if (!(c = ast_channel_get_by_name(name))) {
 		astman_send_error(s, m, "No such channel");
 		return 0;
 	}
 
-	ast_softhangup(c, AST_SOFTHANGUP_EXPLICIT);
+	ast_channel_lock(c);
+	if (causecode > 0) {
+		ast_debug(1, "Setting hangupcause of channel %s to %d (is %d now)\n",
+				c->name, causecode, c->hangupcause);
+		c->hangupcause = causecode;
+	}
+	ast_softhangup_nolock(c, AST_SOFTHANGUP_EXPLICIT);
+	ast_channel_unlock(c);
 
 	c = ast_channel_unref(c);
 




More information about the asterisk-commits mailing list