[asterisk-commits] russell: branch russell/events r59268 - in /team/russell/events: ./ channels/...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Mar 27 12:12:05 MST 2007


Author: russell
Date: Tue Mar 27 14:12:05 2007
New Revision: 59268

URL: http://svn.digium.com/view/asterisk?view=rev&rev=59268
Log:
Merged revisions 59253,59257,59260,59263-59264 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r59253 | murf | 2007-03-27 09:09:12 -0500 (Tue, 27 Mar 2007) | 1 line

Enhancement via 8118: Realtime API extension: add methods store_func and destroy_func, to make Realtime a complete database abstraction
................
r59257 | russell | 2007-03-27 11:25:02 -0500 (Tue, 27 Mar 2007) | 12 lines

Merged revisions 59256 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r59256 | russell | 2007-03-27 11:20:53 -0500 (Tue, 27 Mar 2007) | 4 lines

Convert the RTPQOS function to just be additional parameter of the CHANNEL
function.  This way, it will be possible for other RTP based channel drivers
to expose this information in the future.

........

................
r59260 | russell | 2007-03-27 13:08:59 -0500 (Tue, 27 Mar 2007) | 20 lines

Merged revisions 59259 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r59259 | russell | 2007-03-27 13:05:46 -0500 (Tue, 27 Mar 2007) | 12 lines

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

........
r59258 | russell | 2007-03-27 13:04:02 -0500 (Tue, 27 Mar 2007) | 4 lines

Fix the use of the "sourceaddress" option when "bindaddr" is set to 0.0.0.0
instead of having each interface explicitly listed.
(issue #7874, patch by stevens)

........

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

................
r59263 | russell | 2007-03-27 13:18:36 -0500 (Tue, 27 Mar 2007) | 11 lines

Merged revisions 59262 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r59262 | russell | 2007-03-27 13:17:47 -0500 (Tue, 27 Mar 2007) | 3 lines

Fix the check that ensures that the CHANNEL function's first argument is "rtpqos".
Thanks, Corydon.  :)

........

................
r59264 | murf | 2007-03-27 13:21:50 -0500 (Tue, 27 Mar 2007) | 9 lines

Merged revisions 59261 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r59261 | murf | 2007-03-27 12:16:32 -0600 (Tue, 27 Mar 2007) | 1 line

via 9373 (duplicate context in AEL crashes asterisk), kpfleming pointed on asterisk-dev, that DECLINE in this case the proper thing to do. This change now has it doing the proper thing.
........

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

Modified:
    team/russell/events/   (props changed)
    team/russell/events/channels/chan_iax2.c
    team/russell/events/channels/chan_sip.c
    team/russell/events/funcs/func_channel.c
    team/russell/events/include/asterisk/config.h
    team/russell/events/pbx/pbx_ael.c

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

Propchange: team/russell/events/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Mar 27 14:12:05 2007
@@ -1,1 +1,1 @@
-/trunk:1-59250
+/trunk:1-59267

Modified: team/russell/events/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/channels/chan_iax2.c?view=diff&rev=59268&r1=59267&r2=59268
==============================================================================
--- team/russell/events/channels/chan_iax2.c (original)
+++ team/russell/events/channels/chan_iax2.c Tue Mar 27 14:12:05 2007
@@ -186,6 +186,7 @@
 static int timingfd = -1;				/* Timing file descriptor */
 
 static struct ast_netsock_list *netsock;
+static struct ast_netsock_list *outsock;		/*!< used if sourceaddress specified and bindaddr == INADDR_ANY */
 static int defaultsockfd = -1;
 
 int (*iax2_regfunk)(const char *username, int onoff) = NULL;
@@ -8479,20 +8480,40 @@
 		if (res == 0) {
 			/* ip address valid. */
 			sin.sin_port = htons(port);
-			sock = ast_netsock_find(netsock, &sin);
+			if (!(sock = ast_netsock_find(netsock, &sin)))
+				sock = ast_netsock_find(outsock, &sin);
 			if (sock) {
 				sockfd = ast_netsock_sockfd(sock);
 				nonlocal = 0;
+			} else {
+				unsigned int orig_saddr = sin.sin_addr.s_addr;
+				/* INADDR_ANY matches anyway! */
+				sin.sin_addr.s_addr = INADDR_ANY;
+				if (ast_netsock_find(netsock, &sin)) {
+					sin.sin_addr.s_addr = orig_saddr;
+					sock = ast_netsock_bind(outsock, io, srcaddr, port, tos, socket_read, NULL);
+					if (sock) {
+						sockfd = ast_netsock_sockfd(sock);
+						ast_netsock_unref(sock);
+						nonlocal = 0;
+					} else {
+						nonlocal = 2;
+					}
+				}
 			}
 		}
 	}
 		
 	peer->sockfd = sockfd;
 
-	if (nonlocal) {
+	if (nonlocal == 1) {
 		ast_log(LOG_WARNING, "Non-local or unbound address specified (%s) in sourceaddress for '%s', reverting to default\n",
 			srcaddr, peer->name);
 		return -1;
+        } else if (nonlocal == 2) {
+		ast_log(LOG_WARNING, "Unable to bind to sourceaddress '%s' for '%s', reverting to default\n",
+			srcaddr, peer->name);
+			return -1;
 	} else {
 		if (option_debug)
 			ast_log(LOG_DEBUG, "Using sourceaddress %s for '%s'\n", srcaddr, peer->name);
@@ -9308,7 +9329,16 @@
 			ast_netsock_unref(ns);
 		}
 	}
-	
+	if (reload) {
+		ast_netsock_release(outsock);
+		outsock = ast_netsock_list_alloc();
+		if (!outsock) {
+			ast_log(LOG_ERROR, "Could not allocate outsock list.\n");
+			return -1;
+		}
+		ast_netsock_init(outsock);
+	}
+
 	if (min_reg_expire > max_reg_expire) {
 		ast_log(LOG_WARNING, "Minimum registration interval of %d is more than maximum of %d, resetting minimum to %d\n",
 			min_reg_expire, max_reg_expire, max_reg_expire);
@@ -10176,6 +10206,7 @@
 		usleep(10000);
 	
 	ast_netsock_release(netsock);
+	ast_netsock_release(outsock);
 	for (x=0;x<IAX_MAX_CALLS;x++)
 		if (iaxs[x])
 			iax2_destroy(x);
@@ -10258,9 +10289,17 @@
 		sched_context_destroy(sched);
 		return AST_MODULE_LOAD_FAILURE;
 	}
-
 	ast_netsock_init(netsock);
 	
+	outsock = ast_netsock_list_alloc();
+	if (!outsock) {
+		ast_log(LOG_ERROR, "Could not allocate outsock list.\n");
+		io_context_destroy(io);
+		sched_context_destroy(sched);
+		return AST_MODULE_LOAD_FAILURE;
+	}
+	ast_netsock_init(outsock);
+
 	ast_cli_register_multiple(cli_iax2, sizeof(cli_iax2) / sizeof(struct ast_cli_entry));
 
 	ast_register_application(papp, iax2_prov_app, psyn, pdescrip);

Modified: team/russell/events/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/channels/chan_sip.c?view=diff&rev=59268&r1=59267&r2=59268
==============================================================================
--- team/russell/events/channels/chan_sip.c (original)
+++ team/russell/events/channels/chan_sip.c Tue Mar 27 14:12:05 2007
@@ -1428,6 +1428,7 @@
 static int sip_addheader(struct ast_channel *chan, void *data);
 static int sip_do_reload(enum channelreloadreason reason);
 static int sip_reload(int fd, int argc, char *argv[]);
+static int acf_channel_read(struct ast_channel *chan, const char *funcname, char *preparse, char *buf, size_t buflen);
 
 /*--- Debugging 
 	Functions for enabling debug per IP or fully, or enabling history logging for
@@ -1593,6 +1594,7 @@
 	.bridge = ast_rtp_bridge,
 	.early_bridge = ast_rtp_early_bridge,
 	.send_text = sip_sendtext,
+	.func_channel_read = acf_channel_read,
 };
 
 /*! \brief This version of the sip channel tech has no send_digit_begin
@@ -14822,12 +14824,13 @@
 	}
 }
 
-static int acf_rtpqos_read(struct ast_channel *chan, const char *funcname, char *preparse, char *buf, size_t buflen)
+static int acf_channel_read(struct ast_channel *chan, const char *funcname, char *preparse, char *buf, size_t buflen)
 {
 	struct ast_rtp_quality qos;
 	struct sip_pvt *p = chan->tech_pvt;
 	char *all = "", *parse = ast_strdupa(preparse);
 	AST_DECLARE_APP_ARGS(args,
+		AST_APP_ARG(param);
 		AST_APP_ARG(type);
 		AST_APP_ARG(field);
 	);
@@ -14836,7 +14839,11 @@
 	/* Sanity check */
 	if (chan->tech != &sip_tech && chan->tech != &sip_tech_info) {
 		ast_log(LOG_ERROR, "Cannot call %s on a non-SIP channel\n", funcname);
-	}
+		return 0;
+	}
+
+	if (strcasecmp(args.param, "rtpqos"))
+		return 0;
 
 	memset(buf, 0, buflen);
 	memset(&qos, 0, sizeof(qos));
@@ -18136,27 +18143,6 @@
 	sip_reload_usage },
 };
 
-struct ast_custom_function acf_rtpqos = {
-	.name = "RTPQOS",
-	.synopsis = "Retrieve statistics about an RTP stream",
-	.desc =
-"The following statistics may be retrieved:\n"
-"  local_ssrc         - Local SSRC (stream ID)\n"
-"  local_lostpackets  - Local lost packets\n"
-"  local_jitter       - Local calculated jitter\n"
-"  local_count        - Number of received packets\n"
-"  remote_ssrc        - Remote SSRC (stream ID)\n"
-"  remote_lostpackets - Remote lost packets\n"
-"  remote_jitter      - Remote reported jitter\n"
-"  remote_count       - Number of transmitted packets\n"
-"  rtt                - Round trip time\n"
-"  all                - All statistics (in a form suited to logging, but not for parsing)\n"
-"\n"
-"Type may be specified as \"audio\", \"video\", or \"text\".\n",
-	.syntax = "RTPQOS(<type>|<field>)",
-	.read = acf_rtpqos_read,
-};
-
 /*! \brief PBX load module - initialization */
 static int load_module(void)
 {
@@ -18206,7 +18192,6 @@
 	ast_custom_function_register(&sippeer_function);
 	ast_custom_function_register(&sipchaninfo_function);
 	ast_custom_function_register(&checksipdomain_function);
-	ast_custom_function_register(&acf_rtpqos);
 
 	/* Register manager commands */
 	ast_manager_register2("SIPpeers", EVENT_FLAG_SYSTEM, manager_sip_show_peers,
@@ -18236,7 +18221,6 @@
 	ast_custom_function_unregister(&sippeer_function);
 	ast_custom_function_unregister(&sip_header_function);
 	ast_custom_function_unregister(&checksipdomain_function);
-	ast_custom_function_unregister(&acf_rtpqos);
 
 	/* Unregister dial plan applications */
 	ast_unregister_application(app_dtmfmode);

Modified: team/russell/events/funcs/func_channel.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/funcs/func_channel.c?view=diff&rev=59268&r1=59267&r2=59268
==============================================================================
--- team/russell/events/funcs/func_channel.c (original)
+++ team/russell/events/funcs/func_channel.c Tue Mar 27 14:12:05 2007
@@ -150,18 +150,37 @@
 	.syntax = "CHANNEL(item)",
 	.desc = "Gets/set various pieces of information about the channel.\n"
 		"Standard items (provided by all channel technologies) are:\n"
-		"R/O	audioreadformat		format currently being read\n"
-		"R/O	audionativeformat 	format used natively for audio\n"
-		"R/O	audiowriteformat 	format currently being written\n"
-		"R/W	callgroup		call groups for call pickup\n"
-		"R/O	channeltype		technology used for channel\n"
-		"R/W	language 		language for sounds played\n"
-		"R/W	musicclass 		class (from musiconhold.conf) for hold music\n"
-		"R/W	rxgain			set rxgain level on channel drivers that support it\n"
-		"R/O	state			state for channel\n"
-		"R/W	tonezone 		zone for indications played\n"
-		"R/W	txgain			set txgain level on channel drivers that support it\n"
-		"R/O	videonativeformat 	format used natively for video\n"
+		"R/O	audioreadformat    format currently being read\n"
+		"R/O	audionativeformat  format used natively for audio\n"
+		"R/O	audiowriteformat   format currently being written\n"
+		"R/W	callgroup          call groups for call pickup\n"
+		"R/O	channeltype        technology used for channel\n"
+		"R/W	language           language for sounds played\n"
+		"R/W	musicclass         class (from musiconhold.conf) for hold music\n"
+		"R/W	rxgain             set rxgain level on channel drivers that support it\n"
+		"R/O	state              state for channel\n"
+		"R/W	tonezone           zone for indications played\n"
+		"R/W	txgain             set txgain level on channel drivers that support it\n"
+		"R/O	videonativeformat  format used natively for video\n"
+		"\n"
+		"chan_sip provides the following additional options:\n"
+		"R/O    rtpqos             Get QOS information about the RTP stream\n"
+		"       This option takes two additional arguments:\n"
+		"  Argument 1:\n"
+		"    audio                 Get data about the audio stream\n"
+		"    video                 Get data about the video stream\n"
+		"    text                  Get data about the text stream\n"
+		"  Argument 2:\n"
+		"    local_ssrc            Local SSRC (stream ID)\n"
+		"    local_lostpackets     Local lost packets\n"
+		"    local_jitter          Local calculated jitter\n"
+		"    local_count           Number of received packets\n"
+		"    remote_ssrc           Remote SSRC (stream ID)\n"
+		"    remote_lostpackets    Remote lost packets\n"
+		"    remote_jitter         Remote reported jitter\n"
+		"    remote_count          Number of transmitted packets\n"
+		"    rtt                   Round trip time\n"
+		"    all                   All statistics (in a form suited to logging, but not for parsing)\n"
 		"\n"
 		"Additional items may be available from the channel driver providing\n"
 		"the channel; see its documentation for details.\n"

Modified: team/russell/events/include/asterisk/config.h
URL: http://svn.digium.com/view/asterisk/team/russell/events/include/asterisk/config.h?view=diff&rev=59268&r1=59267&r2=59268
==============================================================================
--- team/russell/events/include/asterisk/config.h (original)
+++ team/russell/events/include/asterisk/config.h Tue Mar 27 14:12:05 2007
@@ -51,6 +51,8 @@
 typedef struct ast_variable *realtime_var_get(const char *database, const char *table, va_list ap);
 typedef struct ast_config *realtime_multi_get(const char *database, const char *table, va_list ap);
 typedef int realtime_update(const char *database, const char *table, const char *keyfield, const char *entity, va_list ap);
+typedef int realtime_store(const char *database, const char *table, va_list ap);
+typedef int realtime_destroy(const char *database, const char *table, const char *keyfield, const char *entity, va_list ap);
 
 /*! \brief Configuration engine structure, used to define realtime drivers */
 struct ast_config_engine {
@@ -59,6 +61,8 @@
 	realtime_var_get *realtime_func;
 	realtime_multi_get *realtime_multi_func;
 	realtime_update *update_func;
+	realtime_store *store_func;
+	realtime_destroy *destroy_func;
 	struct ast_config_engine *next;
 };
 

Modified: team/russell/events/pbx/pbx_ael.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/pbx/pbx_ael.c?view=diff&rev=59268&r1=59267&r2=59268
==============================================================================
--- team/russell/events/pbx/pbx_ael.c (original)
+++ team/russell/events/pbx/pbx_ael.c Tue Mar 27 14:12:05 2007
@@ -4053,7 +4053,7 @@
 	} else {
 		ast_log(LOG_ERROR, "Sorry, but %d syntax errors and %d semantic errors were detected. It doesn't make sense to compile.\n", errs, sem_err);
 		destroy_pval(parse_tree); /* free up the memory */
-		return AST_MODULE_LOAD_FAILURE;
+		return AST_MODULE_LOAD_DECLINE;
 	}
 	destroy_pval(parse_tree); /* free up the memory */
 	



More information about the asterisk-commits mailing list