[asterisk-commits] dvossel: branch dvossel/sip_stun_support_improved r280912 - in /team/dvossel/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Aug 4 10:31:05 CDT 2010


Author: dvossel
Date: Wed Aug  4 10:31:00 2010
New Revision: 280912

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=280912
Log:
fixes automerge

Added:
    team/dvossel/sip_stun_support_improved/contrib/scripts/get_mp3_source.sh
      - copied unchanged from r280910, trunk/contrib/scripts/get_mp3_source.sh
    team/dvossel/sip_stun_support_improved/doc/Makefile
      - copied unchanged from r280910, trunk/doc/Makefile
Removed:
    team/dvossel/sip_stun_support_improved/addons/mp3/
Modified:
    team/dvossel/sip_stun_support_improved/   (props changed)
    team/dvossel/sip_stun_support_improved/CHANGES
    team/dvossel/sip_stun_support_improved/addons/Makefile
    team/dvossel/sip_stun_support_improved/channels/chan_mgcp.c
    team/dvossel/sip_stun_support_improved/channels/chan_sip.c
    team/dvossel/sip_stun_support_improved/configs/sip.conf.sample
    team/dvossel/sip_stun_support_improved/contrib/realtime/mysql/iaxfriends.sql   (props changed)
    team/dvossel/sip_stun_support_improved/contrib/realtime/mysql/meetme.sql   (props changed)
    team/dvossel/sip_stun_support_improved/contrib/realtime/mysql/sipfriends.sql   (props changed)
    team/dvossel/sip_stun_support_improved/contrib/realtime/mysql/voicemail.sql   (props changed)
    team/dvossel/sip_stun_support_improved/contrib/realtime/postgresql/realtime.sql   (props changed)
    team/dvossel/sip_stun_support_improved/doc/asterisk.8
    team/dvossel/sip_stun_support_improved/doc/asterisk.sgml
    team/dvossel/sip_stun_support_improved/funcs/func_strings.c
    team/dvossel/sip_stun_support_improved/res/res_fax.c

Propchange: team/dvossel/sip_stun_support_improved/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Propchange: team/dvossel/sip_stun_support_improved/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Aug  4 10:31:00 2010
@@ -1,1 +1,1 @@
-/trunk:1-280675
+/trunk:1-280911

Modified: team/dvossel/sip_stun_support_improved/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/sip_stun_support_improved/CHANGES?view=diff&rev=280912&r1=280911&r2=280912
==============================================================================
--- team/dvossel/sip_stun_support_improved/CHANGES (original)
+++ team/dvossel/sip_stun_support_improved/CHANGES Wed Aug  4 10:31:00 2010
@@ -240,6 +240,7 @@
  * Added option to dialplan function CDR(), the 'f' option
    allows for high resolution times for billsec and duration fields.
  * FILE() now supports line-mode and writing.
+ * Added FIELDNUM(), which returns the 1-based offset of a field in a list.
 
 Dialplan Variables
 ------------------

Modified: team/dvossel/sip_stun_support_improved/addons/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/sip_stun_support_improved/addons/Makefile?view=diff&rev=280912&r1=280911&r2=280912
==============================================================================
--- team/dvossel/sip_stun_support_improved/addons/Makefile (original)
+++ team/dvossel/sip_stun_support_improved/addons/Makefile Wed Aug  4 10:31:00 2010
@@ -34,12 +34,32 @@
             format_mp3 \
             res_config_mysql
 
-all: _all
+all: check_mp3 _all
+
+check_mp3:
+ifeq ($(filter format_mp3,$(MENUSELECT_ADDONS)),)
+	@if [ ! -f mp3/Makefile ] ; then \
+		echo ; \
+		echo "**************************************************************" ; \
+		echo "***                                                        ***" ; \
+		echo "***   --->  READ THIS OR YOUR BUILD WILL FAIL  <---        ***" ; \
+		echo "***                                                        ***" ; \
+		echo "*** format_mp3 has been selected to be installed, but the  ***" ; \
+		echo "*** mp3 decoder library has not yet been downloaded into   ***" ; \
+		echo "*** the source tree.  To do so, please run the following   ***" ; \
+		echo "*** command:                                               ***" ; \
+		echo "***                                                        ***" ; \
+		echo "***          $$ contrib/scripts/get_mp3_source.sh           ***" ; \
+		echo "***                                                        ***" ; \
+		echo "**************************************************************" ; \
+		echo ; \
+	fi
+endif
 
 include $(ASTTOPDIR)/Makefile.moddir_rules
 
 clean::
-	$(MAKE) -C mp3 clean
+	if [ -f mp3/Makefile ] ; then $(MAKE) -C mp3 clean ; fi
 	rm -f $(addprefix ooh323c/src/,$(H323OBJS))
 
 $(if $(filter format_mp3,$(EMBEDDED_MODS)),modules.link,format_mp3.so): mp3/common.o mp3/dct64_i386.o mp3/decode_ntom.o mp3/layer3.o mp3/tabinit.o mp3/interface.o
@@ -49,3 +69,5 @@
 $(if $(filter chan_ooh323,$(EMBEDDED_MODS)),modules.link,chan_ooh323.so): _ASTCFLAGS+=$(H323CFLAGS)
 $(if $(filter chan_ooh323,$(EMBEDDED_MODS)),modules.link,chan_ooh323.so): $(addprefix ooh323c/src/,$(H323OBJS)) chan_ooh323.o ooh323cDriver.o
 $(addprefix ooh323c/src/,$(H323OBJS)) chan_ooh323.o ooh323cDriver.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,chan_ooh323)
+
+.PHONY: check_mp3

Modified: team/dvossel/sip_stun_support_improved/channels/chan_mgcp.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/sip_stun_support_improved/channels/chan_mgcp.c?view=diff&rev=280912&r1=280911&r2=280912
==============================================================================
--- team/dvossel/sip_stun_support_improved/channels/chan_mgcp.c (original)
+++ team/dvossel/sip_stun_support_improved/channels/chan_mgcp.c Wed Aug  4 10:31:00 2010
@@ -3580,7 +3580,7 @@
 	if (sscanf(req->identifier, "%30d", &seqno) != 1) {
 		seqno = 0;
 	}
-	for (cur = sub->parent->parent->responses, next = cur->next; cur; cur = next, next = cur->next) {
+	for (cur = sub->parent->parent->responses, next = cur ? cur->next : NULL; cur; cur = next, next = cur ? cur->next : NULL) {
 		if (now - cur->whensent > RESPONSE_TIMEOUT) {
 			/* Delete this entry */
 			if (prev)

Modified: team/dvossel/sip_stun_support_improved/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/sip_stun_support_improved/channels/chan_sip.c?view=diff&rev=280912&r1=280911&r2=280912
==============================================================================
--- team/dvossel/sip_stun_support_improved/channels/chan_sip.c (original)
+++ team/dvossel/sip_stun_support_improved/channels/chan_sip.c Wed Aug  4 10:31:00 2010
@@ -9878,12 +9878,22 @@
 		from = NULL;
 
 	if (from) {
+		int bracket = 0;
+
 		/* Strip any params or options from user */
 		if ((a = strchr(from, ';')))
 			*a = '\0';
 		/* Strip port from domain if present */
-		if ((a = strchr(from, ':')))
-			*a = '\0';
+		for (a = from; *a != '\0'; ++a) {
+			if (*a == ':' && bracket == 0) {
+				*a = '\0';
+				break;
+			} else if (*a == '[') {
+				++bracket;
+			} else if (*a == ']') {
+				--bracket;
+			}
+		}
 		if ((a = strchr(from, '@'))) {
 			*a = '\0';
 			ast_copy_string(domain, a + 1, len);
@@ -14479,17 +14489,27 @@
 	
 	if ((ptr = strchr(refer_to, '@'))) {	/* Separate domain */
 		char *urioption = NULL, *domain;
+		int bracket = 0;
 		*ptr++ = '\0';
 
 		if ((urioption = strchr(ptr, ';'))) { /* Separate urioptions */
 			*urioption++ = '\0';
 		}
-		
+
 		domain = ptr;
-		if ((ptr = strchr(domain, ':'))) {	/* Remove :port */
-			*ptr = '\0';
-		}
-		
+
+		/* Remove :port */
+		for (; *ptr != '\0'; ++ptr) {
+			if (*ptr == ':' && bracket == 0) {
+				*ptr = '\0';
+				break;
+			} else if (*ptr == '[') {
+				++bracket;
+			} else if (*ptr == ']') {
+				--bracket;
+			}
+		}
+
 		SIP_PEDANTIC_DECODE(domain);
 		SIP_PEDANTIC_DECODE(urioption);
 
@@ -27083,10 +27103,12 @@
 
 		/* First our default IP address */
 		if (!ast_sockaddr_isnull(&bindaddr)) {
-			add_sip_domain(ast_sockaddr_stringify(&bindaddr), SIP_DOMAIN_AUTO, NULL);
+			add_sip_domain(ast_sockaddr_stringify_addr(&bindaddr),
+				       SIP_DOMAIN_AUTO, NULL);
 		} else if (!ast_sockaddr_isnull(&internip)) {
 		/* Our internal IP address, if configured */
-			add_sip_domain(ast_sockaddr_stringify(&internip), SIP_DOMAIN_AUTO, NULL);
+			add_sip_domain(ast_sockaddr_stringify_addr(&internip),
+				       SIP_DOMAIN_AUTO, NULL);
 		} else {
 			ast_log(LOG_NOTICE, "Can't add wildcard IP address to domain list, please add IP address to domain manually.\n");
 		}
@@ -27094,7 +27116,7 @@
 		/* If TCP is running on a different IP than UDP, then add it too */
 		if (!ast_sockaddr_isnull(&sip_tcp_desc.local_address) &&
 		    !ast_sockaddr_cmp(&bindaddr, &sip_tcp_desc.local_address)) {
-			add_sip_domain(ast_sockaddr_stringify(&sip_tcp_desc.local_address),
+			add_sip_domain(ast_sockaddr_stringify_addr(&sip_tcp_desc.local_address),
 				       SIP_DOMAIN_AUTO, NULL);
 		}
 
@@ -27103,14 +27125,14 @@
 		    !ast_sockaddr_cmp(&bindaddr, &sip_tls_desc.local_address) &&
 		    !ast_sockaddr_cmp(&sip_tcp_desc.local_address,
 				      &sip_tls_desc.local_address)) {
-			add_sip_domain(ast_sockaddr_stringify(&sip_tcp_desc.local_address),
+			add_sip_domain(ast_sockaddr_stringify_addr(&sip_tcp_desc.local_address),
 				       SIP_DOMAIN_AUTO, NULL);
 		}
 
 		/* Our extern IP address, if configured */
 		if (!ast_sockaddr_isnull(&externaddr)) {
-			add_sip_domain(ast_sockaddr_stringify(&externaddr), SIP_DOMAIN_AUTO,
-				       NULL);
+			add_sip_domain(ast_sockaddr_stringify_addr(&externaddr),
+				       SIP_DOMAIN_AUTO, NULL);
 		}
 
 		/* Extern host name (NAT traversal support) */

Modified: team/dvossel/sip_stun_support_improved/configs/sip.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/sip_stun_support_improved/configs/sip.conf.sample?view=diff&rev=280912&r1=280911&r2=280912
==============================================================================
--- team/dvossel/sip_stun_support_improved/configs/sip.conf.sample (original)
+++ team/dvossel/sip_stun_support_improved/configs/sip.conf.sample Wed Aug  4 10:31:00 2010
@@ -136,6 +136,28 @@
                                 ; In this case Realm will be based on request 'From'/'To' header
                                 ; and should match one of domain names.
                                 ; Otherwise default 'realm=...' will be used.
+
+; With the current situation, you can do one of four things:
+;  a) Listen on a specific IPv4 address.      Example: bindaddr=192.0.2.1
+;  b) Listen on a specific IPv6 address.      Example: bindaddr=2001:db8::1
+;  c) Listen on the IPv4 wildcard.            Example: bindaddr=0.0.0.0
+;  d) Listen on the IPv4 and IPv6 wildcards.  Example: bindaddr=::
+; (You can choose independently for UDP, TCP, and TLS, by specifying different values for
+; "udpbindaddr", "tcpbindaddr", and "tlsbindaddr".)
+;
+; You may optionally add a port number. (The default is port 5060 for UDP and TCP, 5061
+; for TLS).
+;   IPv4 example: bindaddr=0.0.0.0:5062
+;   IPv6 example: bindaddr=[::]:5062
+;
+; The address family of the bound UDP address is used to determine how Asterisk performs
+; DNS lookups. In cases a) and c) above, only A records are considered. In case b), only
+; AAAA records are considered. In case d), both A and AAAA records are considered. Note,
+; however, that Asterisk ignores all records except the first one. In case d), when both A
+; and AAAA records are available, either an A or AAAA record will be first, and which one
+; depends on the operating system. On systems using glibc, AAAA records are given
+; priority.
+
 udpbindaddr=0.0.0.0             ; IP address to bind UDP listen socket to (0.0.0.0 binds to all)
                                 ; Optionally add a port number, 192.168.1.1:5062 (default is port 5060)
 
@@ -711,6 +733,8 @@
 ;      client to a different address/port use the 'stunbindaddr' option.
 ;
 ;        stunbindaddr = 0.0.0.0:5000 ; bind stun client address.
+;
+;      NOTE: STUN is only implemented for IPv4.
 ;
 ;   Note that at the moment all these mechanism work only for the SIP socket.
 ;   The IP address discovered with externaddr/externhost/STUN is reused for

Propchange: team/dvossel/sip_stun_support_improved/contrib/realtime/mysql/iaxfriends.sql
            ('svn:mergeinfo' removed)

Propchange: team/dvossel/sip_stun_support_improved/contrib/realtime/mysql/meetme.sql
            ('svn:mergeinfo' removed)

Propchange: team/dvossel/sip_stun_support_improved/contrib/realtime/mysql/sipfriends.sql
            ('svn:mergeinfo' removed)

Propchange: team/dvossel/sip_stun_support_improved/contrib/realtime/mysql/voicemail.sql
            ('svn:mergeinfo' removed)

Propchange: team/dvossel/sip_stun_support_improved/contrib/realtime/postgresql/realtime.sql
            ('svn:mergeinfo' removed)

Modified: team/dvossel/sip_stun_support_improved/doc/asterisk.8
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/sip_stun_support_improved/doc/asterisk.8?view=diff&rev=280912&r1=280911&r2=280912
==============================================================================
--- team/dvossel/sip_stun_support_improved/doc/asterisk.8 (original)
+++ team/dvossel/sip_stun_support_improved/doc/asterisk.8 Wed Aug  4 10:31:00 2010
@@ -1,203 +1,234 @@
-.\" This manpage has been automatically generated by docbook2man 
-.\" from a DocBook document.  This tool can be found at:
-.\" <http://shell.ipoline.com/~elmert/comp/docbook2X/> 
-.\" Please send any bug reports, improvements, comments, patches, 
-.\" etc. to Steve Cheng <steve at ggi-project.org>.
-.TH "ASTERISK" "8" "25 October 2005" "asterisk 1.2" ""
-
+'\" -*- coding: us-ascii -*-
+.if \n(.g .ds T< \\FC
+.if \n(.g .ds T> \\F[\n[.fam]]
+.de URL
+\\$2 \(la\\$1\(ra\\$3
+..
+.if \n(.g .mso www.tmac
+.TH &#10;&#9;&#9;asterisk&#10;&#9; 8 2010-08-03 "asterisk 1.6" ""
 .SH NAME
-asterisk \- All-purpose telephony server.
+asterisk
+\- All-purpose telephony server. 
 .SH SYNOPSIS
-
-\fBasterisk\fR [ \fB\-tThfdvVqpRgciIn\fR ] [ \fB\-C \fIfile\fB\fR ] [ \fB\-U \fIuser\fB\fR ] [ \fB\-G \fIgroup\fB\fR ] [ \fB\-x \fIcommand\fB\fR ] [ \fB\-M \fIvalue\fB\fR ]
-
-
-\fBasterisk \-r\fR [ \fB\-v\fR ] [ \fB\-x \fIcommand\fB\fR ] [ \fB\-s \fIsocket\fB\fR ]
-
-.SH "DESCRIPTION"
-.PP
+'nh
+.fi
+.ad l
+\fBasterisk\fR \kx
+.if (\nx>(\n(.l/2)) .nr x (\n(.l/5)
+'in \n(.iu+\nxu
+[\fB-BcdfFghiImnpqRtTvVW\fR] [\fB-C \fR\fIfile\fR] [\fB-e \fR\fImemory\fR] [\fB-G \fR\fIgroup\fR] [\fB-L \fR\fIloadaverage\fR] [\fB-M \fR\fIvalue\fR] [\fB-U \fR\fIuser\fR] [\fB-s \fR\fIsocket-file\fR] [\fB-x \fR\fIcommand\fR]
+'in \n(.iu-\nxu
+.ad b
+'hy
+'nh
+.fi
+.ad l
+\fBasterisk -r\fR \kx
+.if (\nx>(\n(.l/2)) .nr x (\n(.l/5)
+'in \n(.iu+\nxu
+[\fB-v\fR] [\fB-x \fR\fIcommand\fR]
+'in \n(.iu-\nxu
+.ad b
+'hy
+.SH DESCRIPTION
 \fBasterisk\fR is a full-featured telephony server which
 provides Private Branch eXchange (PBX), Interactive Voice Response (IVR),
 Automated Call Distribution (ACD), Voice over IP (VoIP) gatewaying, 
 Conferencing, and a plethora of other telephony applications to a broad
 range of telephony devices including packet voice (SIP, IAX2, MGCP, Skinny,
-H.323) devices (both endpoints and proxies), as well as traditional TDM
+H.323, Unistim) devices (both endpoints and proxies), as well as traditional TDM
 hardware including T1, E1, ISDN PRI, GR-303, RBS, Loopstart, Groundstart,
-ISDN BRI, and many more.
+ISDN BRI and many more.
 .PP
 At start, Asterisk reads the /etc/asterisk/asterisk.conf main configuration
 file and locates the rest of the configuration files from the configuration
-in that file. The \-C option specifies an alternate main configuration file.
+in that file. The -C option specifies an alternate main configuration file.
 Virtually all aspects of the operation of asterisk's configuration files
-can be found in the sample configuration files.  The format for those files
+can be found in the sample configuration files. The format for those files
 is generally beyond the scope of this man page.
 .PP
-When running with \fB\-c\fR, \fB\-r\fR or \fB\-R\fR
+When running with \fB-c\fR, \fB-r\fR or \fB-R\fR
 options, Asterisk supplies a powerful command line, including command
 completion, which may be used to monitors its status, perform a variety
 of administrative actions and even explore the applications that are
 currently loaded into the system.
 .PP
 Asterisk is a trademark of Digium, Inc.
-.SH "OPTIONS"
-.TP
-\fB\-C \fIfile\fB\fR
-Use \fIfile\fR as master configuration file
+.SH OPTIONS
+.TP 
+-B
+Force the background of the terminal to be black, in order for
+terminal colors to show up properly.
+.TP 
+-C \fIfile\fR
+Use \*(T<\fIfile\fR\*(T> as master configuration file
 instead of the default, /etc/asterisk/asterisk.conf
-.TP
-\fB\-c\fR
+.TP 
+-c
 Provide a control console on the calling terminal.
-Specifying this option implies \fB\-f\fR and will cause
+Specifying this option implies \fB-f\fR and will cause
 asterisk to no longer fork or detach from the controlling terminal.
-.TP
-\fB\-d\fR
+.TP 
+-d
 Enable extra debugging statements.
 
 Note: This always sets the debug level in the asterisk process,
-even if it is running in the background. This will affect the size
-of your log files.
-.TP
-\fB\-f\fR
-Do not fork or detach from controlling terminal.
-.TP
-\fB\-g\fR
+even if it is running in the background. This may affect the size
+of your log files, if the debug level is specified in logger.conf.
+.TP 
+-e \fImemory\fR
+Limit the generation of new channels when the amount of free memory has decreased to under \fImemory\fR megabytes.
+.TP 
+-f
+Do not fork or detach from controlling terminal. Overrides any preceding specification of \fB-F\fR on the command line.
+.TP 
+-F
+Always fork and detach from controlling terminal. Overrides any preceding specification of \fB-f\fR on the command line.
+.TP 
+-g
 Remove resource limit on core size, thus forcing Asterisk to dump
 core in the unlikely event of a segmentation fault or abort signal.
 \fBNOTE:\fR in some cases this may be incompatible
-with the \fB\-U\fR or \fB\-G\fR flags.
-.TP
-\fB\-G \fIgroup\fB\fR
+with the \fB-U\fR or \fB-G\fR flags.
+.TP 
+-G \fIgroup\fR
 Run as group \fIgroup\fR instead of the
-calling group.  \fBNOTE:\fR this requires substantial work
+calling group. \fBNOTE:\fR this requires substantial work
 to be sure that Asterisk's environment has permission to write
 the files required for its operation, including logs, its comm
 socket, the asterisk database, etc.
-.TP
-\fB\-h\fR
+.TP 
+-h
 Provide brief summary of command line arguments and terminate.
-.TP
-\fB\-i\fR
-Prompt user to initialize any encrypted private keys for IAX2
+.TP 
+-i
+Prompt user to intialize any encrypted private keys for IAX2
 secure authentication during startup.
-.TP
-\fB\-L \fIloadaverage\fB\fR
-Limits the maximum load average before rejecting new calls.  This can
+.TP 
+-I
+Enable internal timing if DAHDI timing is available.
+The default behaviour is that outbound packets are phase locked
+to inbound packets. Enabling this switch causes them to be
+locked to the internal DAHDI timer instead.
+.TP 
+-L \fIloadaverage\fR
+Limits the maximum load average before rejecting new calls. This can
 be useful to prevent a system from being brought down by terminating
 too many simultaneous calls.
-.TP
-\fB\-m\fR
-Disable log and verbose output to remote (\-r) consoles.
-.TP
-\fB\-M \fIvalue\fB\fR
-Limits the maximum number of calls to the specified value.  This can
+.TP 
+-m
+Temporarily mutes output to the console and logs. To return to normal,
+use \fBlogger mute\fR.
+.TP 
+-M \fIvalue\fR
+Limits the maximum number of calls to the specified value. This can
 be useful to prevent a system from being brought down by terminating
 too many simultaneous calls.
-.TP
-\fB\-n\fR
+.TP 
+-n
 Disable ANSI colors even on terminals capable of displaying them.
-.TP
-\fB\-p\fR
+.TP 
+-p
 If supported by the operating system (and executing as root),
 attempt to run with realtime priority for increased performance and
 responsiveness within the Asterisk process, at the expense of other
 programs running on the same machine.
-.TP
-\fB\-q\fR
+
+Note: \fBastcanary\fR will run concurrently with
+\fBasterisk\fR. If \fBastcanary\fR stops
+running or is killed, \fBasterisk\fR will slow down to
+normal process priority, to avoid locking up the machine.
+.TP 
+-q
 Reduce default console output when running in conjunction with
-console mode (\fB\-c\fR).
-.TP
-\fB\-r\fR
+console mode (\fB-c\fR).
+.TP 
+-r
 Instead of running a new Asterisk process, attempt to connect
 to a running Asterisk process and provide a console interface
 for controlling it.
-.TP
-\fB\-R\fR
-Much like \fB\-r\fR\&.  Instead of running a new Asterisk process, attempt to connect
+.TP 
+-R
+Much like \fB-r\fR. Instead of running a new Asterisk process, attempt to connect
 to a running Asterisk process and provide a console interface
 for controlling it. Additionally, if connection to the Asterisk 
 process is lost, attempt to reconnect for as long as 30 seconds.
-.TP
-\fB\-s \fIsocket\fB\fR
-Allows to specify the socket file to be used to connect to the
-Asterisk console. Used in conjunction with \fB\-r\fR or \fB\-R\fR.
-.TP
-\fB\-I\fR
-Enable internal timing if DAHDI timer is available
-The default behaviour is that outbound packets are phase locked
-to inbound packets. Enabling this switch causes them to be
-locked to the internal DAHDI timer instead.
-.TP
-\fB\-t\fR
+.TP 
+-s \fIsocket file name\fR
+In combination with \fB-r\fR, connect directly to a specified
+Asterisk server socket.
+.TP 
+-t
 When recording files, write them first into a temporary holding directory, 
 then move them into the final location when done.
-.TP
-\fB\-T\fR
+.TP 
+-T
 Add timestamp to all non-command related output going to the console
 when running with verbose and/or logging to the console.
-.TP
-\fB\-U \fIuser\fB\fR
+.TP 
+-U \fIuser\fR
 Run as user \fIuser\fR instead of the
-calling user.  \fBNOTE:\fR this requires substantial work
+calling user. \fBNOTE:\fR this requires substantial work
 to be sure that Asterisk's environment has permission to write
 the files required for its operation, including logs, its comm
 socket, the asterisk database, etc.
-.TP
-\fB\-v\fR
-Increase the level of verboseness on the console.  The more times
-\fB\-v\fR is specified, the more verbose the output is.
-Specifying this option implies \fB\-f\fR and will cause
+.TP 
+-v
+Increase the level of verboseness on the console. The more times
+\fB-v\fR is specified, the more verbose the output is.
+Specifying this option implies \fB-f\fR and will cause
 asterisk to no longer fork or detach from the controlling terminal.
-This option may also be used in conjunction with \fB\-r\fR
-and \fB\-R\fR\&.
+This option may also be used in conjunction with \fB-r\fR
+and \fB-R\fR.
 
 Note: This always sets the verbose level in the asterisk process,
 even if it is running in the background. This will affect the size
 of your log files.
-.TP
-\fB\-V\fR
+.TP 
+-V
 Display version information and exit immediately.
-.TP
-\fB\-W\fR
-Change the terminal colors to compensate for a light background,
-rather than a dark background, as is the default.
-.TP
-\fB\-x \fIcommand\fB\fR
+.TP 
+-W
+Display colored terminal text as if the background were white
+or otherwise light in color. Normally, terminal text is displayed
+as if the background were black or otherwise dark in color.
+.TP 
+-x \fIcommand\fR
 Connect to a running Asterisk process and execute a command on
 a command line, passing any output through to standard out and
-then terminating when the command execution completes.  Implies
-\fB\-r\fR when \fB\-R\fR is not explicitly
+then terminating when the command execution completes. Implies
+\fB-r\fR when \fB-R\fR is not explicitly
 supplied.
-.SH "EXAMPLES"
-.PP
-\fBasterisk\fR \- Begin Asterisk as a daemon
-.PP
-\fBasterisk \-vvvgc\fR \- Run on controlling terminal
-.PP
-\fBasterisk \-rx "core show channels"\fR \- Display channels on running server
-.SH "BUGS"
-.PP
+.TP 
+-X
+Enables executing of includes via \fB#exec\fR directive.
+This can be useful if You want to do \fB#exec\fR inside
+\*(T<\fIasterisk.conf\fR\*(T>
+.SH EXAMPLES
+\fBasterisk\fR - Begin Asterisk as a daemon
+.PP
+\fBasterisk -vvvgc\fR - Run on controlling terminal
+.PP
+\fBasterisk -rx "core show channels"\fR - Display channels on running server
+.SH BUGS
 Bug reports and feature requests may be filed at https://issues.asterisk.org
 .SH "SEE ALSO"
-.PP
-*CLI> \fBhelp\fR \- Help on Asterisk CLI
-.PP
-*CLI> \fBcore show applications\fR \- Show loaded dialplan applications
-.PP
-*CLI> \fBcore show functions\fR \- Show loaded dialplan functions
-.PP
-*CLI> \fBdialplan show\fR \- Show current dialplan
-.PP
-http://www.asterisk.org \- The Asterisk Home Page
-.PP
-http://www.asteriskdocs.org \- The Asterisk Documentation Project
-.PP
-http://www.voip\-info.org/wiki\-Asterisk \- The Asterisk Wiki
-.PP
-http://www.digium.com/ \- Asterisk sponsor and hardware supplier
-.PP
-http://www.markocam.com/ \- Asterisk author's web cam
-.SH "AUTHOR"
-.PP
+*CLI> \fBhelp\fR - Help on Asterisk CLI
+.PP
+*CLI> \fBcore show applications\fR - Show loaded dialplan applications
+.PP
+*CLI> \fBcore show functions\fR - Show loaded dialplan functions
+.PP
+*CLI> \fBdialplan show\fR - Show current dialplan
+.PP
+http://www.asterisk.org - The Asterisk Home Page
+.PP
+http://www.asteriskdocs.org - The Asterisk Documentation Project
+.PP
+http://www.voip-info.org/wiki-Asterisk - The Asterisk Wiki
+.PP
+http://www.digium.com/ - Asterisk sponsor and hardware supplier
+.SH AUTHOR
 Mark Spencer <markster at digium.com>
 .PP
-Countless other contributors, see CREDITS with distribution for more information
+Countless other contributors, see CREDITS with distribution for more information.

Modified: team/dvossel/sip_stun_support_improved/doc/asterisk.sgml
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/sip_stun_support_improved/doc/asterisk.sgml?view=diff&rev=280912&r1=280911&r2=280912
==============================================================================
--- team/dvossel/sip_stun_support_improved/doc/asterisk.sgml (original)
+++ team/dvossel/sip_stun_support_improved/doc/asterisk.sgml Wed Aug  4 10:31:00 2010
@@ -1,7 +1,6 @@
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
 <refentry>
 <refentryinfo>
-	<date>2005-10-18</date>
+	<date>2010-08-03</date>
 </refentryinfo>
 <refmeta>
 	<refentrytitle>
@@ -21,13 +20,15 @@
 <refsynopsisdiv>
 	<cmdsynopsis>
 	<command>asterisk</command>
-<arg><option>-tThfdvVqpRgciIns</option></arg>
+<arg><option>-BcdfFghiImnpqRtTvVW</option></arg>
 <arg><option>-C </option><replaceable class="parameter">file</replaceable></arg>
+<arg><option>-e </option><replaceable class="parameter">memory</replaceable></arg>
+<arg><option>-G </option><replaceable class="parameter">group</replaceable></arg>
+<arg><option>-L </option><replaceable class="parameter">loadaverage</replaceable></arg>
+<arg><option>-M </option><replaceable class="parameter">value</replaceable></arg>
 <arg><option>-U </option><replaceable class="parameter">user</replaceable></arg>
-<arg><option>-G </option><replaceable class="parameter">group</replaceable></arg>
+<arg><option>-s </option><replaceable class="parameter">socket-file</replaceable></arg>
 <arg><option>-x </option><replaceable class="parameter">command</replaceable></arg>
-<arg><option>-M </option><replaceable class="parameter">value</replaceable></arg>
-<arg><option>-L </option><replaceable class="parameter">loadaverage</replaceable></arg>
 	</cmdsynopsis>
 	<cmdsynopsis>
 
@@ -38,7 +39,7 @@
 </refsynopsisdiv>
 <refsect1>
 	<refsect1info>
-		<date>2007-12-19</date>
+		<date>2010-08-03</date>
 	</refsect1info>
 	<title>DESCRIPTION</title>
 	<para>
@@ -74,6 +75,15 @@
 	<title>OPTIONS</title>
 	<variablelist>
 	<varlistentry>
+		<term>-B</term>
+		<listitem>
+			<para>
+			Force the background of the terminal to be black, in order for
+			terminal colors to show up properly.
+			</para>
+		</listitem>
+	</varlistentry>
+	<varlistentry>
 		<term>-C <replaceable class="parameter">file</replaceable></term>
 		<listitem>
 			<para>
@@ -100,8 +110,16 @@
 			</para>
 			<para>
 			Note: This always sets the debug level in the asterisk process,
-			even if it is running in the background. This will affect the size
-			of your log files.
+			even if it is running in the background. This may affect the size
+			of your log files, if the debug level is specified in logger.conf.
+			</para>
+		</listitem>
+	</varlistentry>
+	<varlistentry>
+		<term>-e <replaceable class="parameter">memory</replaceable></term>
+		<listitem>
+			<para>
+			Limit the generation of new channels when the amount of free memory has decreased to under <replaceable>memory</replaceable> megabytes.
 			</para>
 		</listitem>
 	</varlistentry>
@@ -109,7 +127,15 @@
 		<term>-f</term>
 		<listitem>
 			<para>
-			Do not fork or detach from controlling terminal.
+			Do not fork or detach from controlling terminal.  Overrides any preceding specification of <command>-F</command> on the command line.
+			</para>
+		</listitem>
+	</varlistentry>
+	<varlistentry>
+		<term>-F</term>
+		<listitem>
+			<para>
+			Always fork and detach from controlling terminal.  Overrides any preceding specification of <command>-f</command> on the command line.
 			</para>
 		</listitem>
 	</varlistentry>
@@ -175,6 +201,15 @@
 		</listitem>
 	</varlistentry>
 	<varlistentry>
+		<term>-m</term>
+		<listitem>
+			<para>
+			Temporarily mutes output to the console and logs.  To return to normal,
+			use <command>logger mute</command>.
+			</para>
+		</listitem>
+	</varlistentry>
+	<varlistentry>
 		<term>-M <replaceable class="parameter">value</replaceable></term>
 		<listitem>
 			<para>
@@ -200,6 +235,12 @@
 			attempt to run with realtime priority for increased performance and
 			responsiveness within the Asterisk process, at the expense of other
 			programs running on the same machine.
+			</para>
+			<para>
+			Note: <command>astcanary</command> will run concurrently with
+			<command>asterisk</command>. If <command>astcanary</command> stops
+			running or is killed, <command>asterisk</command> will slow down to
+			normal process priority, to avoid locking up the machine.
 			</para>
 		</listitem>
 	</varlistentry>
@@ -299,6 +340,16 @@
 		</listitem>
 	</varlistentry>
 	<varlistentry>
+		<term>-W</term>
+		<listitem>
+			<para>
+			Display colored terminal text as if the background were white
+			or otherwise light in color.  Normally, terminal text is displayed
+			as if the background were black or otherwise dark in color.
+			</para>
+		</listitem>
+	</varlistentry>
+	<varlistentry>
 		<term>-x <replaceable class="parameter">command</replaceable></term>
 		<listitem>
 			<para>
@@ -331,7 +382,7 @@
 	<command>asterisk -vvvgc</command> - Run on controlling terminal
 	</para>
 	<para>
-	<command>asterisk -rx "show channels"</command> - Display channels on running server
+	<command>asterisk -rx "core show channels"</command> - Display channels on running server
 	</para>
 </refsect1>
 <refsect1>
@@ -346,10 +397,13 @@
 	*CLI&gt; <command>help</command> - Help on Asterisk CLI
 	</para>
 	<para>
-	*CLI&gt; <command>show applications</command> - Show loaded dialplan applications
-	</para>
-	<para>
-	*CLI&gt; <command>show functions</command> - Show loaded dialplan functions
+	*CLI&gt; <command>core show applications</command> - Show loaded dialplan applications
+	</para>
+	<para>
+	*CLI&gt; <command>core show functions</command> - Show loaded dialplan functions
+	</para>
+	<para>
+	*CLI&gt; <command>dialplan show</command> - Show current dialplan
 	</para>
 	<para>
 	http://www.asterisk.org - The Asterisk Home Page
@@ -362,9 +416,6 @@
 	</para>
 	<para>
 	http://www.digium.com/ - Asterisk sponsor and hardware supplier
-	</para>
-	<para>
-	http://www.markocam.com/ - Asterisk author's web cam
 	</para>
 </refsect1>
 <refsect1>
@@ -376,7 +427,7 @@
 	</para>
 	<para>
 	<author>
-		<firstname>Countless other contributers, see CREDITS with distribution for more information</firstname> 
+		<firstname>Countless other contributors, see CREDITS with distribution for more information.</firstname> 
 	</author>
 	</para>
 </refsect1>

Modified: team/dvossel/sip_stun_support_improved/funcs/func_strings.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/sip_stun_support_improved/funcs/func_strings.c?view=diff&rev=280912&r1=280911&r2=280912
==============================================================================
--- team/dvossel/sip_stun_support_improved/funcs/func_strings.c (original)
+++ team/dvossel/sip_stun_support_improved/funcs/func_strings.c Wed Aug  4 10:31:00 2010
@@ -61,6 +61,27 @@
 			<para>Example: If ${example} contains <literal>ex-amp-le</literal>, then ${FIELDQTY(example,-)} returns 3.</para>
 		</description>
 	</function>
+	<function name="FIELDNUM" language="en_US">
+		<synopsis>
+			Return the 1-based offset of a field in a list
+		</synopsis>
+		<syntax>
+			<parameter name="varname" required="true" />
+			<parameter name="delim" required="true" />
+			<parameter name="value" required="true" />
+		</syntax>
+		<description>
+			<para>Search the variable named <replaceable>varname</replaceable> for the string <replaceable>value</replaceable>
+			delimited by <replaceable>delim</replaceable> and return a 1-based offset as to its location. If not found
+			or an error occured, return <literal>0</literal>.</para>
+			<para>The delimiter may be specified as a special or extended ASCII character, by encoding it.  The characters
+			<literal>\n</literal>, <literal>\r</literal>, and <literal>\t</literal> are all recognized as the newline,
+			carriage return, and tab characters, respectively.  Also, octal and hexadecimal specifications are recognized
+			by the patterns <literal>\0nnn</literal> and <literal>\xHH</literal>, respectively.  For example, if you wanted
+			to encode a comma as the delimiter, you could use either <literal>\054</literal> or <literal>\x2C</literal>.</para>
+		        <para>Example: If ${example} contains <literal>ex-amp-le</literal>, then ${FIELDNUM(example,-,amp)} returns 2.</para>
+		</description>
+	</function>
 	<function name="LISTFILTER" language="en_US">
 		<synopsis>Remove an item from a list, by name.</synopsis>
 		<syntax>
@@ -453,6 +474,85 @@
 	.name = "FIELDQTY",
 	.read = function_fieldqty,
 	.read2 = function_fieldqty_str,
+};
+
+static int function_fieldnum_helper(struct ast_channel *chan, const char *cmd,
+				char *parse, char *buf, struct ast_str **sbuf, ssize_t len)
+{
+	char *varsubst, *field;
+	struct ast_str *str = ast_str_thread_get(&result_buf, 16);
+	int fieldindex = 0, res = 0;
+	AST_DECLARE_APP_ARGS(args,
+		AST_APP_ARG(varname);
+		AST_APP_ARG(delim);
+		AST_APP_ARG(field);
+	);
+	char delim[2] = "";
+	size_t delim_used;
+
+	if (!str) {
+		return -1;
+	}
+
+	AST_STANDARD_APP_ARGS(args, parse);
+
+	if (args.argc < 3) {
+		ast_log(LOG_ERROR, "Usage: FIELDNUM(<listname>,<delimiter>,<fieldvalue>)\n");
+		res = -1;
+	} else {
+		varsubst = alloca(strlen(args.varname) + 4);
+		sprintf(varsubst, "${%s}", args.varname);
+
+		ast_str_substitute_variables(&str, 0, chan, varsubst);
+
+		if (ast_str_strlen(str) == 0 || ast_strlen_zero(args.delim)) {
+			fieldindex = 0;
+		} else if (ast_get_encoded_char(args.delim, delim, &delim_used) == -1) {
+			res = -1;
+		} else {
+			char *varval = ast_str_buffer(str);
+
+			while ((field = strsep(&varval, delim)) != NULL) {
+				fieldindex++;
+
+				if (!strcasecmp(field, args.field)) {
+					break;
+				}
+			}
+
+			if (!field) {
+				fieldindex = 0;
+			}
+
+			res = 0;
+		}
+	}
+
+	if (sbuf) {
+		ast_str_set(sbuf, len, "%d", fieldindex);
+	} else {
+		snprintf(buf, len, "%d", fieldindex);
+	}
+
+	return res;
+}
+
+static int function_fieldnum(struct ast_channel *chan, const char *cmd,
+			     char *parse, char *buf, size_t len)
+{
+	return function_fieldnum_helper(chan, cmd, parse, buf, NULL, len);
+}
+
+static int function_fieldnum_str(struct ast_channel *chan, const char *cmd,
+				 char *parse, struct ast_str **buf, ssize_t len)
+{
+	return function_fieldnum_helper(chan, cmd, parse, NULL, buf, len);
+}
+
+static struct ast_custom_function fieldnum_function = {
+	.name = "FIELDNUM",
+	.read = function_fieldnum,
+	.read2 = function_fieldnum_str,
 };
 
 static int listfilter(struct ast_channel *chan, const char *cmd, char *parse, char *buf, struct ast_str **bufstr, ssize_t len)
@@ -1439,6 +1539,72 @@
 };
 
 #ifdef TEST_FRAMEWORK
+AST_TEST_DEFINE(test_FIELDNUM)
+{
+	int i, res = AST_TEST_PASS;
+	struct ast_channel *chan;
+	struct ast_str *str;
+	char expression[256];
+	struct {
+		const char *fields;
+		const char *delim;
+		const char *field;
+		const char *expected;
+	} test_args[] = {
+		{"abc,def,ghi,jkl", "\\,",     "ghi", "3"},
+		{"abc def ghi jkl", " ",       "abc", "1"},
+		{"abc/def/ghi/jkl", "\\\\x2f", "def", "2"},
+		{"abc$def$ghi$jkl", "",        "ghi", "0"},
+		{"abc,def,ghi,jkl", "-",       "",    "0"},
+		{"abc-def-ghi-jkl", "-",       "mno", "0"}
+	};
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "func_FIELDNUM_test";
+		info->category = "/funcs/func_strings/";
+		info->summary = "Test FIELDNUM function";
+		info->description = "Verify FIELDNUM behavior";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
+
+	if (!(chan = ast_dummy_channel_alloc())) {
+		ast_test_status_update(test, "Unable to allocate dummy channel\n");
+		return AST_TEST_FAIL;
+	}
+
+	if (!(str = ast_str_create(16))) {
+		ast_test_status_update(test, "Unable to allocate dynamic string buffer\n");
+		ast_channel_release(chan);
+		return AST_TEST_FAIL;
+	}
+
+	for (i = 0; i < ARRAY_LEN(test_args); i++) {
+		struct ast_var_t *var = ast_var_assign("FIELDS", test_args[i].fields);
+		AST_LIST_INSERT_HEAD(&chan->varshead, var, entries);
+
+		snprintf(expression, sizeof(expression), "${FIELDNUM(%s,%s,%s)}", var->name, test_args[i].delim, test_args[i].field);
+		ast_str_substitute_variables(&str, 0, chan, expression);
+
+		AST_LIST_REMOVE(&chan->varshead, var, entries);
+		ast_var_delete(var);
+
+		if (strcasecmp(ast_str_buffer(str), test_args[i].expected)) {
+			ast_test_status_update(test, "Evaluation of '%s' returned '%s' instead of the expected value '%s'\n",
+				expression, ast_str_buffer(str), test_args[i].expected);
+			res = AST_TEST_FAIL;
+			break;
+		}
+	}
+
+	ast_free(str);
+	ast_channel_release(chan);
+
+	return res;
+}
+
 AST_TEST_DEFINE(test_FILTER)
 {
 	int i, res = AST_TEST_PASS;
@@ -1479,8 +1645,10 @@
 {
 	int res = 0;
 
+	AST_TEST_UNREGISTER(test_FIELDNUM);
 	AST_TEST_UNREGISTER(test_FILTER);
 	res |= ast_custom_function_unregister(&fieldqty_function);
+	res |= ast_custom_function_unregister(&fieldnum_function);
 	res |= ast_custom_function_unregister(&filter_function);
 	res |= ast_custom_function_unregister(&replace_function);
 	res |= ast_custom_function_unregister(&listfilter_function);
@@ -1511,8 +1679,10 @@
 {
 	int res = 0;
 
+	AST_TEST_REGISTER(test_FIELDNUM);
 	AST_TEST_REGISTER(test_FILTER);
 	res |= ast_custom_function_register(&fieldqty_function);
+	res |= ast_custom_function_register(&fieldnum_function);
 	res |= ast_custom_function_register(&filter_function);
 	res |= ast_custom_function_register(&replace_function);
 	res |= ast_custom_function_register(&listfilter_function);

Modified: team/dvossel/sip_stun_support_improved/res/res_fax.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/sip_stun_support_improved/res/res_fax.c?view=diff&rev=280912&r1=280911&r2=280912
==============================================================================
--- team/dvossel/sip_stun_support_improved/res/res_fax.c (original)
+++ team/dvossel/sip_stun_support_improved/res/res_fax.c Wed Aug  4 10:31:00 2010
@@ -387,9 +387,6 @@
 	d->modems = general_options.modems;
 	d->minrate = general_options.minrate;
 	d->maxrate = general_options.maxrate;
-	ast_string_field_set(d, result, "FAILED");

[... 27 lines stripped ...]



More information about the asterisk-commits mailing list