[svn-commits] jdixon: branch jdixon/chan_usbradio-1.4 r134347 - /team/jdixon/chan_usbradio-...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Wed Jul 30 06:27:58 CDT 2008
Author: jdixon
Date: Wed Jul 30 06:27:58 2008
New Revision: 134347
URL: http://svn.digium.com/view/asterisk?view=rev&rev=134347
Log:
Allow dtmf decoder to be turned on and off
Modified:
team/jdixon/chan_usbradio-1.4/channels/chan_usbradio.c
Modified: team/jdixon/chan_usbradio-1.4/channels/chan_usbradio.c
URL: http://svn.digium.com/view/asterisk/team/jdixon/chan_usbradio-1.4/channels/chan_usbradio.c?view=diff&rev=134347&r1=134346&r2=134347
==============================================================================
--- team/jdixon/chan_usbradio-1.4/channels/chan_usbradio.c (original)
+++ team/jdixon/chan_usbradio-1.4/channels/chan_usbradio.c Wed Jul 30 06:27:58 2008
@@ -432,6 +432,7 @@
int autoanswer;
int autohangup;
int hookstate;
+ int usedtmf;
unsigned int queuesize; /* max fragments in queue */
unsigned int frags; /* parameter for SETFRAGMENT */
@@ -635,6 +636,7 @@
.wanteeprom = 1,
.area = 0,
.rptnum = 0,
+ .usedtmf = 1,
};
/* DECLARE FUNCTION PROTOTYPES */
@@ -668,6 +670,7 @@
static int usbradio_write(struct ast_channel *chan, struct ast_frame *f);
static int usbradio_indicate(struct ast_channel *chan, int cond, const void *data, size_t datalen);
static int usbradio_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
+static int usbradio_setoption(struct ast_channel *chan, int option, void *data, int datalen);
static int xpmr_config(struct chan_usbradio_pvt *o);
#if DEBUG_FILETEST == 1
@@ -691,6 +694,7 @@
.write = usbradio_write,
.indicate = usbradio_indicate,
.fixup = usbradio_fixup,
+ .setoption = usbradio_setoption,
};
/* Call with: devnum: alsa major device number, param: ascii Formal
@@ -2076,7 +2080,7 @@
}
f->offset = AST_FRIENDLY_OFFSET;
- if (o->dsp)
+ if (o->usedtmf && o->dsp)
{
f1 = ast_dsp_process(c,o->dsp,f);
if ((f1->frametype == AST_FRAME_DTMF_END) ||
@@ -2158,6 +2162,44 @@
if (res > -1)
ring(o, res);
+ return 0;
+}
+
+static int usbradio_setoption(struct ast_channel *chan, int option, void *data, int datalen)
+{
+ char *cp;
+ struct chan_usbradio_pvt *o = chan->tech_pvt;
+
+ /* all supported options require data */
+ if (!data || (datalen < 1)) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ switch (option) {
+ case AST_OPTION_TONE_VERIFY:
+ cp = (char *) data;
+ switch (*cp) {
+ case 1:
+ ast_log(LOG_NOTICE, "Set option TONE VERIFY, mode: OFF(0) on %s\n",chan->name);
+ o->usedtmf = 1;
+ break;
+ case 2:
+ ast_log(LOG_NOTICE, "Set option TONE VERIFY, mode: MUTECONF/MAX(2) on %s\n",chan->name);
+ o->usedtmf = 1;
+ break;
+ case 3:
+ ast_log(LOG_NOTICE, "Set option TONE VERIFY, mode: DISABLE DETECT(3) on %s\n",chan->name);
+ o->usedtmf = 0;
+ break;
+ default:
+ ast_log(LOG_NOTICE, "Set option TONE VERIFY, mode: OFF(0) on %s\n",chan->name);
+ o->usedtmf = 1;
+ break;
+ }
+ break;
+ }
+ errno = 0;
return 0;
}
@@ -3564,8 +3606,13 @@
o->dsp = ast_dsp_new();
if (o->dsp)
{
- ast_dsp_set_features(o->dsp,DSP_FEATURE_DTMF_DETECT);
- ast_dsp_digitmode(o->dsp,DSP_DIGITMODE_DTMF | DSP_DIGITMODE_MUTECONF | DSP_DIGITMODE_RELAXDTMF);
+#ifdef NEW_ASTERISK
+ ast_dsp_set_features(o->dsp,DSP_FEATURE_DIGIT_DETECT);
+ ast_dsp_set_digitmode(o->dsp,DSP_DIGITMODE_DTMF | DSP_DIGITMODE_MUTECONF | DSP_DIGITMODE_RELAXDTMF);
+#else
+ ast_dsp_set_features(o->dsp,DSP_FEATURE_DTMF_DETECT);
+ ast_dsp_digitmode(o->dsp,DSP_DIGITMODE_DTMF | DSP_DIGITMODE_MUTECONF | DSP_DIGITMODE_RELAXDTMF);
+#endif
}
if(o->pmrChan==NULL)
More information about the svn-commits
mailing list