[svn-commits] rmudgett: branch rmudgett/dahdi_facility r224923 - in /team/rmudgett/dahdi_fa...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Oct 20 17:52:31 CDT 2009


Author: rmudgett
Date: Tue Oct 20 17:52:26 2009
New Revision: 224923

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=224923
Log:
Merged revisions 224491,224527,224562,224567,224637,224671,224738,224774,224856 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
  r224491 | file | 2009-10-19 09:32:08 -0500 (Mon, 19 Oct 2009) | 2 lines
  
  Add a callback to sig_pri which is called when sig_pri is going to queue a control frame on a channel.
................
  r224527 | tilghman | 2009-10-19 10:50:31 -0500 (Mon, 19 Oct 2009) | 2 lines
  
  Remove a completed project and add another
................
  r224562 | kpfleming | 2009-10-19 14:40:26 -0500 (Mon, 19 Oct 2009) | 1 line
  
  Remove useless debugging message.
................
  r224567 | file | 2009-10-19 14:49:09 -0500 (Mon, 19 Oct 2009) | 12 lines
  
  Merged revisions 224565 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r224565 | file | 2009-10-19 16:47:50 -0300 (Mon, 19 Oct 2009) | 5 lines
    
    Do not attempt early media bridging (ie: direct RTP setup) if options are enabled that should prevent it.
    
    (closes issue #14763)
    Reported by: cupotka
  ........
................
  r224637 | mnicholson | 2009-10-19 17:02:41 -0500 (Mon, 19 Oct 2009) | 4 lines
  
  Add dynamic range compression support for analog channels.
  
  (closes issue AST-29)
................
  r224671 | kpfleming | 2009-10-19 18:47:39 -0500 (Mon, 19 Oct 2009) | 14 lines
  
  Merged revisions 224670 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r224670 | kpfleming | 2009-10-19 18:44:07 -0500 (Mon, 19 Oct 2009) | 7 lines
    
    Correct timestamp calculations when RTP sample rates over 8kHz are used.
    
    While testing some endpoints that support 16kHz and 32kHz sample rates, some
    log messages were generated due to calc_rxstamp() computing timestamps in a way
    that produced odd results, so this patch sanitizes the result of the
    computations.
  ........
................
  r224738 | mnicholson | 2009-10-20 07:44:09 -0500 (Tue, 20 Oct 2009) | 2 lines
  
  Added information to CHANGES about the dynamic range compression feature added to dahdi.
................
  r224774 | file | 2009-10-20 12:47:34 -0500 (Tue, 20 Oct 2009) | 12 lines
  
  Merged revisions 224773 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r224773 | file | 2009-10-20 14:46:37 -0300 (Tue, 20 Oct 2009) | 5 lines
    
    Add support for relaying early media in the features attended transfer option.
    
    (closes issue #14828)
    Reported by: licedey
  ........
................
  r224856 | tilghman | 2009-10-20 17:09:07 -0500 (Tue, 20 Oct 2009) | 12 lines
  
  Merged revisions 224855 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r224855 | tilghman | 2009-10-20 17:07:11 -0500 (Tue, 20 Oct 2009) | 5 lines
    
    Pay attention to the return value of the manipulate function.
    While this looks like an optimization, it prevents a crash from occurring
    when used with certain audiohook callbacks (diagnosed with SVN trunk,
    backported to 1.4 to keep the source consistent across versions).
  ........
................

Modified:
    team/rmudgett/dahdi_facility/   (props changed)
    team/rmudgett/dahdi_facility/CHANGES
    team/rmudgett/dahdi_facility/apps/app_dial.c
    team/rmudgett/dahdi_facility/channels/chan_dahdi.c
    team/rmudgett/dahdi_facility/channels/sig_pri.c
    team/rmudgett/dahdi_facility/channels/sig_pri.h
    team/rmudgett/dahdi_facility/configs/chan_dahdi.conf.sample
    team/rmudgett/dahdi_facility/doc/janitor-projects.txt
    team/rmudgett/dahdi_facility/formats/format_siren14.c
    team/rmudgett/dahdi_facility/funcs/func_speex.c
    team/rmudgett/dahdi_facility/main/audiohook.c
    team/rmudgett/dahdi_facility/main/features.c
    team/rmudgett/dahdi_facility/res/res_rtp_asterisk.c

Propchange: team/rmudgett/dahdi_facility/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/rmudgett/dahdi_facility/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Oct 20 17:52:26 2009
@@ -1,1 +1,1 @@
-/trunk:1-224477
+/trunk:1-224922

Modified: team/rmudgett/dahdi_facility/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_facility/CHANGES?view=diff&rev=224923&r1=224922&r2=224923
==============================================================================
--- team/rmudgett/dahdi_facility/CHANGES (original)
+++ team/rmudgett/dahdi_facility/CHANGES Tue Oct 20 17:52:26 2009
@@ -227,6 +227,8 @@
    LibPRI).
  * Added the ability to ignore calls that are not in a Multiple Subscriber
    Number (MSN) list for PTMP CPE interfaces.
+ * Added dynamic range compression support for dahdi channels.  It is
+   configured via the rxdrc and txdrc parameters in chan_dahdi.conf.
 
 Asterisk Manager Interface
 --------------------------

Modified: team/rmudgett/dahdi_facility/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_facility/apps/app_dial.c?view=diff&rev=224923&r1=224922&r2=224923
==============================================================================
--- team/rmudgett/dahdi_facility/apps/app_dial.c (original)
+++ team/rmudgett/dahdi_facility/apps/app_dial.c Tue Oct 20 17:52:26 2009
@@ -567,7 +567,8 @@
 
 #define CAN_EARLY_BRIDGE(flags,chan,peer) (!ast_test_flag64(flags, OPT_CALLEE_HANGUP | \
 	OPT_CALLER_HANGUP | OPT_CALLEE_TRANSFER | OPT_CALLER_TRANSFER | \
-	OPT_CALLEE_MONITOR | OPT_CALLER_MONITOR | OPT_CALLEE_PARK | OPT_CALLER_PARK) && \
+	OPT_CALLEE_MONITOR | OPT_CALLER_MONITOR | OPT_CALLEE_PARK |  \
+	OPT_CALLER_PARK | OPT_ANNOUNCE | OPT_CALLEE_MACRO | OPT_CALLEE_GOSUB) && \
 	!chan->audiohooks && !peer->audiohooks)
 
 /*
@@ -789,7 +790,7 @@
 		handle_cause(cause, num);
 		ast_hangup(original);
 	} else {
-		if (single) {
+		if (single && CAN_EARLY_BRIDGE(peerflags, c, in)) {
 			ast_rtp_instance_early_bridge_make_compatible(c, in);
 		}
 
@@ -1675,7 +1676,8 @@
 		outbound_group = ast_strdupa(outbound_group);
 	}
 	ast_channel_unlock(chan);	
-	ast_copy_flags64(peerflags, &opts, OPT_DTMF_EXIT | OPT_GO_ON | OPT_ORIGINAL_CLID | OPT_CALLER_HANGUP | OPT_IGNORE_FORWARDING | OPT_IGNORE_CONNECTEDLINE | OPT_CANCEL_TIMEOUT);
+	ast_copy_flags64(peerflags, &opts, OPT_DTMF_EXIT | OPT_GO_ON | OPT_ORIGINAL_CLID | OPT_CALLER_HANGUP | OPT_IGNORE_FORWARDING | OPT_IGNORE_CONNECTEDLINE |
+			 OPT_CANCEL_TIMEOUT | OPT_ANNOUNCE | OPT_CALLEE_MACRO | OPT_CALLEE_GOSUB);
 
 	/* loop through the list of dial destinations */
 	rest = args.peers;
@@ -1798,7 +1800,7 @@
 			CHANNEL_DEADLOCK_AVOIDANCE(tc);
 		}
 		/* Setup outgoing SDP to match incoming one */
-		if (!outgoing && !rest) {
+		if (!outgoing && !rest && CAN_EARLY_BRIDGE(peerflags, chan, tc)) {
 			ast_rtp_instance_early_bridge_make_compatible(tc, chan);
 		}
 		

Modified: team/rmudgett/dahdi_facility/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_facility/channels/chan_dahdi.c?view=diff&rev=224923&r1=224922&r2=224923
==============================================================================
--- team/rmudgett/dahdi_facility/channels/chan_dahdi.c (original)
+++ team/rmudgett/dahdi_facility/channels/chan_dahdi.c Tue Oct 20 17:52:26 2009
@@ -50,6 +50,7 @@
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
+#include <values.h>
 #ifdef __NetBSD__
 #include <pthread.h>
 #include <signal.h>
@@ -722,6 +723,10 @@
 	float rxgain;
 	/*! \brief Tx gain set by chan_dahdi.conf */
 	float txgain;
+
+	float txdrc; /*!< Dynamic Range Compression factor. a number between 1 and 6ish */
+	float rxdrc;
+	
 	int tonezone;					/*!< tone zone for this chan, or -1 for default */
 	enum DAHDI_IFLIST which_iflist;	/*!< Which interface list is this structure listed? */
 	struct dahdi_pvt *next;				/*!< Next channel in list */
@@ -4158,17 +4163,43 @@
 	p->echocanon = 0;
 }
 
-static void fill_txgain(struct dahdi_gains *g, float gain, int law)
+/* perform a dynamic range compression transform on the given sample */
+static int drc_sample(int sample, float drc)
+{
+	float neg;
+	float shallow, steep;
+	float max = MAXSHORT;
+	
+	neg = (sample < 0 ? -1 : 1);
+	steep = drc*sample;
+	shallow = neg*(max-max/drc)+(float)sample/drc;
+	if (abs(steep) < abs(shallow)) {
+		sample = steep;
+	}
+	else {
+		sample = shallow;
+	}
+
+	return sample;
+}
+
+
+static void fill_txgain(struct dahdi_gains *g, float gain, float drc, int law)
 {
 	int j;
 	int k;
+
 	float linear_gain = pow(10.0, gain / 20.0);
 
 	switch (law) {
 	case DAHDI_LAW_ALAW:
 		for (j = 0; j < ARRAY_LEN(g->txgain); j++) {
-			if (gain) {
-				k = (int) (((float) AST_ALAW(j)) * linear_gain);
+			if (gain || drc) {
+				k = AST_ALAW(j);
+				if (drc) {
+					k = drc_sample(k, drc);
+				}
+				k = (float)k*linear_gain;
 				if (k > 32767) k = 32767;
 				if (k < -32767) k = -32767;
 				g->txgain[j] = AST_LIN2A(k);
@@ -4179,11 +4210,16 @@
 		break;
 	case DAHDI_LAW_MULAW:
 		for (j = 0; j < ARRAY_LEN(g->txgain); j++) {
-			if (gain) {
-				k = (int) (((float) AST_MULAW(j)) * linear_gain);
+			if (gain || drc) {
+				k = AST_MULAW(j);
+				if (drc) {
+					k = drc_sample(k, drc);
+				}
+				k = (float)k*linear_gain;
 				if (k > 32767) k = 32767;
 				if (k < -32767) k = -32767;
 				g->txgain[j] = AST_LIN2MU(k);
+
 			} else {
 				g->txgain[j] = j;
 			}
@@ -4192,7 +4228,7 @@
 	}
 }
 
-static void fill_rxgain(struct dahdi_gains *g, float gain, int law)
+static void fill_rxgain(struct dahdi_gains *g, float gain, float drc, int law)
 {
 	int j;
 	int k;
@@ -4201,8 +4237,12 @@
 	switch (law) {
 	case DAHDI_LAW_ALAW:
 		for (j = 0; j < ARRAY_LEN(g->rxgain); j++) {
-			if (gain) {
-				k = (int) (((float) AST_ALAW(j)) * linear_gain);
+			if (gain || drc) {
+				k = AST_ALAW(j);
+				if (drc) {
+					k = drc_sample(k, drc);
+				}
+				k = (float)k*linear_gain;
 				if (k > 32767) k = 32767;
 				if (k < -32767) k = -32767;
 				g->rxgain[j] = AST_LIN2A(k);
@@ -4213,8 +4253,12 @@
 		break;
 	case DAHDI_LAW_MULAW:
 		for (j = 0; j < ARRAY_LEN(g->rxgain); j++) {
-			if (gain) {
-				k = (int) (((float) AST_MULAW(j)) * linear_gain);
+			if (gain || drc) {
+				k = AST_MULAW(j);
+				if (drc) {
+					k = drc_sample(k, drc);
+				}
+				k = (float)k*linear_gain;
 				if (k > 32767) k = 32767;
 				if (k < -32767) k = -32767;
 				g->rxgain[j] = AST_LIN2MU(k);
@@ -4226,7 +4270,7 @@
 	}
 }
 
-static int set_actual_txgain(int fd, int chan, float gain, int law)
+static int set_actual_txgain(int fd, int chan, float gain, float drc, int law)
 {
 	struct dahdi_gains g;
 	int res;
@@ -4239,12 +4283,12 @@
 		return res;
 	}
 
-	fill_txgain(&g, gain, law);
+	fill_txgain(&g, gain, drc, law);
 
 	return ioctl(fd, DAHDI_SETGAINS, &g);
 }
 
-static int set_actual_rxgain(int fd, int chan, float gain, int law)
+static int set_actual_rxgain(int fd, int chan, float gain, float drc, int law)
 {
 	struct dahdi_gains g;
 	int res;
@@ -4257,14 +4301,14 @@
 		return res;
 	}
 
-	fill_rxgain(&g, gain, law);
+	fill_rxgain(&g, gain, drc, law);
 
 	return ioctl(fd, DAHDI_SETGAINS, &g);
 }
 
-static int set_actual_gain(int fd, int chan, float rxgain, float txgain, int law)
-{
-	return set_actual_txgain(fd, chan, txgain, law) | set_actual_rxgain(fd, chan, rxgain, law);
+static int set_actual_gain(int fd, int chan, float rxgain, float txgain, float rxdrc, float txdrc, int law)
+{
+	return set_actual_txgain(fd, chan, txgain, txdrc, law) | set_actual_rxgain(fd, chan, rxgain, rxdrc, law);
 }
 
 static int bump_gains(struct dahdi_pvt *p)
@@ -4272,7 +4316,7 @@
 	int res;
 
 	/* Bump receive gain by value stored in cid_rxgain */
-	res = set_actual_gain(p->subs[SUB_REAL].dfd, 0, p->rxgain + p->cid_rxgain, p->txgain, p->law);
+	res = set_actual_gain(p->subs[SUB_REAL].dfd, 0, p->rxgain + p->cid_rxgain, p->txgain, p->rxdrc, p->txdrc, p->law);
 	if (res) {
 		ast_log(LOG_WARNING, "Unable to bump gain: %s\n", strerror(errno));
 		return -1;
@@ -4285,7 +4329,7 @@
 {
 	int res;
 
-	res = set_actual_gain(p->subs[SUB_REAL].dfd, 0, p->rxgain, p->txgain, p->law);
+	res = set_actual_gain(p->subs[SUB_REAL].dfd, 0, p->rxgain, p->txgain, p->rxdrc, p->txdrc, p->law);
 	if (res) {
 		ast_log(LOG_WARNING, "Unable to restore gains: %s\n", strerror(errno));
 		return -1;
@@ -4535,7 +4579,7 @@
 		ast_log(LOG_WARNING, "Unable to flush input on channel %d: %s\n", p->channel, strerror(errno));
 	p->outgoing = 1;
 
-	set_actual_gain(p->subs[SUB_REAL].dfd, 0, p->rxgain, p->txgain, p->law);
+	set_actual_gain(p->subs[SUB_REAL].dfd, 0, p->rxgain, p->txgain, p->rxdrc, p->txdrc, p->law);
 
 #ifdef HAVE_PRI
 	if (dahdi_sig_pri_lib_handles(p->sig)) {
@@ -5869,7 +5913,7 @@
 			return -1;
 		}
 		ast_debug(1, "Setting actual tx gain on %s to %f\n", chan->name, p->txgain + (float) *scp);
-		return set_actual_txgain(p->subs[idx].dfd, 0, p->txgain + (float) *scp, p->law);
+		return set_actual_txgain(p->subs[idx].dfd, 0, p->txgain + (float) *scp, p->txdrc, p->law);
 	case AST_OPTION_RXGAIN:
 		scp = (signed char *) data;
 		idx = dahdi_get_index(chan, p, 0);
@@ -5878,7 +5922,7 @@
 			return -1;
 		}
 		ast_debug(1, "Setting actual rx gain on %s to %f\n", chan->name, p->rxgain + (float) *scp);
-		return set_actual_rxgain(p->subs[idx].dfd, 0, p->rxgain + (float) *scp, p->law);
+		return set_actual_rxgain(p->subs[idx].dfd, 0, p->rxgain + (float) *scp, p->rxdrc, p->law);
 	case AST_OPTION_TONE_VERIFY:
 		if (!p->dsp)
 			break;
@@ -11527,9 +11571,11 @@
 		tmp->cid_rxgain = conf->chan.cid_rxgain;
 		tmp->rxgain = conf->chan.rxgain;
 		tmp->txgain = conf->chan.txgain;
+		tmp->txdrc = conf->chan.txdrc;
+		tmp->rxdrc = conf->chan.rxdrc;
 		tmp->tonezone = conf->chan.tonezone;
 		if (tmp->subs[SUB_REAL].dfd > -1) {
-			set_actual_gain(tmp->subs[SUB_REAL].dfd, 0, tmp->rxgain, tmp->txgain, tmp->law);
+			set_actual_gain(tmp->subs[SUB_REAL].dfd, 0, tmp->rxgain, tmp->txgain, tmp->rxdrc, tmp->txdrc, tmp->law);
 			if (tmp->dsp)
 				ast_dsp_set_digitmode(tmp->dsp, DSP_DIGITMODE_DTMF | tmp->dtmfrelax);
 			update_conf(tmp);
@@ -14289,6 +14335,8 @@
 			ast_cli(a->fd, "Default law: %s\n", tmp->law == DAHDI_LAW_MULAW ? "ulaw" : tmp->law == DAHDI_LAW_ALAW ? "alaw" : "unknown");
 			ast_cli(a->fd, "Fax Handled: %s\n", tmp->faxhandled ? "yes" : "no");
 			ast_cli(a->fd, "Pulse phone: %s\n", tmp->pulsedial ? "yes" : "no");
+			ast_cli(a->fd, "Gains (RX/TX): %.2f/%.2f\n", tmp->rxgain, tmp->txgain);
+			ast_cli(a->fd, "Dynamic Range Compression (RX/TX): %.2f/%.2f\n", tmp->rxdrc, tmp->txdrc);
 			ast_cli(a->fd, "DND: %s\n", dahdi_dnd(tmp, -1) ? "yes" : "no");
 			ast_cli(a->fd, "Echo Cancellation:\n");
 
@@ -14654,9 +14702,9 @@
 			break;
 
 		if (tx)
-			res = set_actual_txgain(tmp->subs[SUB_REAL].dfd, channel, gain, tmp->law);
+			res = set_actual_txgain(tmp->subs[SUB_REAL].dfd, channel, gain, tmp->txdrc, tmp->law);
 		else
-			res = set_actual_rxgain(tmp->subs[SUB_REAL].dfd, channel, gain, tmp->law);
+			res = set_actual_rxgain(tmp->subs[SUB_REAL].dfd, channel, gain, tmp->rxdrc, tmp->law);
 
 		if (res) {
 			ast_cli(a->fd, "Unable to set the software gain for channel %d\n", channel);
@@ -15855,6 +15903,14 @@
 		} else if (!strcasecmp(v->name, "txgain")) {
 			if (sscanf(v->value, "%30f", &confp->chan.txgain) != 1) {
 				ast_log(LOG_WARNING, "Invalid txgain: %s at line %d.\n", v->value, v->lineno);
+			}
+		} else if (!strcasecmp(v->name, "txdrc")) {
+			if (sscanf(v->value, "%f", &confp->chan.txdrc) != 1) {
+				ast_log(LOG_WARNING, "Invalid txdrc: %s\n", v->value);
+			}
+		} else if (!strcasecmp(v->name, "rxdrc")) {
+			if (sscanf(v->value, "%f", &confp->chan.rxdrc) != 1) {
+				ast_log(LOG_WARNING, "Invalid rxdrc: %s\n", v->value);
 			}
 		} else if (!strcasecmp(v->name, "tonezone")) {
 			if (sscanf(v->value, "%30d", &confp->chan.tonezone) != 1) {

Modified: team/rmudgett/dahdi_facility/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_facility/channels/sig_pri.c?view=diff&rev=224923&r1=224922&r2=224923
==============================================================================
--- team/rmudgett/dahdi_facility/channels/sig_pri.c (original)
+++ team/rmudgett/dahdi_facility/channels/sig_pri.c Tue Oct 20 17:52:26 2009
@@ -657,6 +657,10 @@
 static void pri_queue_control(struct sig_pri_chan *p, int subclass, struct sig_pri_pri *pri)
 {
 	struct ast_frame f = {AST_FRAME_CONTROL, };
+
+	if (p->calls->queue_control) {
+		p->calls->queue_control(p->chan_pvt, subclass);
+	}
 
 	f.subclass = subclass;
 	pri_queue_frame(p, &f, pri);

Modified: team/rmudgett/dahdi_facility/channels/sig_pri.h
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_facility/channels/sig_pri.h?view=diff&rev=224923&r1=224922&r2=224923
==============================================================================
--- team/rmudgett/dahdi_facility/channels/sig_pri.h (original)
+++ team/rmudgett/dahdi_facility/channels/sig_pri.h Tue Oct 20 17:52:26 2009
@@ -78,6 +78,7 @@
 	void (* const set_callerid)(void *pvt, const struct ast_party_caller *caller);
 	void (* const set_dnid)(void *pvt, const char *dnid);
 	void (* const set_rdnis)(void *pvt, const char *rdnis);
+	void (* const queue_control)(void *pvt, int subclass);
 	int (* const new_nobch_intf)(struct sig_pri_pri *pri);
 };
 

Modified: team/rmudgett/dahdi_facility/configs/chan_dahdi.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_facility/configs/chan_dahdi.conf.sample?view=diff&rev=224923&r1=224922&r2=224923
==============================================================================
--- team/rmudgett/dahdi_facility/configs/chan_dahdi.conf.sample (original)
+++ team/rmudgett/dahdi_facility/configs/chan_dahdi.conf.sample Tue Oct 20 17:52:26 2009
@@ -583,15 +583,27 @@
 ;                increases the volume level on a channel, and a
 ;                negavive value decreases volume level.
 ;
+; Dynamic Range Compression: you can also enable dynamic range compression
+;                on a channel. This will amplify quiet sounds while leaving
+;                louder sounds untouched. This is useful in situations where
+;                a linear gain setting would cause clipping. Acceptable values
+;                are in the range of 0.0 to around 6.0 with higher values
+;                causing more compression to be done.
+;
 ;                There are several independent gain settings:
 ;   rxgain: gain for the rx (receive - into Asterisk) channel. Default: 0.0
 ;   txgain: gain for the tx (transmit - out of Asterisk Asterisk) channel.
 ;           Default: 0.0
 ;   cid_rxgain: set the gain just for the caller ID sounds Asterisk
 ;               emits. Default: 5.0 .
+;   rxdrc: dynamic range compression for the rx channel. Default: 0.0
+;   txdrc: dynamic range compression for the tx channel. Default: 0.0
 
 ;rxgain=2.0
 ;txgain=3.0
+;
+;rxdrc=1.0
+;txdrc=4.0
 ;
 ; Logical groups can be assigned to allow outgoing roll-over.  Groups range
 ; from 0 to 63, and multiple groups can be specified. By default the

Modified: team/rmudgett/dahdi_facility/doc/janitor-projects.txt
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_facility/doc/janitor-projects.txt?view=diff&rev=224923&r1=224922&r2=224923
==============================================================================
--- team/rmudgett/dahdi_facility/doc/janitor-projects.txt (original)
+++ team/rmudgett/dahdi_facility/doc/janitor-projects.txt Tue Oct 20 17:52:26 2009
@@ -1,18 +1,6 @@
  -- Audit uses of usleep() to ensure that the argument is never greater than 1 million.
     On some systems, that is considered an error.  In any such cases, convert the usage
 	over to use nanosleep(), instead.
-
- -- There a bunch of places where the result of pbx_builtin_getvar_helper()
-    gets stored and used.  This is not threadsafe.  This code should be replaced
-	with the following thread-safe version:
-
-	const char *var;
-
-	ast_channel_lock(chan);
-	if ((var = pbx_builtin_getvar_helper(chan, "MYVAR"))) {
-		var = ast_strdupa(var);
-	}
-	ast_channel_unlock(chan);
 
  -- Convert all existing uses of astobj.h to astobj2.h
     -- (chan_sip already in progress in a branch)
@@ -35,4 +23,6 @@
 
  -- Convert all usage of the signal(2) system API to the more portable sigaction(2) system API.
 
- -- Make the applications in utils/ selectable in menuselect and turn off muted by default. Propably others too.
+ -- Make the applications in utils/ selectable in menuselect and turn off muted by default. Probably others too.
+
+ -- Find options and arguments in Asterisk which specify a time period in seconds or milliseconds and convert them to use the new ast_app_parse_timelen() function.

Modified: team/rmudgett/dahdi_facility/formats/format_siren14.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_facility/formats/format_siren14.c?view=diff&rev=224923&r1=224922&r2=224923
==============================================================================
--- team/rmudgett/dahdi_facility/formats/format_siren14.c (original)
+++ team/rmudgett/dahdi_facility/formats/format_siren14.c Tue Oct 20 17:52:26 2009
@@ -50,7 +50,6 @@
 		return NULL;
 	}
 	*whennext = s->fr.samples = BYTES_TO_SAMPLES(res);
-	ast_log(LOG_DEBUG, "Read frame of %d bytes and %d samples\n", res, s->fr.samples);
 	return &s->fr;
 }
 

Modified: team/rmudgett/dahdi_facility/funcs/func_speex.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_facility/funcs/func_speex.c?view=diff&rev=224923&r1=224922&r2=224923
==============================================================================
--- team/rmudgett/dahdi_facility/funcs/func_speex.c (original)
+++ team/rmudgett/dahdi_facility/funcs/func_speex.c Tue Oct 20 17:52:26 2009
@@ -142,25 +142,24 @@
 	struct ast_datastore *datastore = NULL;
 	struct speex_direction_info *sdi = NULL;
 	struct speex_info *si = NULL;
+	char source[80];
 
 	/* If the audiohook is stopping it means the channel is shutting down.... but we let the datastore destroy take care of it */
 	if (audiohook->status == AST_AUDIOHOOK_STATUS_DONE || frame->frametype != AST_FRAME_VOICE) {
-		return 0;
-	}
-	
-	ast_channel_lock(chan);
+		return -1;
+	}
+
+	/* We are called with chan already locked */
 	if (!(datastore = ast_channel_datastore_find(chan, &speex_datastore, NULL))) {
-		ast_channel_unlock(chan);
-		return 0;
-	}
-	ast_channel_unlock(chan);
+		return -1;
+	}
 
 	si = datastore->data;
 
 	sdi = (direction == AST_AUDIOHOOK_DIRECTION_READ) ? si->rx : si->tx;
 
 	if (!sdi) {
-		return 0;
+		return -1;
 	}
 
 	if (sdi->samples != frame->samples) {
@@ -171,7 +170,7 @@
 		if (!(sdi->state = speex_preprocess_state_init((sdi->samples = frame->samples), 8000))) {
 			return -1;
 		}
-		
+
 		speex_preprocess_ctl(sdi->state, SPEEX_PREPROCESS_SET_AGC, &sdi->agc);
 
 		if (sdi->agc) {
@@ -182,6 +181,12 @@
 	}
 
 	speex_preprocess(sdi->state, frame->data.ptr, NULL);
+	snprintf(source, sizeof(source), "%s/speex", frame->src);
+	if (frame->mallocd & AST_MALLOCD_SRC) {
+		ast_free((char *) frame->src);
+	}
+	frame->src = ast_strdup(source);
+	frame->mallocd |= AST_MALLOCD_SRC;
 
 	return 0;
 }

Modified: team/rmudgett/dahdi_facility/main/audiohook.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_facility/main/audiohook.c?view=diff&rev=224923&r1=224922&r2=224923
==============================================================================
--- team/rmudgett/dahdi_facility/main/audiohook.c (original)
+++ team/rmudgett/dahdi_facility/main/audiohook.c Tue Oct 20 17:52:26 2009
@@ -574,7 +574,7 @@
 	struct ast_frame *start_frame = frame, *middle_frame = frame, *end_frame = frame;
 	struct ast_audiohook *audiohook = NULL;
 	int samples = frame->samples;
-	
+
 	/* If the frame coming in is not signed linear we have to send it through the in_translate path */
 	if (frame->subclass != AST_FORMAT_SLINEAR) {
 		if (in_translate->format != frame->subclass) {
@@ -645,11 +645,16 @@
 				continue;
 			}
 			/* Feed in frame to manipulation */
-			audiohook->manipulate_callback(audiohook, chan, middle_frame, direction);
+			if (audiohook->manipulate_callback(audiohook, chan, middle_frame, direction)) {
+				ast_frfree(middle_frame);
+				middle_frame = NULL;
+			}
 			ast_audiohook_unlock(audiohook);
 		}
 		AST_LIST_TRAVERSE_SAFE_END;
-		end_frame = middle_frame;
+		if (middle_frame) {
+			end_frame = middle_frame;
+		}
 	}
 
 	/* Now we figure out what to do with our end frame (whether to transcode or not) */
@@ -677,7 +682,9 @@
 		}
 	} else {
 		/* No frame was modified, we can just drop our middle frame and pass the frame we got in out */
-		ast_frfree(middle_frame);
+		if (middle_frame) {
+			ast_frfree(middle_frame);
+		}
 	}
 
 	return end_frame;

Modified: team/rmudgett/dahdi_facility/main/features.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_facility/main/features.c?view=diff&rev=224923&r1=224922&r2=224923
==============================================================================
--- team/rmudgett/dahdi_facility/main/features.c (original)
+++ team/rmudgett/dahdi_facility/main/features.c Tue Oct 20 17:52:26 2009
@@ -2505,10 +2505,12 @@
 					if (ast_channel_connected_line_macro(chan, caller, f, 1, 1)) {
 						ast_indicate_data(caller, AST_CONTROL_CONNECTED_LINE, f->data.ptr, f->datalen);
 					}
-				} else if (f->subclass != -1) {
+				} else if (f->subclass != -1 && f->subclass != AST_CONTROL_PROGRESS) {
 					ast_log(LOG_NOTICE, "Don't know what to do about control frame: %d\n", f->subclass);
 				}
 				/* else who cares */
+			} else if (f->frametype == AST_FRAME_VOICE || f->frametype == AST_FRAME_VIDEO) {
+				ast_write(caller, f);
 			}
 
 		} else if (caller && (active_channel == caller)) {
@@ -2542,6 +2544,8 @@
 						f = NULL;
 						break;
 					}
+				} else if (f->frametype == AST_FRAME_VOICE || f->frametype == AST_FRAME_VIDEO) {
+					ast_write(chan, f);
 				}
 			}
 		}

Modified: team/rmudgett/dahdi_facility/res/res_rtp_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/dahdi_facility/res/res_rtp_asterisk.c?view=diff&rev=224923&r1=224922&r2=224923
==============================================================================
--- team/rmudgett/dahdi_facility/res/res_rtp_asterisk.c (original)
+++ team/rmudgett/dahdi_facility/res/res_rtp_asterisk.c Tue Oct 20 17:52:26 2009
@@ -1212,6 +1212,18 @@
 	return 0;
 }
 
+static void sanitize_tv(struct timeval *tv)
+{
+	while (tv->tv_usec < 0) {
+		tv->tv_usec += 1000000;
+		tv->tv_sec -= 1;
+	}
+	while (tv->tv_usec >= 1000000) {
+		tv->tv_usec -= 1000000;
+		tv->tv_sec += 1;
+	}
+}
+
 static void calc_rxstamp(struct timeval *tv, struct ast_rtp *rtp, unsigned int timestamp, int mark)
 {
 	struct timeval now;
@@ -1232,21 +1244,14 @@
 		rtp->rxcore.tv_usec -= (timestamp % rate) * 125;
 		/* Round to 0.1ms for nice, pretty timestamps */
 		rtp->rxcore.tv_usec -= rtp->rxcore.tv_usec % 100;
-		if (rtp->rxcore.tv_usec < 0) {
-			/* Adjust appropriately if necessary */
-			rtp->rxcore.tv_usec += 1000000;
-			rtp->rxcore.tv_sec -= 1;
-		}
+		sanitize_tv(&rtp->rxcore);
 	}
 
 	gettimeofday(&now,NULL);
 	/* rxcore is the mapping between the RTP timestamp and _our_ real time from gettimeofday() */
 	tv->tv_sec = rtp->rxcore.tv_sec + timestamp / rate;
 	tv->tv_usec = rtp->rxcore.tv_usec + (timestamp % rate) * 125;
-	if (tv->tv_usec >= 1000000) {
-		tv->tv_usec -= 1000000;
-		tv->tv_sec += 1;
-	}
+	sanitize_tv(tv);
 	prog = (double)((timestamp-rtp->seedrxts)/(float)(rate));
 	dtv = (double)rtp->drxcore + (double)(prog);
 	current_time = (double)now.tv_sec + (double)now.tv_usec/1000000;




More information about the svn-commits mailing list