[asterisk-commits] russell: trunk r85097 - in /trunk: channels/ doc/tex/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Oct 9 10:10:15 CDT 2007


Author: russell
Date: Tue Oct  9 10:10:14 2007
New Revision: 85097

URL: http://svn.digium.com/view/asterisk?view=rev&rev=85097
Log:
Add jitterbuffer support for chan_local.  To enable it, you use the 'j' option
in the Dial command.  The 'j' option _must_ be used in conjunction with the 'n'
option.

This feature will allow you to use the existing jitterbuffer implementation to
put a jitterbuffer on incoming SIP calls connecting to Asterisk applications by
putting a local channel in the middle.

Modified:
    trunk/channels/chan_local.c
    trunk/doc/tex/localchannel.tex

Modified: trunk/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_local.c?view=diff&rev=85097&r1=85096&r2=85097
==============================================================================
--- trunk/channels/chan_local.c (original)
+++ trunk/channels/chan_local.c Tue Oct  9 10:10:14 2007
@@ -65,6 +65,13 @@
 static const char tdesc[] = "Local Proxy Channel Driver";
 
 #define IS_OUTBOUND(a,b) (a == b->chan ? 1 : 0)
+
+static struct ast_jb_conf g_jb_conf = {
+	.flags = 0,
+	.max_size = -1,
+	.resync_threshold = -1,
+	.impl = "",
+};
 
 static struct ast_channel *local_request(const char *type, int format, void *data, int *cause);
 static int local_digit_begin(struct ast_channel *ast, char digit);
@@ -108,6 +115,7 @@
 	char context[AST_MAX_CONTEXT];		/* Context to call */
 	char exten[AST_MAX_EXTENSION];		/* Extension to call */
 	int reqformat;				/* Requested format */
+	struct ast_jb_conf jb_conf;		/*!< jitterbuffer configuration for this local channel */
 	struct ast_channel *owner;		/* Master Channel */
 	struct ast_channel *chan;		/* Outbound channel */
 	struct ast_module_user *u_owner;	/*! reference to keep the module loaded while in use */
@@ -563,11 +571,21 @@
 	ast_mutex_init(&tmp->lock);
 	ast_copy_string(tmp->exten, data, sizeof(tmp->exten));
 
+	memcpy(&tmp->jb_conf, &g_jb_conf, sizeof(tmp->jb_conf));
+
 	/* Look for options */
 	if ((opts = strchr(tmp->exten, '/'))) {
 		*opts++ = '\0';
 		if (strchr(opts, 'n'))
 			ast_set_flag(tmp, LOCAL_NO_OPTIMIZATION);
+		if (strchr(opts, 'j')) {
+			if (ast_test_flag(tmp, LOCAL_NO_OPTIMIZATION))
+				ast_set_flag(&tmp->jb_conf, AST_JB_ENABLED);
+			else {
+				ast_log(LOG_ERROR, "You must use the 'n' option for chan_local "
+					"to use the 'j' option to enable the jitterbuffer\n");
+			}
+		}
 	}
 
 	/* Look for a context */
@@ -652,6 +670,8 @@
 	tmp->priority = 1;
 	tmp2->priority = 1;
 
+	ast_jb_configure(tmp, &p->jb_conf);
+
 	return tmp;
 }
 

Modified: trunk/doc/tex/localchannel.tex
URL: http://svn.digium.com/view/asterisk/trunk/doc/tex/localchannel.tex?view=diff&rev=85097&r1=85096&r2=85097
==============================================================================
--- trunk/doc/tex/localchannel.tex (original)
+++ trunk/doc/tex/localchannel.tex Tue Oct  9 10:10:14 2007
@@ -8,6 +8,8 @@
 \end{verbatim}
 
 Adding "/n" at the end of the string will make the Local channel not do a native transfer (the "n" stands for "n"o release) upon the remote end answering the line. This is an esoteric, but important feature if you expect the Local channel to handle calls exactly like a normal channel. If you do not have the "no release" feature set, then as soon as the destination (inside of the Local channel) answers the line, the variables and dial plan will revert back to that of the original call, and the Local channel will become a zombie and be removed from the active channels list. This is desirable in some circumstances, but can result in unexpected dialplan behavior if you are doing fancy things with variables in your call handling.
+
+There is another option that can be used with local channels, which is the "j" option.  The "j" option must be used with the "n" option to make sure that the local channel does not get optimized out of the call.  This option will enable a jitterbuffer on the local channel.  The jitterbuffer will be used to de-jitter audio that it receives from the channel that called the local channel.  This is especially in the case of putting chan\_local in between an incoming SIP call and Asterisk applications, so that the incoming audio will be de-jittered.
 
 \subsection{Purpose}
 




More information about the asterisk-commits mailing list