[asterisk-commits] russell: branch russell/jack r93176 - in /team/russell/jack: ./ channels/ con...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Dec 16 16:19:17 CST 2007


Author: russell
Date: Sun Dec 16 16:19:16 2007
New Revision: 93176

URL: http://svn.digium.com/view/asterisk?view=rev&rev=93176
Log:
sync with trunk

Added:
    team/russell/jack/channels/console_video.c   (with props)
Modified:
    team/russell/jack/   (props changed)
    team/russell/jack/CHANGES
    team/russell/jack/Makefile
    team/russell/jack/UPGRADE.txt
    team/russell/jack/channels/chan_h323.c
    team/russell/jack/channels/chan_iax2.c
    team/russell/jack/channels/chan_mgcp.c
    team/russell/jack/channels/chan_oss.c
    team/russell/jack/channels/chan_sip.c
    team/russell/jack/channels/chan_skinny.c
    team/russell/jack/channels/chan_unistim.c
    team/russell/jack/channels/iax2-provision.c
    team/russell/jack/configs/dundi.conf.sample
    team/russell/jack/configs/h323.conf.sample
    team/russell/jack/configs/iax.conf.sample
    team/russell/jack/configs/iaxprov.conf.sample
    team/russell/jack/configs/mgcp.conf.sample
    team/russell/jack/configs/oss.conf.sample
    team/russell/jack/configs/sip.conf.sample
    team/russell/jack/configs/skinny.conf.sample
    team/russell/jack/configs/unistim.conf.sample
    team/russell/jack/doc/tex/qos.tex
    team/russell/jack/include/asterisk/file.h
    team/russell/jack/include/asterisk/netsock.h
    team/russell/jack/include/asterisk/rtp.h
    team/russell/jack/main/asterisk.c
    team/russell/jack/main/manager.c
    team/russell/jack/main/netsock.c
    team/russell/jack/main/rtp.c
    team/russell/jack/main/udptl.c
    team/russell/jack/pbx/pbx_dundi.c

Propchange: team/russell/jack/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sun Dec 16 16:19:16 2007
@@ -1,1 +1,1 @@
-/trunk:1-93135
+/trunk:1-93175

Modified: team/russell/jack/CHANGES
URL: http://svn.digium.com/view/asterisk/team/russell/jack/CHANGES?view=diff&rev=93176&r1=93175&r2=93176
==============================================================================
--- team/russell/jack/CHANGES (original)
+++ team/russell/jack/CHANGES Sun Dec 16 16:19:16 2007
@@ -11,7 +11,7 @@
   * Added the URI redirect option for the built-in HTTP server
   * The output of CallerID in Manager events is now more consistent.
      CallerIDNum is used for number and CallerIDName for name.
-  * enable https support for builtin web server.
+  * Enable https support for builtin web server.
      See configs/http.conf.sample for details.
   * Added a new action, GetConfigJSON, which can return the contents of an
      Asterisk configuration file in JSON format.  This is intended to help
@@ -27,6 +27,11 @@
   * Added 'DBDel' and 'DBDelTree' manager commands.
   * cdr_manager now reports events via the "cdr" level, separating it from
      the very verbose "call" level.
+  * Manager users are now stored in memory. If you change the manager account
+    list (delete or add accounts) you need to reload manager.
+  * Added Masquerade manager event for when a masquerade happens between
+     two channels.
+  * Added "manager reload" command for the CLI
 
 Dialplan functions
 ------------------
@@ -101,6 +106,9 @@
   * A new option called "callcounter" (global/peer/user level) enables call counters needed
     for better status reports needed for queues and SIP subscriptions. (Call-Limit was previously
     used to enable this functionality).
+  * New settings for timer T1 and timer B on a global level or per device. This makes it 
+    possible to force timeout faster on non-responsive SIP servers. These settings are
+    considered advanced, so don't use them unless you have a problem.
 
 IAX2 changes
 ------------
@@ -109,10 +117,23 @@
   * Added support for OSP.  The token is set and retrieved through the CHANNEL()
      dialplan function.
 
+XMPP Google Talk/Jingle changes
+-------------------------------
+  * Added the bindaddr option to gtalk.conf.
+
 Skinny changes
 -------------
   * Added skinny show device, skinny show line, and skinny show settings CLI commands.
   * Proper codec support in chan_skinny.
+  * Added settings for IP and Ethernet QoS requests
+
+MGCP changes
+------------
+  * Added separate settings for media QoS in mgcp.conf
+
+OSS Channel changes
+-------------------
+  * Added experimental support for video under X windows
 
 DUNDi changes
 -------------
@@ -325,7 +346,6 @@
 
 Miscellaneous 
 -------------
-  * Added the bindaddr option to gtalk.conf.
   * Ability to use libcap to set high ToS bits when non-root
      on Linux. If configure is unable to find libcap then you
      can use --with-cap to specify the path.
@@ -337,8 +357,6 @@
      command to be run after rotation.  This is primarily useful with
      rotatestrategry=rotate, to allow a limit on the number of logfiles kept
      and to ensure that the oldest log file gets deleted.
-  * Added Masquerade manager event for when a masquerade happens between
-     two channels.
   * Added maxfiles option to options section of asterisk.conf which allows you to specify
      what Asterisk should set as the maximum number of open files when it loads.
   * Added the jittertargetextra configuration option.

Modified: team/russell/jack/Makefile
URL: http://svn.digium.com/view/asterisk/team/russell/jack/Makefile?view=diff&rev=93176&r1=93175&r2=93176
==============================================================================
--- team/russell/jack/Makefile (original)
+++ team/russell/jack/Makefile Sun Dec 16 16:19:16 2007
@@ -378,30 +378,22 @@
 
 defaults.h: makeopts
 	@build_tools/make_defaults_h > $@.tmp
-	@if cmp -s $@.tmp $@ ; then : ; else \
-		mv $@.tmp $@ ; \
-	fi
+	@cmp -s $@.tmp $@ || mv $@.tmp $@
 	@rm -f $@.tmp
 
 include/asterisk/version.h:
 	@build_tools/make_version_h > $@.tmp
-	@if cmp -s $@.tmp $@ ; then : ; else \
-		mv $@.tmp $@ ; \
-	fi
+	@cmp -s $@.tmp $@ || mv $@.tmp $@
 	@rm -f $@.tmp
 
 include/asterisk/buildopts.h: menuselect.makeopts
 	@build_tools/make_buildopts_h > $@.tmp
-	@if cmp -s $@.tmp $@ ; then : ; else \
-		mv $@.tmp $@ ; \
-	fi
+	@cmp -s $@.tmp $@ || mv $@.tmp $@
 	@rm -f $@.tmp
 
 include/asterisk/build.h:
 	@build_tools/make_build_h > $@.tmp
-	@if cmp -s $@.tmp $@ ; then : ; else \
-		mv $@.tmp $@ ; \
-	fi
+	@cmp -s $@.tmp $@ || mv $@.tmp $@
 	@rm -f $@.tmp
 
 $(SUBDIRS_CLEAN):
@@ -796,4 +788,4 @@
 asterisk.pdf:
 	$(MAKE) -C doc/tex asterisk.pdf
 
-.PHONY: menuselect main sounds clean dist-clean distclean all prereqs cleantest uninstall _uninstall uninstall-all pdf dont-optimize $(SUBDIRS_INSTALL) $(SUBDIRS_DIST_CLEAN) $(SUBDIRS_CLEAN) $(SUBDIRS_UNINSTALL) $(SUBDIRS) $(MOD_SUBDIRS_EMBED_LDSCRIPT) $(MOD_SUBDIRS_EMBED_LDFLAGS) $(MOD_SUBDIRS_EMBED_LIBS) menuselect.makeopts
+.PHONY: menuselect main sounds clean dist-clean distclean all prereqs cleantest uninstall _uninstall uninstall-all pdf dont-optimize $(SUBDIRS_INSTALL) $(SUBDIRS_DIST_CLEAN) $(SUBDIRS_CLEAN) $(SUBDIRS_UNINSTALL) $(SUBDIRS) $(MOD_SUBDIRS_EMBED_LDSCRIPT) $(MOD_SUBDIRS_EMBED_LDFLAGS) $(MOD_SUBDIRS_EMBED_LIBS)

Modified: team/russell/jack/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/russell/jack/UPGRADE.txt?view=diff&rev=93176&r1=93175&r2=93176
==============================================================================
--- team/russell/jack/UPGRADE.txt (original)
+++ team/russell/jack/UPGRADE.txt Sun Dec 16 16:19:16 2007
@@ -132,6 +132,9 @@
 * chan_local.c: the comma delimiter inside the channel name has been changed to a
   semicolon, in order to make the Local channel driver compatible with the comma
   delimiter change in applications.
+* H323: The "tos" setting has changed name to "tos_audio" and "cos" to "cos_audio"
+  to be compatible with settings in sip.conf. The "tos" and "cos" configuration
+  is deprecated and will stop working in the next release of Asterisk.
 
 Configuration:
 

Modified: team/russell/jack/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/team/russell/jack/channels/chan_h323.c?view=diff&rev=93176&r1=93175&r2=93176
==============================================================================
--- team/russell/jack/channels/chan_h323.c (original)
+++ team/russell/jack/channels/chan_h323.c Sun Dec 16 16:19:16 2007
@@ -970,7 +970,7 @@
 	if (h323debug)
 		ast_debug(1, "Created RTP channel\n");
 
-	ast_rtp_setqos(pvt->rtp, tos, cos);
+	ast_rtp_setqos(pvt->rtp, tos, cos, "H323 RTP");
 
 	if (h323debug)
 		ast_debug(1, "Setting NAT on RTP to %d\n", pvt->options.nat);
@@ -2904,13 +2904,23 @@
 			} else {
 				memcpy(&bindaddr.sin_addr, hp->h_addr, sizeof(bindaddr.sin_addr));
 			}
-		} else if (!strcasecmp(v->name, "tos")) {
+		} else if (!strcasecmp(v->name, "tos")) {	/* Needs to be removed in next release */
+			ast_log(LOG_WARNING, "The \"tos\" setting is deprecated in this version of Asterisk. Please change to \"tos_audio\".\n");
 			if (ast_str2tos(v->value, &tos)) {
-				ast_log(LOG_WARNING, "Invalid tos value at line %d, for more info read doc/qos.tex\n", v->lineno);			
-			}
-		} else if (!strcasecmp(v->name, "cos")) {		
+				ast_log(LOG_WARNING, "Invalid tos_audio value at line %d, refer to QoS documentation\n", v->lineno);			
+			}
+		} else if (!strcasecmp(v->name, "tos_audio")) {
+			if (ast_str2tos(v->value, &tos)) {
+				ast_log(LOG_WARNING, "Invalid tos_audio value at line %d, refer to QoS documentation\n", v->lineno);			
+			}
+		} else if (!strcasecmp(v->name, "cos")) {
+			ast_log(LOG_WARNING, "The \"cos\" setting is deprecated in this version of Asterisk. Please change to \"cos_audio\".\n");
 			if (ast_str2cos(v->value, &cos)) {
-				ast_log(LOG_WARNING, "Invalid cos value at line %d, for more info read doc/qos.tex\n", v->lineno);			
+				ast_log(LOG_WARNING, "Invalid cos_audio value at line %d, refer to QoS documentation\n", v->lineno);			
+			}
+		} else if (!strcasecmp(v->name, "cos_audio")) {
+			if (ast_str2cos(v->value, &cos)) {
+				ast_log(LOG_WARNING, "Invalid cos_audio value at line %d, refer to QoS documentation\n", v->lineno);			
 			}
 		} else if (!strcasecmp(v->name, "gatekeeper")) {
 			if (!strcasecmp(v->value, "DISABLE")) {

Modified: team/russell/jack/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/russell/jack/channels/chan_iax2.c?view=diff&rev=93176&r1=93175&r2=93176
==============================================================================
--- team/russell/jack/channels/chan_iax2.c (original)
+++ team/russell/jack/channels/chan_iax2.c Sun Dec 16 16:19:16 2007
@@ -10422,13 +10422,13 @@
 	tosval = ast_variable_retrieve(cfg, "general", "tos");
 	if (tosval) {
 		if (ast_str2tos(tosval, &tos))
-			ast_log(LOG_WARNING, "Invalid tos value, see doc/qos.tex for more information.\n");
+			ast_log(LOG_WARNING, "Invalid tos value, refer to QoS documentation\n");
 	}
 	/* Seed initial cos value */
 	tosval = ast_variable_retrieve(cfg, "general", "cos");
 	if (tosval) {
 		if (ast_str2cos(tosval, &cos))
-			ast_log(LOG_WARNING, "Invalid cos value, see doc/qos.tex for more information.\n");
+			ast_log(LOG_WARNING, "Invalid cos value, refer to QoS documentation\n");
 	}
 	while(v) {
 		if (!strcasecmp(v->name, "bindport")){ 
@@ -10601,10 +10601,10 @@
 				ast_context_create(NULL, regcontext, "IAX2");
 		} else if (!strcasecmp(v->name, "tos")) {
 			if (ast_str2tos(v->value, &tos))
-				ast_log(LOG_WARNING, "Invalid tos value at line %d, see doc/qos.tex for more information.'\n", v->lineno);
+				ast_log(LOG_WARNING, "Invalid tos value at line %d, refer to QoS documentation\n", v->lineno);
 		} else if (!strcasecmp(v->name, "cos")) {
 			if (ast_str2cos(v->value, &cos))
-				ast_log(LOG_WARNING, "Invalid cos value at line %d, see doc/qos.tex for more information.'\n", v->lineno);
+				ast_log(LOG_WARNING, "Invalid cos value at line %d, refer to QoS documentation\n", v->lineno);
 		} else if (!strcasecmp(v->name, "accountcode")) {
 			ast_copy_string(accountcode, v->value, sizeof(accountcode));
 		} else if (!strcasecmp(v->name, "mohinterpret")) {

Modified: team/russell/jack/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/team/russell/jack/channels/chan_mgcp.c?view=diff&rev=93176&r1=93175&r2=93176
==============================================================================
--- team/russell/jack/channels/chan_mgcp.c (original)
+++ team/russell/jack/channels/chan_mgcp.c Sun Dec 16 16:19:16 2007
@@ -153,8 +153,9 @@
 static ast_group_t cur_pickupgroup = 0;
 
 static unsigned int tos = 0;
-
+static unsigned int tos_audio = 0;
 static unsigned int cos = 0;
+static unsigned int cos_audio = 0;
 
 static int immediate = 0;
 
@@ -2591,8 +2592,10 @@
 	sub->rtp = ast_rtp_new_with_bindaddr(sched, io, 1, 0, bindaddr.sin_addr);
 	if (sub->rtp && sub->owner)
 		ast_channel_set_fd(sub->owner, 0, ast_rtp_fd(sub->rtp));
-	if (sub->rtp)
+	if (sub->rtp) {
+		ast_rtp_setqos(sub->rtp, tos_audio, cos_audio, "MGCP RTP");
 		ast_rtp_setnat(sub->rtp, sub->nat);
+	}
 #if 0
 	ast_rtp_set_callback(p->rtp, rtpready);
 	ast_rtp_set_data(p->rtp, p);
@@ -4097,10 +4100,16 @@
 				capability &= ~format;
 		} else if (!strcasecmp(v->name, "tos")) {
 			if (ast_str2tos(v->value, &tos))
-			    ast_log(LOG_WARNING, "Invalid tos value at line %d, see doc/qos.tex for more information.\n", v->lineno);
+			    ast_log(LOG_WARNING, "Invalid tos value at line %d, refer to QoS documentation\n", v->lineno);
+		} else if (!strcasecmp(v->name, "tos_audio")) {
+			if (ast_str2tos(v->value, &tos_audio))
+			    ast_log(LOG_WARNING, "Invalid tos_audio value at line %d, refer to QoS documentation\n", v->lineno);
 		} else if (!strcasecmp(v->name, "cos")) {				
 			if (ast_str2cos(v->value, &cos))
-			    ast_log(LOG_WARNING, "Invalid cos value at line %d, see doc/qos.tex for more information.\n", v->lineno);
+			    ast_log(LOG_WARNING, "Invalid cos value at line %d, refer to QoS documentation\n", v->lineno);
+		} else if (!strcasecmp(v->name, "cos_audio")) {				
+			if (ast_str2cos(v->value, &cos_audio))
+			    ast_log(LOG_WARNING, "Invalid cos_audio value at line %d, refer to QoS documentation\n", v->lineno);
 		} else if (!strcasecmp(v->name, "port")) {
 			if (sscanf(v->value, "%d", &ourport) == 1) {
 				bindaddr.sin_port = htons(ourport);
@@ -4184,7 +4193,7 @@
 		} else {
 			ast_verb(2, "MGCP Listening on %s:%d\n",
 					ast_inet_ntoa(bindaddr.sin_addr), ntohs(bindaddr.sin_port));
-			ast_netsock_set_qos(mgcpsock, tos, cos);
+			ast_netsock_set_qos(mgcpsock, tos, cos, "MGCP");
 		}
 	}
 	ast_mutex_unlock(&netlock);

Modified: team/russell/jack/channels/chan_oss.c
URL: http://svn.digium.com/view/asterisk/team/russell/jack/channels/chan_oss.c?view=diff&rev=93176&r1=93175&r2=93176
==============================================================================
--- team/russell/jack/channels/chan_oss.c (original)
+++ team/russell/jack/channels/chan_oss.c Sun Dec 16 16:19:16 2007
@@ -41,11 +41,9 @@
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
-#include <ctype.h>
+#include <ctype.h>		/* isalnum() used here */
 #include <math.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <sys/time.h>
+#include <sys/ioctl.h>		
 
 #ifdef __linux
 #include <linux/soundcard.h>
@@ -55,19 +53,13 @@
 #include <soundcard.h>
 #endif
 
-#include "asterisk/lock.h"
-#include "asterisk/frame.h"
+#include "asterisk/channel.h"
+#include "asterisk/file.h"
 #include "asterisk/callerid.h"
-#include "asterisk/channel.h"
 #include "asterisk/module.h"
 #include "asterisk/pbx.h"
-#include "asterisk/config.h"
 #include "asterisk/cli.h"
-#include "asterisk/utils.h"
 #include "asterisk/causes.h"
-#include "asterisk/endian.h"
-#include "asterisk/stringfields.h"
-#include "asterisk/abstract_jb.h"
 #include "asterisk/musiconhold.h"
 #include "asterisk/app.h"
 

Modified: team/russell/jack/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/russell/jack/channels/chan_sip.c?view=diff&rev=93176&r1=93175&r2=93176
==============================================================================
--- team/russell/jack/channels/chan_sip.c (original)
+++ team/russell/jack/channels/chan_sip.c Sun Dec 16 16:19:16 2007
@@ -181,8 +181,8 @@
 
 #define DEFAULT_RETRANS              1000             /*!< How frequently to retransmit Default: 2 * 500 ms in RFC 3261 */
 #define MAX_RETRANS                  6                /*!< Try only 6 times for retransmissions, a total of 7 transmissions */
-#define SIP_TIMER_T1		     500              /* SIP timer T1 (according to RFC 3261) */
-#define SIP_TRANS_TIMEOUT            32000            /*!< SIP request timeout (rfc 3261) 64*T1 
+#define SIP_TIMER_T1                 500              /* SIP timer T1 (according to RFC 3261) */
+#define SIP_TRANS_TIMEOUT            64 * SIP_TIMER_T1/*!< SIP request timeout (rfc 3261) 64*T1 
                                                       \todo Use known T1 for timeout (peerpoke)
                                                       */
 #define DEFAULT_TRANS_TIMEOUT        -1               /* Use default SIP transaction timeout */
@@ -545,7 +545,7 @@
 #define DEFAULT_COS_SIP         4
 #define DEFAULT_COS_AUDIO       5
 #define DEFAULT_COS_VIDEO       6
-#define DEFAULT_COS_TEXT        0
+#define DEFAULT_COS_TEXT        5
 #define DEFAULT_ALLOW_EXT_DOM	TRUE
 #define DEFAULT_REALM		"asterisk"
 #define DEFAULT_NOTIFYRINGING	TRUE
@@ -636,7 +636,9 @@
 static char global_sdpowner[AST_MAX_EXTENSION];	/*!< SDP owner name for the SIP channel */
 static int allow_external_domains;	/*!< Accept calls to external SIP domains? */
 static int global_callevents;		/*!< Whether we send manager events or not */
+static int global_t1;			/*!< T1 time */
 static int global_t1min;		/*!< T1 roundtrip time minimum */
+static int global_timer_b;    /*!< Timer B - RFC 3261 Section 17.1.1.2 */
 static int global_regextenonqualify;  /*!< Whether to add/remove regexten when qualifying peers */
 static int global_autoframing;          /*!< Turn autoframing on or off. */
 static enum transfermodes global_allowtransfer;	/*!< SIP Refer restriction scheme */
@@ -1088,6 +1090,7 @@
 	char notext;				/*!< Text not supported  (?) */
 
 	int timer_t1;				/*!< SIP timer T1, ms rtt */
+	int timer_b;            /*!< SIP timer B, ms */
 	unsigned int sipoptions;		/*!< Supported SIP options on the other end */
 	struct ast_codec_pref prefs;		/*!< codec prefs */
 	int capability;				/*!< Special capability (codec) */
@@ -1349,6 +1352,8 @@
 	struct ast_variable *chanvars;	/*!<  Variables to set for channel created by user */
 	struct sip_pvt *mwipvt;		/*!<  Subscription for MWI */
 	int autoframing;
+	int timer_t1;		/*!<  The maximum T1 value for the peer */
+	int timer_b;      /*!<  The maximum timer B (transaction timeouts) */
 };
 
 
@@ -2502,8 +2507,10 @@
 static void sip_scheddestroy(struct sip_pvt *p, int ms)
 {
 	if (ms < 0) {
-		if (p->timer_t1 == 0)
-			p->timer_t1 = SIP_TIMER_T1;	/* Set timer T1 if not set (RFC 3261) */
+		if (p->timer_t1 == 0) {
+			p->timer_t1 = global_t1;	/* Set timer T1 if not set (RFC 3261) */
+			p->timer_b = global_timer_b;  /* Set timer B if not set (RFC 3261) */
+		}
 		ms = p->timer_t1 * 64;
 	}
 	if (sip_debug_test_pvt(p))
@@ -3449,8 +3456,19 @@
 
 	/* Set timer T1 to RTT for this peer (if known by qualify=) */
 	/* Minimum is settable or default to 100 ms */
+	/* If there is a maxms and lastms from a qualify use that over a manual T1
+	   value. Otherwise, use the peer's T1 value. */
 	if (peer->maxms && peer->lastms)
 		dialog->timer_t1 = peer->lastms < global_t1min ? global_t1min : peer->lastms;
+	else
+		dialog->timer_t1 = peer->timer_t1;
+
+	/* Set timer B to control transaction timeouts, the peer setting is the default and overrides
+	   the known timer */
+	if (peer->timer_b)
+		dialog->timer_b = peer->timer_b;
+	else
+		dialog->timer_b = 64 * dialog->timer_t1;
 
 	if ((ast_test_flag(&dialog->flags[0], SIP_DTMF) == SIP_DTMF_RFC2833) ||
 	    (ast_test_flag(&dialog->flags[0], SIP_DTMF) == SIP_DTMF_AUTO))
@@ -3481,7 +3499,8 @@
 	if (port)
 		*port++ = '\0';
 	dialog->sa.sin_family = AF_INET;
-	dialog->timer_t1 = SIP_TIMER_T1; /* Default SIP retransmission timer T1 (RFC 3261) */
+	dialog->timer_t1 = global_t1; /* Default SIP retransmission timer T1 (RFC 3261) */
+	dialog->timer_b = global_timer_b; /* Default SIP transaction timer B (RFC 3261) */
 	peer = find_peer(peername, NULL, 1);
 
 	if (peer) {
@@ -3633,7 +3652,7 @@
 		p->invitestate = INV_CALLING;
 	
 		/* Initialize auto-congest time */
-		p->initid = ast_sched_replace(p->initid, sched, SIP_TRANS_TIMEOUT, 
+		p->initid = ast_sched_replace(p->initid, sched, p->timer_b, 
 			auto_congest, dialog_ref(p));
 	}
 
@@ -5067,8 +5086,10 @@
 	p->stateid = -1;
 	p->prefs = default_prefs;		/* Set default codecs for this call */
 
-	if (intended_method != SIP_OPTIONS)	/* Peerpoke has it's own system */
-		p->timer_t1 = SIP_TIMER_T1;	/* Default SIP retransmission timer T1 (RFC 3261) */
+	if (intended_method != SIP_OPTIONS) {	/* Peerpoke has it's own system */
+		p->timer_t1 = global_t1;	/* Default SIP retransmission timer T1 (RFC 3261) */
+		p->timer_b = global_timer_b;	/* Default SIP transaction timer B (RFC 3261) */
+	}
 
 	if (!sin)
 		p->ourip = internip;
@@ -5109,14 +5130,14 @@
 			ast_free(p);
 			return NULL;
 		}
-		ast_rtp_setqos(p->rtp, global_tos_audio, global_cos_audio);
+		ast_rtp_setqos(p->rtp, global_tos_audio, global_cos_audio, "SIP RTP");
 		ast_rtp_setdtmf(p->rtp, ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_RFC2833);
 		ast_rtp_setdtmfcompensate(p->rtp, ast_test_flag(&p->flags[1], SIP_PAGE2_RFC2833_COMPENSATE));
 		ast_rtp_set_rtptimeout(p->rtp, global_rtptimeout);
 		ast_rtp_set_rtpholdtimeout(p->rtp, global_rtpholdtimeout);
 		ast_rtp_set_rtpkeepalive(p->rtp, global_rtpkeepalive);
 		if (p->vrtp) {
-			ast_rtp_setqos(p->vrtp, global_tos_video, global_cos_video);
+			ast_rtp_setqos(p->vrtp, global_tos_video, global_cos_video, "SIP VRTP");
 			ast_rtp_setdtmf(p->vrtp, 0);
 			ast_rtp_setdtmfcompensate(p->vrtp, 0);
 			ast_rtp_set_rtptimeout(p->vrtp, global_rtptimeout);
@@ -5124,7 +5145,7 @@
 			ast_rtp_set_rtpkeepalive(p->vrtp, global_rtpkeepalive);
 		}
 		if (p->trtp) {
-			ast_rtp_setqos(p->trtp, global_tos_text, global_cos_text);
+			ast_rtp_setqos(p->trtp, global_tos_text, global_cos_text, "SIP TRTP");
 			ast_rtp_setdtmf(p->trtp, 0);
 			ast_rtp_setdtmfcompensate(p->trtp, 0);
 		}
@@ -10377,6 +10398,15 @@
 		p->callingpres = peer->callingpres;
 	if (peer->maxms && peer->lastms)
 		p->timer_t1 = peer->lastms < global_t1min ? global_t1min : peer->lastms;
+ 	else
+ 		p->timer_t1 = peer->timer_t1;
+ 
+ 	/* Set timer B to control transaction timeouts */
+ 	if (peer->timer_b)
+ 		p->timer_b = peer->timer_b;
+ 	else
+ 		p->timer_b = 64 * p->timer_t1;
+ 
 	if (ast_test_flag(&peer->flags[0], SIP_INSECURE_INVITE)) {
 		/* Pretend there is no required authentication */
 		ast_string_field_set(p, peersecret, NULL);
@@ -11539,6 +11569,8 @@
 
 		/* - is enumerated */
 		ast_cli(fd, "  DTMFmode     : %s\n", dtmfmode2str(ast_test_flag(&peer->flags[0], SIP_DTMF)));
+		ast_cli(fd, "  Timer T1     : %d\n", peer->timer_t1);
+		ast_cli(fd, "  Timer B      : %d\n", peer->timer_b);
 		ast_cli(fd, "  ToHost       : %s\n", peer->tohost);
 		ast_cli(fd, "  Addr->IP     : %s Port %d\n",  peer->addr.sin_addr.s_addr ? ast_inet_ntoa(peer->addr.sin_addr) : "(Unspecified)", ntohs(peer->addr.sin_port));
 		ast_cli(fd, "  Defaddr->IP  : %s Port %d\n", ast_inet_ntoa(peer->defaddr.sin_addr), ntohs(peer->defaddr.sin_port));
@@ -11934,7 +11966,6 @@
 	ast_cli(a->fd, "  Codec Order:            ");
 	print_codec_to_cli(a->fd, &default_prefs);
 	ast_cli(a->fd, "\n");
-	ast_cli(a->fd, "  T1 minimum:             %d\n", global_t1min);
 	ast_cli(a->fd, "  Relax DTMF:             %s\n", cli_yesno(global_relaxdtmf));
 	ast_cli(a->fd, "  Compact SIP headers:    %s\n", cli_yesno(compactheaders));
 	ast_cli(a->fd, "  RTP Keepalive:          %d %s\n", global_rtpkeepalive, global_rtpkeepalive ? "" : "(Disabled)" );
@@ -11955,6 +11986,9 @@
 	ast_cli(a->fd, "  Auto-Framing:           %s\n", cli_yesno(global_autoframing));
 	ast_cli(a->fd, "  Outb. proxy:            %s %s\n", ast_strlen_zero(global_outboundproxy.name) ? "<not set>" : global_outboundproxy.name,
 							global_outboundproxy.force ? "(forced)" : "");
+ 	ast_cli(a->fd, "  Timer T1:               %d\n", global_t1);
+	ast_cli(a->fd, "  Timer T1 minimum:       %d\n", global_t1min);
+ 	ast_cli(a->fd, "  Timer B:                %d\n", global_timer_b);
 
 	ast_cli(a->fd, "\nDefault Settings:\n");
 	ast_cli(a->fd, "-----------------\n");
@@ -17801,6 +17835,8 @@
 	peer->pickupgroup = 0;
 	peer->maxms = default_qualify;
 	peer->prefs = default_prefs;
+	peer->timer_t1 = global_t1;
+	peer->timer_b = global_timer_b;
 	clear_peer_mailboxes(peer);
 }
 
@@ -18076,6 +18112,16 @@
 				ast_log(LOG_WARNING, "'%s' is not a valid RTP keepalive time at line %d.  Using default.\n", v->value, v->lineno);
 				peer->rtpkeepalive = global_rtpkeepalive;
 			}
+      } else if (!strcasecmp(v->name, "timert1")) {
+         if ((sscanf(v->value, "%d", &peer->timer_t1) != 1) || (peer->timer_t1 < 0)) {
+            ast_log(LOG_WARNING, "'%s' is not a valid T1 time at line %d.  Using default.\n", v->value, v->lineno);
+            peer->timer_t1 = global_t1;
+         }
+      } else if (!strcasecmp(v->name, "timerb")) {
+         if ((sscanf(v->value, "%d", &peer->timer_b) != 1) || (peer->timer_b < 0)) {
+            ast_log(LOG_WARNING, "'%s' is not a valid Timer B time at line %d.  Using default.\n", v->value, v->lineno);
+            peer->timer_b = global_timer_b;
+         }
 		} else if (!strcasecmp(v->name, "setvar")) {
 			peer->chanvars = add_var(v->value, peer->chanvars);
 		} else if (!strcasecmp(v->name, "qualify")) {
@@ -18296,6 +18342,8 @@
 	/* Misc settings for the channel */
 	global_relaxdtmf = FALSE;
 	global_callevents = FALSE;
+	global_t1 = SIP_TIMER_T1;
+	global_timer_b = 64 * SIP_TIMER_T1;
 	global_t1min = DEFAULT_T1MIN;		
 
 	global_matchexterniplocally = FALSE;
@@ -18527,24 +18575,28 @@
 				registry_count++;
 		} else if (!strcasecmp(v->name, "tos_sip")) {
 			if (ast_str2tos(v->value, &global_tos_sip))
-				ast_log(LOG_WARNING, "Invalid tos_sip value at line %d, recommended value is 'cs3'. See doc/qos.tex.\n", v->lineno);
+				ast_log(LOG_WARNING, "Invalid tos_sip value at line %d, refer to QoS documentation\n", v->lineno);
 		} else if (!strcasecmp(v->name, "tos_audio")) {
 			if (ast_str2tos(v->value, &global_tos_audio))
-				ast_log(LOG_WARNING, "Invalid tos_audio value at line %d, recommended value is 'ef'. See doc/qos.tex.\n", v->lineno);
+				ast_log(LOG_WARNING, "Invalid tos_audio value at line %d, refer to QoS documentation\n", v->lineno);
 		} else if (!strcasecmp(v->name, "tos_video")) {
 			if (ast_str2tos(v->value, &global_tos_video))
-				ast_log(LOG_WARNING, "Invalid tos_video value at line %d, recommended value is 'af41'. See doc/qos.tex.\n", v->lineno);
+				ast_log(LOG_WARNING, "Invalid tos_video value at line %d, refer to QoS documentation\n", v->lineno);
 		} else if (!strcasecmp(v->name, "tos_text")) {
 			if (ast_str2tos(v->value, &global_tos_text))
-				ast_log(LOG_WARNING, "Invalid tos_text value at line %d, recommended value is 'af41'. See doc/qos.tex.\n", v->lineno);
+				ast_log(LOG_WARNING, "Invalid tos_text value at line %d, refer to QoS documentation\n", v->lineno);
 		} else if (!strcasecmp(v->name, "cos_sip")) {
-			ast_str2cos(v->value, &global_cos_sip);
+			if (ast_str2cos(v->value, &global_cos_sip))
+				ast_log(LOG_WARNING, "Invalid cos_sip value at line %d, refer to QoS documentation\n", v->lineno);
 		} else if (!strcasecmp(v->name, "cos_audio")) {
-			ast_str2cos(v->value, &global_cos_audio);
+			if (ast_str2cos(v->value, &global_cos_audio))
+				ast_log(LOG_WARNING, "Invalid cos_audio value at line %d, refer to QoS documentation\n", v->lineno);
 		} else if (!strcasecmp(v->name, "cos_video")) {
-			ast_str2cos(v->value, &global_cos_video);
+			if (ast_str2cos(v->value, &global_cos_video))
+				ast_log(LOG_WARNING, "Invalid cos_video value at line %d, refer to QoS documentation\n", v->lineno);
 		} else if (!strcasecmp(v->name, "cos_text")) {
-			ast_str2cos(v->value, &global_cos_text);
+			if (ast_str2cos(v->value, &global_cos_text))
+				ast_log(LOG_WARNING, "Invalid cos_text value at line %d, refer to QoS documentation\n", v->lineno);
 		} else if (!strcasecmp(v->name, "bindport")) {
 			int i;
 			if (sscanf(v->value, "%d", &i) == 1) {
@@ -18713,7 +18765,7 @@
 			} else {
 				ast_verb(2, "SIP Listening on %s:%d\n",
 						ast_inet_ntoa(bindaddr.sin_addr), ntohs(bindaddr.sin_port));
-				ast_netsock_set_qos(sipsock, global_tos_sip, global_cos_sip);
+				ast_netsock_set_qos(sipsock, global_tos_sip, global_cos_sip, "SIP");
 			}
 		}
 	}

Modified: team/russell/jack/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/team/russell/jack/channels/chan_skinny.c?view=diff&rev=93176&r1=93175&r2=93176
==============================================================================
--- team/russell/jack/channels/chan_skinny.c (original)
+++ team/russell/jack/channels/chan_skinny.c Sun Dec 16 16:19:16 2007
@@ -50,6 +50,7 @@
 #include "asterisk/sched.h"
 #include "asterisk/io.h"
 #include "asterisk/rtp.h"
+#include "asterisk/netsock.h"
 #include "asterisk/acl.h"
 #include "asterisk/callerid.h"
 #include "asterisk/cli.h"
@@ -89,6 +90,13 @@
 #define DEFAULT_SKINNY_PORT	2000
 #define DEFAULT_SKINNY_BACKLOG	2
 #define SKINNY_MAX_PACKET	1000
+
+static unsigned int tos = 0;
+static unsigned int tos_audio = 0;
+static unsigned int tos_video = 0;
+static unsigned int cos = 0;
+static unsigned int cos_audio = 0;
+static unsigned int cos_video = 0;
 
 static int keep_alive = 120;
 static char vmexten[AST_MAX_EXTENSION];		/* Voicemail pilot number */
@@ -2976,9 +2984,11 @@
 		ast_channel_set_fd(sub->owner, 3, ast_rtcp_fd(sub->vrtp));
 	}
 	if (sub->rtp) {
+		ast_rtp_setqos(sub->rtp, tos_audio, cos_audio, "Skinny RTP");
 		ast_rtp_setnat(sub->rtp, l->nat);
 	}
 	if (sub->vrtp) {
+		ast_rtp_setqos(sub->vrtp, tos_video, cos_video, "Skinny VRTP");
 		ast_rtp_setnat(sub->vrtp, l->nat);
 	}
 	/* Set Frame packetization */
@@ -5516,6 +5526,24 @@
 			ast_copy_string(regcontext, v->value, sizeof(regcontext));
 		} else if (!strcasecmp(v->name, "dateformat")) {
 			memcpy(date_format, v->value, sizeof(date_format));
+                } else if (!strcasecmp(v->name, "tos")) {
+                        if (ast_str2tos(v->value, &tos))
+                    		ast_log(LOG_WARNING, "Invalid tos value at line %d, refer to QoS documentation\n", v->lineno);
+                } else if (!strcasecmp(v->name, "tos_audio")) {
+                        if (ast_str2tos(v->value, &tos_audio))
+                    		ast_log(LOG_WARNING, "Invalid tos_audio value at line %d, refer to QoS documentation\n", v->lineno);
+                } else if (!strcasecmp(v->name, "tos_video")) {
+                        if (ast_str2tos(v->value, &tos_video))
+                    		ast_log(LOG_WARNING, "Invalid tos_video value at line %d, refer to QoS documentation\n", v->lineno);
+		} else if (!strcasecmp(v->name, "cos")) {
+		        if (ast_str2cos(v->value, &cos))
+		                ast_log(LOG_WARNING, "Invalid cos value at line %d, refer to QoS documentation\n", v->lineno);
+		} else if (!strcasecmp(v->name, "cos_audio")) {
+		        if (ast_str2cos(v->value, &cos_audio))
+		                ast_log(LOG_WARNING, "Invalid cos_audio value at line %d, refer to QoS documentation\n", v->lineno);
+		} else if (!strcasecmp(v->name, "cos_video")) {
+		        if (ast_str2cos(v->value, &cos_video))
+		                ast_log(LOG_WARNING, "Invalid cos_video value at line %d, refer to QoS documentation\n", v->lineno);
 		} else if (!strcasecmp(v->name, "allow")) {
 			ast_parse_allow_disallow(&default_prefs, &default_capability, v->value, 1);
 		} else if (!strcasecmp(v->name, "disallow")) {
@@ -5604,6 +5632,7 @@
 			}
 			ast_verb(2, "Skinny listening on %s:%d\n",
 					ast_inet_ntoa(bindaddr.sin_addr), ntohs(bindaddr.sin_port));
+			ast_netsock_set_qos(skinnysock, tos, cos, "Skinny");
 			ast_pthread_create_background(&accept_t,NULL, accept_thread, NULL);
 		}
 	}

Modified: team/russell/jack/channels/chan_unistim.c
URL: http://svn.digium.com/view/asterisk/team/russell/jack/channels/chan_unistim.c?view=diff&rev=93176&r1=93175&r2=93176
==============================================================================
--- team/russell/jack/channels/chan_unistim.c (original)
+++ team/russell/jack/channels/chan_unistim.c Sun Dec 16 16:19:16 2007
@@ -59,6 +59,7 @@
 #include "asterisk/sched.h"
 #include "asterisk/io.h"
 #include "asterisk/rtp.h"
+#include "asterisk/netsock.h"
 #include "asterisk/acl.h"
 #include "asterisk/callerid.h"
 #include "asterisk/cli.h"
@@ -214,6 +215,10 @@
 static enum autoprovision autoprovisioning = AUTOPROVISIONING_NO;
 static int unistim_keepalive;
 static int unistimsock = -1;
+static unsigned int tos = 0;
+static unsigned int tos_audio = 0;
+static unsigned int cos = 0;
+static unsigned int cos_audio = 0;
 static struct io_context *io;
 static struct sched_context *sched;
 static struct sockaddr_in public_ip = { 0, };
@@ -2075,8 +2080,10 @@
 		sub->owner->fds[0] = ast_rtp_fd(sub->rtp);
 		sub->owner->fds[1] = ast_rtcp_fd(sub->rtp);
 	}
-	if (sub->rtp)
+	if (sub->rtp) {
+		ast_rtp_setqos(sub->rtp, tos_audio, cos_audio, "UNISTIM RTP");
 		ast_rtp_setnat(sub->rtp, sub->parent->parent->nat);
+	}
 
 	/* Create the RTP connection */
 	ast_rtp_get_us(sub->rtp, &us);
@@ -5330,7 +5337,19 @@
 			unistim_keepalive = atoi(v->value);
 		else if (!strcasecmp(v->name, "port"))
 			unistim_port = atoi(v->value);
-		else if (!strcasecmp(v->name, "autoprovisioning")) {
+                else if (!strcasecmp(v->name, "tos")) {
+                        if (ast_str2tos(v->value, &tos))
+                            ast_log(LOG_WARNING, "Invalid tos value at line %d, refer to QoS documentation\n", v->lineno);
+                } else if (!strcasecmp(v->name, "tos_audio")) {
+                        if (ast_str2tos(v->value, &tos_audio))
+                            ast_log(LOG_WARNING, "Invalid tos_audio value at line %d, refer to QoS documentation\n", v->lineno);
+                } else if (!strcasecmp(v->name, "cos")) {
+                        if (ast_str2cos(v->value, &cos))
+                            ast_log(LOG_WARNING, "Invalid cos value at line %d, refer to QoS documentation\n", v->lineno);
+                } else if (!strcasecmp(v->name, "cos_audio")) {
+                        if (ast_str2cos(v->value, &cos_audio))
+                            ast_log(LOG_WARNING, "Invalid cos_audio value at line %d, refer to QoS documentation\n", v->lineno);
+		} else if (!strcasecmp(v->name, "autoprovisioning")) {
 			if (!strcasecmp(v->value, "no"))
 				autoprovisioning = AUTOPROVISIONING_NO;
 			else if (!strcasecmp(v->value, "yes"))
@@ -5511,6 +5530,7 @@
 						"UNISTIM Listening on %s:%d\n",
 						ast_inet_ntoa(bindaddr.sin_addr), htons(bindaddr.sin_port));
 		}
+		ast_netsock_set_qos(unistimsock, tos, cos, "UNISTIM");
 	}
 	return 0;
 }

Added: team/russell/jack/channels/console_video.c
URL: http://svn.digium.com/view/asterisk/team/russell/jack/channels/console_video.c?view=auto&rev=93176
==============================================================================
--- team/russell/jack/channels/console_video.c (added)
+++ team/russell/jack/channels/console_video.c Sun Dec 16 16:19:16 2007
@@ -1,0 +1,3280 @@
+/*
+ * Experimental support for video sessions. We use SDL for rendering, ffmpeg
+ * as the codec library for encoding and decoding, and Video4Linux and X11
+ * to generate the local video stream.
+ *
+ * If one of these pieces is not available, either at compile time or at
+ * runtime, we do our best to run without it. Of course, no codec library
+ * means we can only deal with raw data, no SDL means we cannot do rendering,
+ * no V4L or X11 means we cannot generate data (but in principle we could
+ * stream from or record to a file).
+ *
+ * We need a recent (2007.07.12 or newer) version of ffmpeg to avoid warnings.
+ * Older versions might give 'deprecated' messages during compilation,
+ * thus not compiling in AST_DEVMODE, or don't have swscale, in which case
+ * you can try to compile #defining OLD_FFMPEG here.
+ *
+ * $Revision$
+ */
+
+//#define DROP_PACKETS 5       /* if set, drop this % of video packets */
+//#define OLD_FFMPEG	1	/* set for old ffmpeg with no swscale */
+
+
+/*
+The code is structured as follows.
+
+When a new console channel is created, we call console_video_start()
+to initialize SDL, the source, and the encoder/ decoder for the
+formats in use (XXX the latter two should be done later, once the
+codec negotiation is complete).  Also, a thread is created to handle
+the video source and generate frames.
+
+While communication is on, the local source is generated by the
+video thread, which wakes up periodically, generates frames and
+enqueues them in chan->readq.  Incoming rtp frames are passed to
+console_write_video(), decoded and passed to SDL for display.
+
+For as unfortunate and confusing as it can be, we need to deal with a
+number of different video representations (size, codec/pixel format,
+codec parameters), as follows:
+
+ loc_src	is the data coming from the camera/X11/etc.
+	The format is typically constrained by the video source.
+
+ enc_in		is the input required by the encoder.
+	Typically constrained in size by the encoder type.
+
+ enc_out	is the bitstream transmitted over RTP.
+	Typically negotiated while the call is established.
+
+ loc_dpy	is the format used to display the local video source.
+	Depending on user preferences this can have the same size as
+	loc_src_fmt, or enc_in_fmt, or thumbnail size (e.g. PiP output)
+
+ dec_in		is the incoming RTP bitstream. Negotiated
+	during call establishment, it is not necessarily the same as
+	enc_in_fmt
+
+ dec_out	the output of the decoder.
+	The format is whatever the other side sends, and the
+	buffer is allocated by avcodec_decode_... so we only
+	copy the data here.
+
+ rem_dpy	the format used to display the remote stream
+
+We store the format info together with the buffer storing the data.
+As a future optimization, a format/buffer may reference another one
+if the formats are equivalent. This will save some unnecessary format
+conversion.
+
+
+In order to handle video you need to add to sip.conf (and presumably
+iax.conf too) the following:
+
+	[general](+)
+		videosupport=yes
+		allow=h263	; this or other video formats
+		allow=h263p	; this or other video formats
+
+ */
+
+/*
+ * Codecs are absolutely necessary or we cannot do anything.
+ * In principle SDL is optional too (used for rendering only, but we
+ * could still source data withouth it), however at the moment it is required.
+ */
+#if defined(HAVE_FFMPEG) && defined(HAVE_SDL)
+
+#ifdef HAVE_X11
+#include <X11/Xlib.h>		/* this should be conditional */
+#endif
+
+#include <ffmpeg/avcodec.h>
+#ifndef OLD_FFMPEG
+#include <ffmpeg/swscale.h>	/* requires a recent ffmpeg */
+#endif
+
+#include <SDL/SDL.h>
+#ifdef HAVE_SDL_IMAGE
+#include <SDL/SDL_image.h>	/* for loading images */
+#endif
+#ifdef HAVE_SDL_TTF
+#include <SDL/SDL_ttf.h>	/* render text on sdl surfaces */
+#endif
+
+/*
+ * In many places we use buffers to store the raw frames (but not only),
+ * so here is a structure to keep all the info. data = NULL means the
+ * structure is not initialized, so the other fields are invalid.
+ * size = 0 means the buffer is not malloc'ed so we don't have to free it.
+ */
+struct fbuf_t {		/* frame buffers, dynamically allocated */
+	uint8_t	*data;	/* memory, malloced if size > 0, just reference
+			 * otherwise */
+	int	size;	/* total size in bytes */
+	int	used;	/* space used so far */
+	int	ebit;	/* bits to ignore at the end */
+	int	x;	/* origin, if necessary */
+	int	y;
+	int	w;	/* size */ 
+	int	h;
+	int	pix_fmt;
+};
+
+struct video_codec_desc;	/* forward declaration */
+/*
+ * Descriptor of the local source, made of the following pieces:

[... 4655 lines stripped ...]



More information about the asterisk-commits mailing list