[svn-commits] branch oej/zfonepassthrough r34846 - in /team/oej/zfonepassthrough: ./ apps/ ...

svn-commits at lists.digium.com svn-commits at lists.digium.com
Mon Jun 19 08:52:57 MST 2006


Author: oej
Date: Mon Jun 19 10:52:56 2006
New Revision: 34846

URL: http://svn.digium.com/view/asterisk?rev=34846&view=rev
Log:
Update

Added:
    team/oej/zfonepassthrough/abstract_jb.c
      - copied unchanged from r31250, trunk/abstract_jb.c
    team/oej/zfonepassthrough/include/asterisk/abstract_jb.h
      - copied unchanged from r31250, trunk/include/asterisk/abstract_jb.h
    team/oej/zfonepassthrough/scx_jitterbuf.c
      - copied unchanged from r31250, trunk/scx_jitterbuf.c
    team/oej/zfonepassthrough/scx_jitterbuf.h
      - copied unchanged from r31250, trunk/scx_jitterbuf.h
Modified:
    team/oej/zfonepassthrough/   (props changed)
    team/oej/zfonepassthrough/.cleancount
    team/oej/zfonepassthrough/Makefile
    team/oej/zfonepassthrough/apps/app_dial.c
    team/oej/zfonepassthrough/apps/app_meetme.c
    team/oej/zfonepassthrough/cdr/cdr_radius.c
    team/oej/zfonepassthrough/channel.c
    team/oej/zfonepassthrough/channels/chan_alsa.c
    team/oej/zfonepassthrough/channels/chan_h323.c
    team/oej/zfonepassthrough/channels/chan_iax2.c
    team/oej/zfonepassthrough/channels/chan_jingle.c
    team/oej/zfonepassthrough/channels/chan_mgcp.c
    team/oej/zfonepassthrough/channels/chan_oss.c
    team/oej/zfonepassthrough/channels/chan_sip.c
    team/oej/zfonepassthrough/channels/chan_skinny.c
    team/oej/zfonepassthrough/channels/chan_zap.c
    team/oej/zfonepassthrough/cli.c
    team/oej/zfonepassthrough/configs/alsa.conf.sample
    team/oej/zfonepassthrough/configs/oss.conf.sample
    team/oej/zfonepassthrough/configs/sip.conf.sample
    team/oej/zfonepassthrough/configs/skinny.conf.sample
    team/oej/zfonepassthrough/configs/zapata.conf.sample
    team/oej/zfonepassthrough/frame.c
    team/oej/zfonepassthrough/include/asterisk/channel.h
    team/oej/zfonepassthrough/include/asterisk/frame.h
    team/oej/zfonepassthrough/res/res_agi.c
    team/oej/zfonepassthrough/rtp.c
    team/oej/zfonepassthrough/translate.c

Propchange: team/oej/zfonepassthrough/
------------------------------------------------------------------------------
    automerge = http://edvina.net/training/

Propchange: team/oej/zfonepassthrough/
------------------------------------------------------------------------------
Binary property 'branch-1.2-blocked' - no diff available.

Propchange: team/oej/zfonepassthrough/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Propchange: team/oej/zfonepassthrough/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Jun 19 10:52:56 2006
@@ -1,1 +1,1 @@
-/trunk:1-31044
+/trunk:1-31273

Modified: team/oej/zfonepassthrough/.cleancount
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/.cleancount?rev=34846&r1=34845&r2=34846&view=diff
==============================================================================
--- team/oej/zfonepassthrough/.cleancount (original)
+++ team/oej/zfonepassthrough/.cleancount Mon Jun 19 10:52:56 2006
@@ -1,1 +1,1 @@
-17
+18

Modified: team/oej/zfonepassthrough/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/Makefile?rev=34846&r1=34845&r2=34846&view=diff
==============================================================================
--- team/oej/zfonepassthrough/Makefile (original)
+++ team/oej/zfonepassthrough/Makefile Mon Jun 19 10:52:56 2006
@@ -282,7 +282,7 @@
 	astmm.o enum.o srv.o dns.o aescrypt.o aestab.o aeskey.o \
 	utils.o plc.o jitterbuf.o dnsmgr.o devicestate.o \
 	netsock.o slinfactory.o ast_expr2.o ast_expr2f.o \
-	cryptostub.o sha1.o http.o
+	cryptostub.o sha1.o http.o scx_jitterbuf.o abstract_jb.o
 
 # we need to link in the objects statically, not as a library, because
 # otherwise modules will not have them available if none of the static
@@ -371,7 +371,7 @@
 	@echo " +               make install                +"  
 	@echo " +-------------------------------------------+"  
 
-all: cleantest defaults.h config.status menuselect.makeopts depend asterisk subdirs
+all: cleantest config.status menuselect.makeopts depend asterisk subdirs
 
 config.status: configure
 	@CFLAGS="" ./configure
@@ -907,6 +907,7 @@
 cleantest:
 	@if cmp -s .cleancount .lastclean ; then echo ; else \
 		$(MAKE) clean; cp -f .cleancount .lastclean;\
+		$(MAKE) defaults.h;\
 	fi
 
 _uninstall:

Modified: team/oej/zfonepassthrough/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/apps/app_dial.c?rev=34846&r1=34845&r2=34846&view=diff
==============================================================================
--- team/oej/zfonepassthrough/apps/app_dial.c (original)
+++ team/oej/zfonepassthrough/apps/app_dial.c Mon Jun 19 10:52:56 2006
@@ -488,6 +488,7 @@
 						if (option_verbose > 2)
 							ast_verbose(VERBOSE_PREFIX_3 "Forwarding %s to '%s/%s' prevented.\n", in->name, tech, stuff);
 						c = o->chan = NULL;
+						cause = AST_CAUSE_BUSY;
 					} else {
 						/* Setup parameters */
 						c = o->chan = ast_request(tech, in->nativeformats, stuff, &cause);
@@ -1083,6 +1084,8 @@
 				ast_hangup(tmp->chan);
 				/* If we have been told to ignore forwards, just set this channel to null and continue processing extensions normally */
 				if (ast_test_flag(&opts, OPT_IGNORE_FORWARDING)) {
+					tmp->chan = NULL;
+					cause = AST_CAUSE_BUSY;
 					if (option_verbose > 2)
 						ast_verbose(VERBOSE_PREFIX_3 "Forwarding %s to '%s/%s' prevented.\n", chan->name, tech, stuff);
 				} else {

Modified: team/oej/zfonepassthrough/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/apps/app_meetme.c?rev=34846&r1=34845&r2=34846&view=diff
==============================================================================
--- team/oej/zfonepassthrough/apps/app_meetme.c (original)
+++ team/oej/zfonepassthrough/apps/app_meetme.c Mon Jun 19 10:52:56 2006
@@ -151,7 +151,7 @@
 	/*! If set, user will be asked to record name on entry of conference 
 	 *  without review */
 	CONFFLAG_STARTMUTED = (1 << 24)
-	/*! If set, the user will be initially muted by admin */
+	/*! If set, the user will be initially self-muted */
 };
 
 AST_APP_OPTIONS(meetme_opts, {
@@ -212,7 +212,7 @@
 "      'i' -- announce user join/leave with review\n"
 "      'I' -- announce user join/leave without review\n"
 "      'l' -- set listen only mode (Listen only, no talking)\n"
-"      'm' -- set initially muted by admin\n"
+"      'm' -- set initially muted\n"
 "      'M' -- enable music on hold when the conference has a single caller\n"
 "      'o' -- set talker optimization - treats talkers who aren't speaking as\n"
 "             being muted, meaning (a) No encode is done on transmission and\n"
@@ -250,10 +250,10 @@
 "      'K' -- Kick all users out of conference\n"
 "      'l' -- Unlock conference\n"
 "      'L' -- Lock conference\n"
-"      'm' -- Unmute conference\n"
-"      'M' -- Mute conference\n"
-"      'n' -- Unmute entire conference (except admin)\n"
-"      'N' -- Mute entire conference (except admin)\n"
+"      'm' -- Unmute one user\n"
+"      'M' -- Mute one user\n"
+"      'n' -- Unmute all users in the conference\n"
+"      'N' -- Mute all non-admin users in the conference\n"
 "      'r' -- Reset one user's volume settings\n"
 "      'R' -- Reset all users volume settings\n"
 "      's' -- Lower entire conference speaking volume\n"
@@ -703,7 +703,7 @@
 					user->chan->name,
 					user->userflags & CONFFLAG_ADMIN ? "(Admin)" : "",
 					user->userflags & CONFFLAG_MONITOR ? "(Listen only)" : "",
-					user->adminflags & ADMINFLAG_MUTED ? "(Admin Muted)" : "",
+					user->adminflags & ADMINFLAG_MUTED ? "(Admin Muted)" : user->adminflags & ADMINFLAG_SELFMUTED ? "(Muted)" : "",
 					istalking(user->talking), hr, min, sec);
 			else 
 				ast_cli(fd, "%d!%s!%s!%s!%s!%s!%s!%d!%02d:%02d:%02d\n",
@@ -713,7 +713,7 @@
 					user->chan->name,
 					user->userflags  & CONFFLAG_ADMIN   ? "1" : "",
 					user->userflags  & CONFFLAG_MONITOR ? "1" : "",
-					user->adminflags & ADMINFLAG_MUTED  ? "1" : "",
+					user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED)  ? "1" : "",
 					user->talking, hr, min, sec);
 			
 		}
@@ -964,7 +964,7 @@
 
 	user->chan = chan;
 	user->userflags = confflags;
-	user->adminflags = (confflags & CONFFLAG_STARTMUTED) ? ADMINFLAG_MUTED : 0;
+	user->adminflags = (confflags & CONFFLAG_STARTMUTED) ? ADMINFLAG_SELFMUTED : 0;
 	user->talking = -1;
 	conf->users++;
 	/* Update table */
@@ -1376,7 +1376,7 @@
 					user->zapchannel = !retryzap;
 					goto zapretry;
 				}
-				if ((confflags & CONFFLAG_MONITOR) || (user->adminflags & ADMINFLAG_MUTED))
+				if ((confflags & CONFFLAG_MONITOR) || (user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED)))
 					f = ast_read_noaudio(c);
 				else
 					f = ast_read(c);
@@ -1480,13 +1480,16 @@
 								menu_active = 0;
 
 								/* for admin, change both admin and use flags */
-								if (user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED)) {
+								if (user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED))
 									user->adminflags &= ~(ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED);
-									if (!ast_streamfile(chan, "conf-unmuted", chan->language))
+								else
+									user->adminflags |= (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED);
+
+								if ((confflags & CONFFLAG_MONITOR) || (user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED))) {
+									if (!ast_streamfile(chan, "conf-muted", chan->language))
 										ast_waitstream(chan, "");
 								} else {
-									user->adminflags |= (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED);
-									if (!ast_streamfile(chan, "conf-muted", chan->language))
+									if (!ast_streamfile(chan, "conf-unmuted", chan->language))
 										ast_waitstream(chan, "");
 								}
 								break;
@@ -1555,7 +1558,7 @@
 								user->adminflags ^= ADMINFLAG_SELFMUTED;
 
 								/* they can't override the admin mute state */
-								if (user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED)) {
+								if ((confflags & CONFFLAG_MONITOR) || (user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED))) {
 									if (!ast_streamfile(chan, "conf-muted", chan->language))
 										ast_waitstream(chan, "");
 								} else {
@@ -1615,7 +1618,7 @@
 					fr.offset = AST_FRIENDLY_OFFSET;
 					if (!user->listen.actual && 
 						((confflags & CONFFLAG_MONITOR) || 
-						 (user->adminflags & ADMINFLAG_MUTED) ||
+						 (user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED)) ||
 						 (!user->talking && (confflags & CONFFLAG_OPTIMIZETALKER))
 						 )) {
 						int index;
@@ -2297,13 +2300,13 @@
 				break;					
 			case 109: /* m: Unmute */ 
 				if (user) {
-					user->adminflags &= ~ADMINFLAG_MUTED;
+					user->adminflags &= ~(ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED);
 				} else
 					ast_log(LOG_NOTICE, "Specified User not found!\n");
 				break;
 			case 110: /* n: Unmute all users */
 				AST_LIST_TRAVERSE(&cnf->userlist, user, list)
-					user->adminflags &= ~ADMINFLAG_MUTED;
+					user->adminflags &= ~(ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED);
 				break;
 			case 107: /* k: Kick user */ 
 				if (user)
@@ -2424,7 +2427,7 @@
 	if (mute)
 		user->adminflags |= ADMINFLAG_MUTED;	/* request user muting */
 	else
-		user->adminflags &= ~ADMINFLAG_MUTED;	/* request user unmuting */
+		user->adminflags &= ~(ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED);	/* request user unmuting */
 
 	AST_LIST_UNLOCK(&confs);
 

Modified: team/oej/zfonepassthrough/cdr/cdr_radius.c
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/cdr/cdr_radius.c?rev=34846&r1=34845&r2=34846&view=diff
==============================================================================
--- team/oej/zfonepassthrough/cdr/cdr_radius.c (original)
+++ team/oej/zfonepassthrough/cdr/cdr_radius.c Mon Jun 19 10:52:56 2006
@@ -47,6 +47,7 @@
 #include "asterisk/module.h"
 #include "asterisk/logger.h"
 #include "asterisk/utils.h"
+#include "asterisk/options.h"
 
 /*! ISO 8601 standard format */
 #define DATE_FORMAT "%Y-%m-%d %T %z"
@@ -216,7 +217,8 @@
 	VALUE_PAIR *send = NULL;
 
 	if (build_radius_record(&send, cdr)) {
-		ast_log(LOG_WARNING, "Unable to create RADIUS record. CDR not recorded!\n");
+		if (option_debug)
+			ast_log(LOG_DEBUG, "Unable to create RADIUS record. CDR not recorded!\n");
 		return result;
 	}
 	

Modified: team/oej/zfonepassthrough/channel.c
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/channel.c?rev=34846&r1=34845&r2=34846&view=diff
==============================================================================
--- team/oej/zfonepassthrough/channel.c (original)
+++ team/oej/zfonepassthrough/channel.c Mon Jun 19 10:52:56 2006
@@ -1011,6 +1011,9 @@
 	
 	while ((vardata = AST_LIST_REMOVE_HEAD(headp, entries)))
 		ast_var_delete(vardata);
+
+	/* Destroy the jitterbuffer */
+	ast_jb_destroy(chan);
 
 	ast_string_field_free_all(chan);
 	free(chan);
@@ -3303,6 +3306,9 @@
 	int watch_c0_dtmf;
 	int watch_c1_dtmf;
 	void *pvt0, *pvt1;
+	/* Indicates whether a frame was queued into a jitterbuffer */
+	int frame_put_in_jb = 0;
+	int jb_in_use;
 	int to;
 	
 	cs[0] = c0;
@@ -3314,6 +3320,9 @@
 	watch_c0_dtmf = config->flags & AST_BRIDGE_DTMF_CHANNEL_0;
 	watch_c1_dtmf = config->flags & AST_BRIDGE_DTMF_CHANNEL_1;
 
+	/* Check the need of a jitterbuffer for each channel */
+	jb_in_use = ast_jb_do_usecheck(c0, c1);
+
 	for (;;) {
 		struct ast_channel *who, *other;
 
@@ -3332,9 +3341,15 @@
 			}
 		} else
 			to = -1;
+		/* Calculate the appropriate max sleep interval - in general, this is the time,
+		   left to the closest jb delivery moment */
+		if (jb_in_use)
+			to = ast_jb_get_when_to_wakeup(c0, c1, to);
 		who = ast_waitfor_n(cs, 2, &to);
 		if (!who) {
-			ast_log(LOG_DEBUG, "Nobody there, continuing...\n");
+			/* No frame received within the specified timeout - check if we have to deliver now */
+			if (jb_in_use)
+				ast_jb_get_and_deliver(c0, c1);
 			if (c0->_softhangup == AST_SOFTHANGUP_UNBRIDGE || c1->_softhangup == AST_SOFTHANGUP_UNBRIDGE) {
 				if (c0->_softhangup == AST_SOFTHANGUP_UNBRIDGE)
 					c0->_softhangup = 0;
@@ -3354,6 +3369,9 @@
 		}
 
 		other = (who == c0) ? c1 : c0; /* the 'other' channel */
+		/* Try add the frame info the who's bridged channel jitterbuff */
+		if (jb_in_use)
+			frame_put_in_jb = !ast_jb_put(other, f);
 
 		if ((f->frametype == AST_FRAME_CONTROL) && !(config->flags & AST_BRIDGE_IGNORE_SIGS)) {
 			int bridge_exit = 0;
@@ -3390,8 +3408,13 @@
 				ast_log(LOG_DEBUG, "Got DTMF on channel (%s)\n", who->name);
 				break;
 			}
-			/* other frames go to the other side */
-			ast_write(other, f);
+			/* Write immediately frames, not passed through jb */
+			if (!frame_put_in_jb)
+				ast_write(other, f);
+				
+			/* Check if we have to deliver now */
+			if (jb_in_use)
+				ast_jb_get_and_deliver(c0, c1);
 		}
 		/* XXX do we want to pass on also frames not matched above ? */
 		ast_frfree(f);

Modified: team/oej/zfonepassthrough/channels/chan_alsa.c
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/channels/chan_alsa.c?rev=34846&r1=34845&r2=34846&view=diff
==============================================================================
--- team/oej/zfonepassthrough/channels/chan_alsa.c (original)
+++ team/oej/zfonepassthrough/channels/chan_alsa.c Mon Jun 19 10:52:56 2006
@@ -60,6 +60,7 @@
 #include "asterisk/causes.h"
 #include "asterisk/endian.h"
 #include "asterisk/stringfields.h"
+#include "asterisk/abstract_jb.h"
 
 #include "busy.h"
 #include "ringtone.h"
@@ -69,6 +70,16 @@
 #ifdef ALSA_MONITOR
 #include "alsa-monitor.h"
 #endif
+
+/*! Global jitterbuffer configuration - by default, jb is disabled */
+static struct ast_jb_conf default_jbconf =
+{
+	.flags = 0,
+	.max_size = -1,
+	.resync_threshold = -1,
+	.impl = ""
+};
+static struct ast_jb_conf global_jbconf;
 
 #define DEBUG 0
 /* Which device to use */
@@ -812,6 +823,8 @@
 				tmp = NULL;
 			}
 		}
+		if (tmp)
+			ast_jb_configure(tmp, &global_jbconf);
 	}
 	return tmp;
 }
@@ -1051,9 +1064,18 @@
 	int x;
 	struct ast_config *cfg;
 	struct ast_variable *v;
+
+	/* Copy the default jb config over global_jbconf */
+	memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
+
 	if ((cfg = ast_config_load(config))) {
 		v = ast_variable_browse(cfg, "general");
 		while(v) {
+			/* handle jb conf */
+			if (!ast_jb_read_conf(&global_jbconf, v->name, v->value)) {
+				v = v->next;
+				continue;
+			}
 			if (!strcasecmp(v->name, "autoanswer"))
 				autoanswer = ast_true(v->value);
 			else if (!strcasecmp(v->name, "silencesuppression"))

Modified: team/oej/zfonepassthrough/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/channels/chan_h323.c?rev=34846&r1=34845&r2=34846&view=diff
==============================================================================
--- team/oej/zfonepassthrough/channels/chan_h323.c (original)
+++ team/oej/zfonepassthrough/channels/chan_h323.c Mon Jun 19 10:52:56 2006
@@ -211,7 +211,7 @@
 	.type = "H323",
 	.description = tdesc,
 	.capabilities = ((AST_FORMAT_MAX_AUDIO << 1) - 1),
-	.properties = AST_CHAN_TP_WANTSJITTER,
+	.properties = AST_CHAN_TP_WANTSJITTER | AST_CHAN_TP_CREATESJITTER,
 	.requester = oh323_request,
 	.send_digit = oh323_digit,
 	.call = oh323_call,

Modified: team/oej/zfonepassthrough/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/channels/chan_iax2.c?rev=34846&r1=34845&r2=34846&view=diff
==============================================================================
--- team/oej/zfonepassthrough/channels/chan_iax2.c (original)
+++ team/oej/zfonepassthrough/channels/chan_iax2.c Mon Jun 19 10:52:56 2006
@@ -1543,6 +1543,7 @@
 	  the IAX thread with the iaxsl lock held. */
 	struct iax_frame *fr = data;
 	fr->retrans = -1;
+	fr->af.has_timing_info = 0;
 	if (iaxs[fr->callno] && !ast_test_flag(iaxs[fr->callno], IAX_ALREADYGONE))
 		iax2_queue_frame(fr->callno, &fr->af);
 	/* Free our iax frame */

Modified: team/oej/zfonepassthrough/channels/chan_jingle.c
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/channels/chan_jingle.c?rev=34846&r1=34845&r2=34846&view=diff
==============================================================================
--- team/oej/zfonepassthrough/channels/chan_jingle.c (original)
+++ team/oej/zfonepassthrough/channels/chan_jingle.c Mon Jun 19 10:52:56 2006
@@ -191,6 +191,7 @@
 	.indicate = jingle_indicate,
 	.fixup = jingle_fixup,
 	.send_html = jingle_sendhtml,
+	.properties = AST_CHAN_TP_WANTSJITTER | AST_CHAN_TP_CREATESJITTER
 };
 
 static struct sockaddr_in bindaddr = { 0, };	/*!< The address we bind to */

Modified: team/oej/zfonepassthrough/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/channels/chan_mgcp.c?rev=34846&r1=34845&r2=34846&view=diff
==============================================================================
--- team/oej/zfonepassthrough/channels/chan_mgcp.c (original)
+++ team/oej/zfonepassthrough/channels/chan_mgcp.c Mon Jun 19 10:52:56 2006
@@ -503,7 +503,7 @@
 	.type = "MGCP",
 	.description = tdesc,
 	.capabilities = AST_FORMAT_ULAW,
-	.properties = AST_CHAN_TP_WANTSJITTER,
+	.properties = AST_CHAN_TP_WANTSJITTER | AST_CHAN_TP_CREATESJITTER,
 	.requester = mgcp_request,
 	.devicestate = mgcp_devicestate,
 	.call = mgcp_call,

Modified: team/oej/zfonepassthrough/channels/chan_oss.c
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/channels/chan_oss.c?rev=34846&r1=34845&r2=34846&view=diff
==============================================================================
--- team/oej/zfonepassthrough/channels/chan_oss.c (original)
+++ team/oej/zfonepassthrough/channels/chan_oss.c Mon Jun 19 10:52:56 2006
@@ -75,12 +75,23 @@
 #include "asterisk/causes.h"
 #include "asterisk/endian.h"
 #include "asterisk/stringfields.h"
+#include "asterisk/abstract_jb.h"
 
 /* ringtones we use */
 #include "busy.h"
 #include "ringtone.h"
 #include "ring10.h"
 #include "answer.h"
+
+/*! Global jitterbuffer configuration - by default, jb is disabled */
+static struct ast_jb_conf default_jbconf =
+{
+	.flags = 0,
+	.max_size = -1,
+	.resync_threshold = -1,
+	.impl = ""
+};
+static struct ast_jb_conf global_jbconf;
 
 /*
  * Basic mode of operation:
@@ -140,6 +151,33 @@
     ; unless you know what you are doing.
     ; queuesize = 10		; frames in device driver
     ; frags = 8			; argument to SETFRAGMENT
+
+    ;------------------------------ JITTER BUFFER CONFIGURATION --------------------------
+    ; jbenable = yes              ; Enables the use of a jitterbuffer on the receiving side of an
+                                  ; OSS channel. Defaults to "no". An enabled jitterbuffer will
+                                  ; be used only if the sending side can create and the receiving
+                                  ; side can not accept jitter. The ZAP channel can't accept jitter,
+                                  ; thus an enabled jitterbuffer on the receive ZAP side will always
+                                  ; be used if the sending side can create jitter or if ZAP jb is
+                                  ; forced.
+
+    ; jbforce = no                ; Forces the use of a jitterbuffer on the receive side of a ZAP
+                                  ; channel. Defaults to "no".
+
+    ; jbmaxsize = 200             ; Max length of the jitterbuffer in milliseconds.
+
+    ; jbresyncthreshold = 1000    ; Jump in the frame timestamps over which the jitterbuffer is
+                                  ; resynchronized. Useful to improve the quality of the voice, with
+                                  ; big jumps in/broken timestamps, usualy sent from exotic devices
+                                  ; and programs. Defaults to 1000.
+
+    ; jbimpl = fixed              ; Jitterbuffer implementation, used on the receiving side of a SIP
+                                  ; channel. Two implementation are currenlty available - "fixed"
+                                  ; (with size always equals to jbmax-size) and "adaptive" (with
+                                  ; variable size, actually the new jb of IAX2). Defaults to fixed.
+
+    ; jblog = no                  ; Enables jitterbuffer frame logging. Defaults to "no".
+    ;-----------------------------------------------------------------------------------
 
 [card1]
     ; device = /dev/dsp1	; alternate device
@@ -981,6 +1019,9 @@
 			/* XXX what about usecnt ? */
 		}
 	}
+	if (c)
+		ast_jb_configure(c, &global_jbconf);
+
 	return c;
 }
 
@@ -1407,6 +1448,10 @@
 	for (v = ast_variable_browse(cfg, ctg);v; v=v->next) {
 		M_START(v->name, v->value);
 
+		/* handle jb conf */
+		if (!ast_jb_read_conf(&global_jbconf, v->name, v->value))
+			continue;
+
 		M_BOOL("autoanswer", o->autoanswer)
 		M_BOOL("autohangup", o->autohangup)
 		M_BOOL("overridecontext", o->overridecontext)
@@ -1472,6 +1517,9 @@
 	int i;
 	struct ast_config *cfg;
 
+	/* Copy the default jb config over global_jbconf */
+	memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
+
 	/* load config file */
 	cfg = ast_config_load(config);
 	if (cfg != NULL) {

Modified: team/oej/zfonepassthrough/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/channels/chan_sip.c?rev=34846&r1=34845&r2=34846&view=diff
==============================================================================
--- team/oej/zfonepassthrough/channels/chan_sip.c (original)
+++ team/oej/zfonepassthrough/channels/chan_sip.c Mon Jun 19 10:52:56 2006
@@ -139,6 +139,7 @@
 #include "asterisk/stringfields.h"
 #include "asterisk/monitor.h"
 #include "asterisk/localtime.h"
+#include "asterisk/abstract_jb.h"
 
 #ifndef FALSE
 #define FALSE	0
@@ -201,6 +202,16 @@
 #define SIP_MAX_PACKET		4096	/*!< Also from RFC 3261 (2543), should sub headers tho */
 
 #define	INITIAL_CSEQ		101	/*!< our initial sip sequence number */
+
+/*! Global jitterbuffer configuration - by default, jb is disabled */
+static struct ast_jb_conf default_jbconf =
+{
+	.flags = 0,
+	.max_size = -1,
+	.resync_threshold = -1,
+	.impl = ""
+};
+static struct ast_jb_conf global_jbconf;
 
 static const char tdesc[] = "Session Initiation Protocol (SIP)";
 static const char config[] = "sip.conf";
@@ -850,6 +861,7 @@
 	struct ast_variable *chanvars;		/*!< Channel variables to set for inbound call */
 	struct sip_pvt *next;			/*!< Next dialog in chain */
 	struct sip_invite_param *options;	/*!< Options for INVITE */
+	struct ast_jb_conf jbconf;
 } *iflist = NULL;
 
 #define FLAG_RESPONSE (1 << 0)
@@ -1256,7 +1268,7 @@
 	.type = "SIP",
 	.description = "Session Initiation Protocol (SIP)",
 	.capabilities = ((AST_FORMAT_MAX_AUDIO << 1) - 1),
-	.properties = AST_CHAN_TP_WANTSJITTER,
+	.properties = AST_CHAN_TP_WANTSJITTER | AST_CHAN_TP_CREATESJITTER,
 	.requester = sip_request_call,
 	.devicestate = sip_devicestate,
 	.call = sip_call,
@@ -1456,11 +1468,16 @@
 	 * apply it to their address to see if we need to substitute our
 	 * externip or can get away with our internal bindaddr
 	 */
-	struct sockaddr_in theirs;
+	struct sockaddr_in theirs, ours;
+
+	/* Get our local information */
+	ast_ouraddrfor(them, us);
 	theirs.sin_addr = *them;
+	ours.sin_addr = *us;
 
 	if (localaddr && externip.sin_addr.s_addr &&
-	   ast_apply_ha(localaddr, &theirs)) {
+	    ast_apply_ha(localaddr, &theirs) &&
+	    !ast_apply_ha(localaddr, &ours)) {
 		if (externexpire && time(NULL) >= externexpire) {
 			struct ast_hostent ahp;
 			struct hostent *hp;
@@ -1480,8 +1497,6 @@
 		}
 	} else if (bindaddr.sin_addr.s_addr)
 		*us = bindaddr.sin_addr;
-	else
-		return ast_ouraddrfor(them, us);
 	return 0;
 }
 
@@ -3309,7 +3324,11 @@
 
 	if (recordhistory)
 		append_history(i, "NewChan", "Channel %s - from %s", tmp->name, i->callid);
-				
+
+	/* Configure the new channel jb */
+	if (tmp && i && i->rtp)
+		ast_jb_configure(tmp, &i->jbconf);
+
 	return tmp;
 }
 
@@ -3643,6 +3662,9 @@
 	    (ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_AUTO))
 		p->noncodeccapability |= AST_RTP_DTMF;
 	ast_string_field_set(p, context, default_context);
+
+	/* Assign default jb conf to the new sip_pvt */
+	memcpy(&p->jbconf, &global_jbconf, sizeof(struct ast_jb_conf));
 
 	/* Add to active dialog list */
 	ast_mutex_lock(&iflock);
@@ -13244,7 +13266,6 @@
 	for (; v; v = v->next) {
 		if (handle_common_options(&peerflags[0], &mask[0], v))
 			continue;
-
 		if (realtime && !strcasecmp(v->name, "regseconds")) {
 			ast_get_time_t(v->value, &regseconds, 0, NULL);
 		} else if (realtime && !strcasecmp(v->name, "ipaddr") && !ast_strlen_zero(v->value) ) {
@@ -13537,11 +13558,18 @@
 	global_relaxdtmf = FALSE;
 	global_callevents = FALSE;
 	global_t1min = DEFAULT_T1MIN;		
+
+	/* Copy the default jb config over global_jbconf */
+	memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
+
 	ast_clear_flag(&global_flags[1], SIP_PAGE2_VIDEOSUPPORT);
 
 	/* Read the [general] config section of sip.conf (or from realtime config) */
 	for (v = ast_variable_browse(cfg, "general"); v; v = v->next) {
 		if (handle_common_options(&global_flags[0], &dummy[0], v))
+			continue;
+		/* handle jb conf */
+		if (!ast_jb_read_conf(&global_jbconf, v->name, v->value))
 			continue;
 
 		/* Create the interface list */

Modified: team/oej/zfonepassthrough/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/channels/chan_skinny.c?rev=34846&r1=34845&r2=34846&view=diff
==============================================================================
--- team/oej/zfonepassthrough/channels/chan_skinny.c (original)
+++ team/oej/zfonepassthrough/channels/chan_skinny.c Mon Jun 19 10:52:56 2006
@@ -69,6 +69,7 @@
 #include "asterisk/utils.h"
 #include "asterisk/dsp.h"
 #include "asterisk/stringfields.h"
+#include "asterisk/abstract_jb.h"
 
 /*************************************
  * Skinny/Asterisk Protocol Settings *
@@ -116,6 +117,15 @@
 #define htoles(x) __bswap_16(x)
 #endif
 
+/*! Global jitterbuffer configuration - by default, jb is disabled */
+static struct ast_jb_conf default_jbconf =
+{
+	.flags = 0,
+	.max_size = -1,
+	.resync_threshold = -1,
+	.impl = ""
+};
+static struct ast_jb_conf global_jbconf;
 
 /*********************
  * Protocol Messages *
@@ -816,6 +826,8 @@
 	int nat;
 	int outgoing;
 	int alreadygone;
+	struct ast_jb_conf jbconf;
+
 	struct skinny_subchannel *next;
 };
 
@@ -909,7 +921,7 @@
 	.type = "Skinny",
 	.description = tdesc,
 	.capabilities = AST_FORMAT_ULAW,
-	.properties = AST_CHAN_TP_WANTSJITTER,
+	.properties = AST_CHAN_TP_WANTSJITTER | AST_CHAN_TP_CREATESJITTER,
 	.requester = skinny_request,
 	.call = skinny_call,
 	.hangup = skinny_hangup,
@@ -1603,6 +1615,10 @@
 							callnums++;
 							sub->cxmode = SKINNY_CX_INACTIVE;
 							sub->nat = nat;
+
+							/* Assign default jb conf to the new skinny_subchannel */
+							memcpy(&sub->jbconf, &global_jbconf, sizeof(struct ast_jb_conf));
+
 							sub->next = l->sub;
 							l->sub = sub;
 						} else {
@@ -2292,6 +2308,10 @@
 				tmp = NULL;
 			}
 		}
+
+		/* Configure the new channel jb */
+		if (tmp && sub && sub->rtp)
+			ast_jb_configure(tmp, &sub->jbconf);
 	} else {
 		ast_log(LOG_WARNING, "Unable to allocate channel structure\n");
 	}
@@ -3094,10 +3114,21 @@
 		ast_log(LOG_NOTICE, "Unable to load config %s, Skinny disabled\n", config);
 		return 0;
 	}
+	memset(&bindaddr, 0, sizeof(bindaddr));
+
+	/* Copy the default jb config over global_jbconf */
+	memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
+
 	/* load the general section */
-	memset(&bindaddr, 0, sizeof(bindaddr));
 	v = ast_variable_browse(cfg, "general");
 	while(v) {
+		/* handle jb conf */
+		if (!ast_jb_read_conf(&global_jbconf, v->name, v->value))
+		{
+			v = v->next;
+			continue;
+		}
+
 		/* Create the interface list */
 		if (!strcasecmp(v->name, "bindaddr")) {
 			if (!(hp = ast_gethostbyname(v->value, &ahp))) {

Modified: team/oej/zfonepassthrough/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/oej/zfonepassthrough/channels/chan_zap.c?rev=34846&r1=34845&r2=34846&view=diff
==============================================================================
--- team/oej/zfonepassthrough/channels/chan_zap.c (original)
+++ team/oej/zfonepassthrough/channels/chan_zap.c Mon Jun 19 10:52:56 2006
@@ -103,14 +103,25 @@
 #include "asterisk/utils.h"
 #include "asterisk/transcap.h"
 #include "asterisk/stringfields.h"
+#include "asterisk/abstract_jb.h"
 #ifdef WITH_SMDI
 #include "asterisk/smdi.h"
 #include "asterisk/astobj.h"
 #define SMDI_MD_WAIT_TIMEOUT 1500 /* 1.5 seconds */
 #endif
 
+/*! Global jitterbuffer configuration - by default, jb is disabled */
+static struct ast_jb_conf default_jbconf =
+{
+	.flags = 0,
+	.max_size = -1,
+	.resync_threshold = -1,
+	.impl = ""
+};
+static struct ast_jb_conf global_jbconf;
+
 #if !defined(ZT_SIG_EM_E1) || (defined(HAVE_LIBPRI) && !defined(ZT_SIG_HARDHDLC))
-#error "Your zaptel is too old.  please update"
+#error "Your zaptel is too old.  Please update"
 #endif
 
 #ifndef ZT_TONEDETECT
@@ -203,7 +214,7 @@
 
 static char language[MAX_LANGUAGE] = "";
 static char musicclass[MAX_MUSICCLASS] = "";
-static char progzone[10]= "";
+static char progzone[10] = "";
 
 static int usedistinctiveringdetection = 0;
 static int distinctiveringaftercid = 0;
@@ -311,7 +322,7 @@
 static int pritimers[PRI_MAX_TIMERS];
 #endif
 static int pridebugfd = -1;
-static char pridebugfilename[1024]="";
+static char pridebugfilename[1024] = "";
 #endif
 
 /*! \brief Wait up to 16 seconds for first digit (FXO logic) */
@@ -323,7 +334,7 @@
 /*! \brief How long to wait for an extra digit, if there is an ambiguous match */
 static int matchdigittimeout = 3000;
 
-static int usecnt =0;
+static int usecnt = 0;
 AST_MUTEX_DEFINE_STATIC(usecnt_lock);
 
 /*! \brief Protect the interface list (of zt_pvt's) */
@@ -353,7 +364,7 @@
 AST_MUTEX_DEFINE_STATIC(monlock);
 
 /*! \brief This is the thread for the monitor which checks for input on the channels
-   which are not currently in use.  */
+   which are not currently in use. */
 static pthread_t monitor_thread = AST_PTHREADT_NULL;
 
 static int restart_monitor(void);
@@ -366,21 +377,24 @@
 static inline int zt_get_event(int fd)
 {
 	int j;
-	if (ioctl(fd, ZT_GETEVENT, &j) == -1) return -1;
+	if (ioctl(fd, ZT_GETEVENT, &j) == -1)
+		return -1;
 	return j;
 }
 
 /*! \brief Avoid the silly zt_waitevent which ignores a bunch of events */
 static inline int zt_wait_event(int fd)
 {
-	int i,j=0;
+	int i, j = 0;
 	i = ZT_IOMUX_SIGEVENT;
-	if (ioctl(fd, ZT_IOMUX, &i) == -1) return -1;
-	if (ioctl(fd, ZT_GETEVENT, &j) == -1) return -1;
+	if (ioctl(fd, ZT_IOMUX, &i) == -1)
+		return -1;
+	if (ioctl(fd, ZT_GETEVENT, &j) == -1)
+		return -1;
 	return j;
 }
 
-/*! Chunk size to read -- we use 20ms chunks to make things happy.  */
+/*! Chunk size to read -- we use 20ms chunks to make things happy. */
 #define READ_SIZE 160
 
 #define MASK_AVAIL		(1 << 0)	/*!< Channel available for PRI use */
@@ -684,6 +698,7 @@
 #endif	
 	int polarity;
 	int dsp_features;
+	struct ast_jb_conf jbconf;
 
 } *iflist = NULL, *ifend = NULL;
 
@@ -742,7 +757,7 @@
 			usleep(1);
 			ast_mutex_lock(&pvt->lock);
 		}
-	} while(res);
+	} while (res);
 	/* Then break the poll */
 	pthread_kill(pri->master, SIGURG);
 	return 0;
@@ -895,7 +910,7 @@
 	int bs;
 	int x;
 	isnum = 1;
-	for (x=0;x<strlen(fn);x++) {
+	for (x = 0; x < strlen(fn); x++) {
 		if (!isdigit(fn[x])) {
 			isnum = 0;
 			break;
@@ -930,7 +945,7 @@
 
 static void zt_close(int fd)
 {
-	if(fd > 0)
+	if (fd > 0)
 		close(fd);
 }
 
@@ -963,7 +978,7 @@
 			} else 
 				ast_log(LOG_WARNING, "Unable to check buffer policy on channel %d\n", x);
 			if (ioctl(p->subs[x].zfd, ZT_CHANNO, &p->subs[x].chan) == 1) {
-				ast_log(LOG_WARNING,"Unable to get channel number for pseudo channel on FD %d\n",p->subs[x].zfd);
+				ast_log(LOG_WARNING, "Unable to get channel number for pseudo channel on FD %d\n", p->subs[x].zfd);
 				zt_close(p->subs[x].zfd);
 				p->subs[x].zfd = -1;
 				return -1;
@@ -1042,25 +1057,25 @@
 }
 
 static char *events[] = {
-		"No event",
-		"On hook",
-		"Ring/Answered",
-		"Wink/Flash",
-		"Alarm",
-		"No more alarm",
-		"HDLC Abort",
-		"HDLC Overrun",
-		"HDLC Bad FCS",
-		"Dial Complete",
-		"Ringer On",
-		"Ringer Off",
-		"Hook Transition Complete",
-		"Bits Changed",
-		"Pulse Start",
-		"Timer Expired",
-		"Timer Ping",
-		"Polarity Reversal",
-		"Ring Begin",
+	"No event",
+	"On hook",
+	"Ring/Answered",
+	"Wink/Flash",
+	"Alarm",
+	"No more alarm",
+	"HDLC Abort",
+	"HDLC Overrun",
+	"HDLC Bad FCS",
+	"Dial Complete",
+	"Ringer On",
+	"Ringer Off",
+	"Hook Transition Complete",
+	"Bits Changed",
+	"Pulse Start",
+	"Timer Expired",
+	"Timer Ping",
+	"Polarity Reversal",
+	"Ring Begin",
 };
 
 static struct {
@@ -1079,7 +1094,7 @@
 static char *alarm2str(int alarm)
 {
 	int x;
-	for (x=0;x<sizeof(alarms) / sizeof(alarms[0]); x++) {
+	for (x = 0; x < sizeof(alarms) / sizeof(alarms[0]); x++) {
 		if (alarms[x].alarm & alarm)
 			return alarms[x].name;
 	}
@@ -1101,14 +1116,14 @@
 	if (dialplan == -1) {
 		return("Dynamically set dialplan in ISDN");
 	}
-	return(pri_plan2str(dialplan));
+	return (pri_plan2str(dialplan));
 }
 #endif
 
 static char *zap_sig2str(int sig)
 {
 	static char buf[256];
-	switch(sig) {
+	switch (sig) {
 	case SIG_EM:
 		return "E & M Immediate";
 	case SIG_EMWINK:
@@ -1184,7 +1199,7 @@
 		if (!index) {
 			/* Real-side and pseudo-side both participate in conference */
 			zi.confmode = ZT_CONF_REALANDPSEUDO | ZT_CONF_TALKER | ZT_CONF_LISTENER |
-								ZT_CONF_PSEUDO_TALKER | ZT_CONF_PSEUDO_LISTENER;
+				ZT_CONF_PSEUDO_TALKER | ZT_CONF_PSEUDO_LISTENER;
 		} else
 			zi.confmode = ZT_CONF_CONF | ZT_CONF_TALKER | ZT_CONF_LISTENER;
 		zi.confno = p->confno;
@@ -1246,7 +1261,7 @@
 	/* Start out optimistic */
 	useslavenative = 1;
 	/* Update conference state in a stateless fashion */
-	for (x=0;x<3;x++) {
+	for (x = 0; x < 3; x++) {
 		/* Any three-way calling makes slave native mode *definitely* out
 		   of the question */
 		if ((p->subs[x].zfd > -1) && p->subs[x].inthreeway)
@@ -1255,7 +1270,7 @@
 	/* If we don't have any 3-way calls, check to see if we have
 	   precisely one slave */
 	if (useslavenative) {
-		for (x=0;x<MAX_SLAVES;x++) {
+		for (x = 0; x < MAX_SLAVES; x++) {
 			if (p->slaves[x]) {
 				if (slave) {
 					/* Whoops already have a slave!  No 
@@ -1304,7 +1319,7 @@
 
 	useslavenative = isslavenative(p, &slave);
 	/* Start with the obvious, general stuff */
-	for (x=0;x<3;x++) {
+	for (x = 0; x < 3; x++) {
 		/* Look for three way calls */
 		if ((p->subs[x].zfd > -1) && p->subs[x].inthreeway) {
 			conf_add(p, &p->subs[x], x, 0);
@@ -1315,7 +1330,7 @@
 	}
 	/* If we have a slave, add him to our conference now. or DAX
 	   if this is slave native */
-	for (x=0;x<MAX_SLAVES;x++) {
+	for (x = 0; x < MAX_SLAVES; x++) {
 		if (p->slaves[x]) {
 			if (useslavenative)
 				conf_add(p, &p->slaves[x]->subs[SUB_REAL], SUB_REAL, GET_CHANNEL(p));
@@ -1343,8 +1358,8 @@
 		}
 	}
 	if (!needconf) {
-		/* Nobody is left (or should be left) in our conference.  
-		   Kill it.  */
+		/* Nobody is left (or should be left) in our conference.
+		   Kill it. */
 		p->confno = -1;
 	}
 	ast_log(LOG_DEBUG, "Updated conferencing on %d, with %d conference users\n", p->channel, needconf);
@@ -1391,7 +1406,7 @@
 	if (p && p->echocancel && p->echotraining) {
 		x = p->echotraining;
 		res = ioctl(p->subs[SUB_REAL].zfd, ZT_ECHOTRAIN, &x);
-		if (res) 
+		if (res)
 			ast_log(LOG_WARNING, "Unable to request echo training on channel %d\n", p->channel);
 		else {
 			ast_log(LOG_DEBUG, "Engaged echo training on channel %d\n", p->channel);
@@ -1407,7 +1422,7 @@
 	if (p->echocancel) {
 		x = 0;
 		res = ioctl(p->subs[SUB_REAL].zfd, ZT_ECHOCANCEL, &x);
-		if (res) 
+		if (res)
 			ast_log(LOG_WARNING, "Unable to disable echo cancellation on channel %d\n", p->channel);
 		else
 			ast_log(LOG_DEBUG, "disabled echo cancellation on channel %d\n", p->channel);
@@ -1575,7 +1590,7 @@
 			ast_log(LOG_WARNING, "Unable to set audio mode on '%d'\n", p->channel);
 	}
 	res = ioctl(p->subs[SUB_REAL].zfd, ZT_CONFMUTE, &x);
-	if (res < 0) 
+	if (res < 0)
 		ast_log(LOG_WARNING, "zt confmute(%d) failed on channel %d: %s\n", muted, p->channel, strerror(errno));
 	return res;
 }
@@ -1657,7 +1672,7 @@
 		p->subs[SUB_REAL].linear = 0;
 		zt_setlinear(p->subs[SUB_REAL].zfd, 0);
 	}
-	while(p->cidpos < p->cidlen) {
+	while (p->cidpos < p->cidlen) {
 		res = write(p->subs[SUB_REAL].zfd, p->cidspill + p->cidpos, p->cidlen - p->cidpos);
 		if (res < 0) {
 			if (errno == EAGAIN)
@@ -1715,7 +1730,7 @@
 	int x, res, index,mysig;
 	char *c, *n, *l;
 #ifdef HAVE_LIBPRI
-	char *s=NULL;
+	char *s = NULL;
 #endif
 	char dest[256]; /* must be same length as p->dialdest */
 	ast_mutex_lock(&p->lock);
@@ -1748,9 +1763,10 @@
 	set_actual_gain(p->subs[SUB_REAL].zfd, 0, p->rxgain, p->txgain, p->law);
 
 	mysig = p->sig;
-	if (p->outsigmod) mysig = p->outsigmod;
-
-	switch(mysig) {
+	if (p->outsigmod)
+		mysig = p->outsigmod;
+
+	switch (mysig) {
 	case SIG_FXOLS:
 	case SIG_FXOGS:
 	case SIG_FXOKS:
@@ -1774,7 +1790,7 @@
 			}
 			/* Choose proper cadence */
 			if ((p->distinctivering > 0) && (p->distinctivering <= num_cadence)) {
-				if (ioctl(p->subs[SUB_REAL].zfd, ZT_SETCADENCE, &cadences[p->distinctivering-1]))
+				if (ioctl(p->subs[SUB_REAL].zfd, ZT_SETCADENCE, &cadences[p->distinctivering - 1]))
 					ast_log(LOG_WARNING, "Unable to set distinctive ring cadence %d on '%s'\n", p->distinctivering, ast->name);
 				p->cidrings = cidrings[p->distinctivering - 1];
 			} else {
@@ -1782,7 +1798,6 @@
 					ast_log(LOG_WARNING, "Unable to reset default ring on '%s'\n", ast->name);
 				p->cidrings = p->sendcalleridafter;
 			}
-
 
 			/* nick at dccinc.com 4/3/03 mods to allow for deferred dialing */

[... 1997 lines stripped ...]


More information about the svn-commits mailing list