[asterisk-commits] rmudgett: branch group/issue14068 r191482 - in /team/group/issue14068: ./ cha...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri May 1 12:03:58 CDT 2009
Author: rmudgett
Date: Fri May 1 12:03:45 2009
New Revision: 191482
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=191482
Log:
Merged revisions 191411 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r191411 | kpfleming | 2009-04-30 16:42:35 -0500 (Thu, 30 Apr 2009) | 8 lines
Add buffer and echo canceller control to CHANNEL() dialplan function for DAHDI channels
Adds ability for CHANNEL() dialplan function, when used on DAHDI channels,
to temporarily change the number of buffers and/or the buffer policy, and also
to enable, disable, or switch the echo canceller between FAX/data and voice
modes.
........
Modified:
team/group/issue14068/ (props changed)
team/group/issue14068/CHANGES
team/group/issue14068/channels/chan_dahdi.c
team/group/issue14068/configure (contents, props changed)
team/group/issue14068/configure.ac
team/group/issue14068/include/asterisk/autoconfig.h.in
Propchange: team/group/issue14068/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri May 1 12:03:45 2009
@@ -1,1 +1,1 @@
-/trunk:1-191383
+/trunk:1-191416
Modified: team/group/issue14068/CHANGES
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue14068/CHANGES?view=diff&rev=191482&r1=191481&r2=191482
==============================================================================
--- team/group/issue14068/CHANGES (original)
+++ team/group/issue14068/CHANGES Fri May 1 12:03:45 2009
@@ -11,8 +11,6 @@
--- Functionality changes from Asterisk 1.6.2 to Asterisk 1.6.3 -------------
------------------------------------------------------------------------------
-
-
SIP Changes
-----------
* Added preferred_codec_only option in sip.conf. This feature limits the joint
@@ -25,6 +23,10 @@
tlscertfile is searched for both public and private key.
* Added tlsclientmethod option to sip.conf. This allows the protocol for
outbound client connections to be specified.
+ * The sendrpid parameter has been expanded to include the options
+ 'rpid' and 'pai'. Setting sendrpid to 'rpid' will cause Remote-Party-ID
+ header to be sent (equivalent to setting sendrpid=yes) and setting
+ sendrpid to 'pai' will cause P-Asserted-Identity header to be sent.
Applications
------------
@@ -43,6 +45,30 @@
* Added new dialplan functions CONNECTEDLINE and REDIRECTING which permits
setting various connected line and redirecting party information.
* The CHANNEL() function now supports the "name" option.
+ * For DAHDI channels, the CHANNEL() dialplan function now
+ supports changing the channel's buffer policy (for the current
+ call only), using this syntax:
+
+ exten => s,n,Set(CHANNEL(buffers)=6,full)
+
+ This would change the channel to the 'full' buffer policy and
+ 6 (six) buffers. Possible options for this setting are the same
+ as those in chan_dahdi.conf.
+ * For DAHDI channels, the CHANNEL() dialplan function now allows
+ the dialplan to request changes in the configuration of the active
+ echo canceller on the channel (if any), for the current call only.
+ The syntax is:
+
+ exten => s,n,Set(CHANNEL(echocan_mode)=off)
+
+ The possible values are:
+
+ on - normal mode (the echo canceller is actually reinitalized)
+ off - disabled
+ fax - FAX/data mode (NLP disabled if possible, otherwise completely
+ disabled)
+ voice - voice mode (returns from FAX mode, reverting the changes that
+ were made when FAX mode was requested)
Queue changes
-------------
@@ -105,13 +131,6 @@
* The channel variable PRIREDIRECTREASON is now just a status variable.
Use the REDIRECTING(reason) dialplan function to alter the reason.
-SIP channel driver (chan_sip) changes
--------------------------------------------
- * The sendrpid parameter has been expanded to include the options
- 'rpid' and 'pai'. Setting sendrpid to 'rpid' will cause Remote-Party-ID
- header to be sent (equivalent to setting sendrpid=yes) and setting
- sendrpid to 'pai' will cause P-Asserted-Identity header to be sent.
-
Asterisk Manager Interface
--------------------------
* The Hangup action now accepts a Cause header which may be used to
@@ -125,6 +144,7 @@
across all .conf files. All affected sample.conf files have been modified to
reflect this change. Previous options such as 'sslenable' still work,
but options with the 'tls' prefix are preferred.
+
------------------------------------------------------------------------------
--- Functionality changes from Asterisk 1.6.1 to Asterisk 1.6.2 -------------
------------------------------------------------------------------------------
Modified: team/group/issue14068/channels/chan_dahdi.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue14068/channels/chan_dahdi.c?view=diff&rev=191482&r1=191481&r2=191482
==============================================================================
--- team/group/issue14068/channels/chan_dahdi.c (original)
+++ team/group/issue14068/channels/chan_dahdi.c Fri May 1 12:03:45 2009
@@ -782,10 +782,10 @@
unsigned int echocanon:1;
/*! \brief TRUE if a fax tone has already been handled. */
unsigned int faxhandled:1;
- /*! \brief TRUE if dynamic faxbuffers are configured for use, default is OFF */
+ /*! TRUE if dynamic faxbuffers are configured for use, default is OFF */
unsigned int usefaxbuffers:1;
- /*! \brief TRUE while dynamic faxbuffers are in use */
- unsigned int faxbuffersinuse:1;
+ /*! TRUE while buffer configuration override is in use */
+ unsigned int bufferoverrideinuse:1;
/*! \brief TRUE if over a radio and dahdi_read() has been called. */
unsigned int firstradio:1;
/*!
@@ -1381,8 +1381,6 @@
.buf_policy = DAHDI_POLICY_IMMEDIATE,
.buf_no = numbufs,
.usefaxbuffers = 0,
- .faxbuf_policy = DAHDI_POLICY_IMMEDIATE,
- .faxbuf_no = numbufs,
},
.timing = {
.prewinktime = -1,
@@ -1417,6 +1415,7 @@
static int dahdi_setoption(struct ast_channel *chan, int option, void *data, int datalen);
static int dahdi_func_read(struct ast_channel *chan, const char *function, char *data, char *buf, size_t len);
static int handle_init_event(struct dahdi_pvt *i, int event);
+static int dahdi_func_write(struct ast_channel *chan, const char *function, char *data, const char *value);
static const struct ast_channel_tech dahdi_tech = {
.type = "DAHDI",
@@ -1437,6 +1436,7 @@
.fixup = dahdi_fixup,
.setoption = dahdi_setoption,
.func_channel_read = dahdi_func_read,
+ .func_channel_write = dahdi_func_write,
};
#ifdef HAVE_PRI
@@ -4164,8 +4164,7 @@
/* Free associated memory */
if (pl)
destroy_dahdi_pvt(&pl);
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_2 "Unregistered channel %d\n", x);
+ ast_verb(3, "Unregistered channel %d\n", x);
}
iflist = NULL;
ifcount = 0;
@@ -4697,7 +4696,7 @@
p->dsp = NULL;
}
- if (p->faxbuffersinuse) {
+ if (p->bufferoverrideinuse) {
/* faxbuffers are in use, revert them */
struct dahdi_bufferinfo bi = {
.txbufpolicy = p->buf_policy,
@@ -4710,7 +4709,7 @@
if ((bpres = ioctl(p->subs[SUB_REAL].dfd, DAHDI_SET_BUFINFO, &bi)) < 0) {
ast_log(LOG_WARNING, "Channel '%s' unable to revert faxbuffer policy: %s\n", ast->name, strerror(errno));
}
- p->faxbuffersinuse = 0;
+ p->bufferoverrideinuse = 0;
}
law = DAHDI_LAW_DEFAULT;
@@ -5233,7 +5232,8 @@
static int dahdi_func_read(struct ast_channel *chan, const char *function, char *data, char *buf, size_t len)
{
struct dahdi_pvt *p = chan->tech_pvt;
-
+ int res = 0;
+
if (!strcasecmp(data, "rxgain")) {
ast_mutex_lock(&p->lock);
snprintf(buf, len, "%f", p->rxgain);
@@ -5244,10 +5244,108 @@
ast_mutex_unlock(&p->lock);
} else {
ast_copy_string(buf, "", len);
- }
+ res = -1;
+ }
+
+ return res;
+}
+
+
+static int parse_buffers_policy(const char *parse, int *num_buffers, int *policy)
+{
+ int res;
+ char policy_str[21] = "";
+
+ if ((res = sscanf(parse, "%d,%20s", num_buffers, policy_str)) != 2) {
+ ast_log(LOG_WARNING, "Parsing buffer string '%s' failed.\n", parse);
+ return 1;
+ }
+ if (*num_buffers < 0) {
+ ast_log(LOG_WARNING, "Invalid buffer count given '%d'.\n", *num_buffers);
+ return -1;
+ }
+ if (!strcasecmp(policy_str, "full")) {
+ *policy = DAHDI_POLICY_WHEN_FULL;
+ } else if (!strcasecmp(policy_str, "immediate")) {
+ *policy = DAHDI_POLICY_IMMEDIATE;
+#if defined(HAVE_DAHDI_HALF_FULL)
+ } else if (!strcasecmp(policy_str, "half")) {
+ *policy = DAHDI_POLICY_HALF_FULL;
+#endif
+ } else {
+ ast_log(LOG_WARNING, "Invalid policy name given '%s'.\n", policy_str);
+ return -1;
+ }
+
return 0;
}
+static int dahdi_func_write(struct ast_channel *chan, const char *function, char *data, const char *value)
+{
+ struct dahdi_pvt *p = chan->tech_pvt;
+ int res = 0;
+
+ if (!strcasecmp(data, "buffers")) {
+ int num_bufs, policy;
+
+ if (!(parse_buffers_policy(value, &num_bufs, &policy))) {
+ struct dahdi_bufferinfo bi = {
+ .txbufpolicy = policy,
+ .rxbufpolicy = policy,
+ .bufsize = p->bufsize,
+ .numbufs = num_bufs,
+ };
+ int bpres;
+
+ if ((bpres = ioctl(p->subs[SUB_REAL].dfd, DAHDI_SET_BUFINFO, &bi)) < 0) {
+ ast_log(LOG_WARNING, "Channel '%d' unable to override buffer policy: %s\n", p->channel, strerror(errno));
+ } else {
+ p->bufferoverrideinuse = 1;
+ }
+ } else {
+ res = -1;
+ }
+ } else if (!strcasecmp(data, "echocan_mode")) {
+ if (!strcasecmp(value, "on")) {
+ ast_mutex_lock(&p->lock);
+ dahdi_enable_ec(p);
+ ast_mutex_unlock(&p->lock);
+ } else if (!strcasecmp(value, "off")) {
+ ast_mutex_lock(&p->lock);
+ dahdi_disable_ec(p);
+ ast_mutex_unlock(&p->lock);
+ } else if (!strcasecmp(value, "fax")) {
+ int blah = 1;
+
+ ast_mutex_lock(&p->lock);
+ if (!p->echocanon) {
+ dahdi_enable_ec(p);
+ }
+ if (ioctl(p->subs[SUB_REAL].dfd, DAHDI_ECHOCANCEL_FAX_MODE, &blah)) {
+ ast_log(LOG_WARNING, "Unable to place echocan into fax mode on channel %d: %s\n", p->channel, strerror(errno));
+ }
+ ast_mutex_unlock(&p->lock);
+ } else if (!strcasecmp(value, "voice")) {
+ int blah = 0;
+
+ ast_mutex_lock(&p->lock);
+ if (!p->echocanon) {
+ dahdi_enable_ec(p);
+ }
+ if (ioctl(p->subs[SUB_REAL].dfd, DAHDI_ECHOCANCEL_FAX_MODE, &blah)) {
+ ast_log(LOG_WARNING, "Unable to place echocan into voice mode on channel %d: %s\n", p->channel, strerror(errno));
+ }
+ ast_mutex_unlock(&p->lock);
+ } else {
+ ast_log(LOG_WARNING, "Unsupported value '%s' provided for '%s' item.\n", value, data);
+ res = -1;
+ }
+ } else {
+ res = -1;
+ }
+
+ return res;
+}
static void dahdi_unlink(struct dahdi_pvt *slave, struct dahdi_pvt *master, int needlock)
{
@@ -5843,7 +5941,7 @@
/* Fax tone -- Handle and return NULL */
if ((p->callprogress & CALLPROGRESS_FAX) && !p->faxhandled) {
/* If faxbuffers are configured, use them for the fax transmission */
- if (p->usefaxbuffers && !p->faxbuffersinuse) {
+ if (p->usefaxbuffers && !p->bufferoverrideinuse) {
struct dahdi_bufferinfo bi = {
.txbufpolicy = p->faxbuf_policy,
.bufsize = p->bufsize,
@@ -5854,7 +5952,7 @@
if ((res = ioctl(p->subs[idx].dfd, DAHDI_SET_BUFINFO, &bi)) < 0) {
ast_log(LOG_WARNING, "Channel '%s' unable to set faxbuffer policy, reason: %s\n", ast->name, strerror(errno));
} else {
- p->faxbuffersinuse = 1;
+ p->bufferoverrideinuse = 1;
}
}
p->faxhandled = 1;
@@ -5966,9 +6064,23 @@
switch (res) {
case DAHDI_EVENT_EC_DISABLED:
- ast_verb(3, "Channel %d echo canceler disabled due to CED detection\n", p->channel);
+ ast_verb(3, "Channel %d echo canceler disabled.\n", p->channel);
p->echocanon = 0;
break;
+#ifdef HAVE_DAHDI_ECHOCANCEL_FAX_MODE
+ case DAHDI_EVENT_TX_CED_DETECTED:
+ ast_verb(3, "Channel %d detected a CED tone towards the network.\n", p->channel);
+ break;
+ case DAHDI_EVENT_RX_CED_DETECTED:
+ ast_verb(3, "Channel %d detected a CED tone from the network.\n", p->channel);
+ break;
+ case DAHDI_EVENT_EC_NLP_DISABLED:
+ ast_verb(3, "Channel %d echo canceler disabled its NLP.\n", p->channel);
+ break;
+ case DAHDI_EVENT_EC_NLP_ENABLED:
+ ast_verb(3, "Channel %d echo canceler enabled its NLP.\n", p->channel);
+ break;
+#endif
case DAHDI_EVENT_BITSCHANGED:
#ifdef HAVE_OPENR2
if (p->sig != SIG_MFCR2) {
@@ -16721,48 +16833,14 @@
return -1;
ast_log(LOG_DEBUG, "Channel '%s' configured.\n", v->value);
} else if (!strcasecmp(v->name, "buffers")) {
- int res;
- char policy[21] = "";
-
- res = sscanf(v->value, "%d,%20s", &confp->chan.buf_no, policy);
- if (res != 2) {
- ast_log(LOG_WARNING, "Parsing buffers option data failed, using defaults.\n");
+ if (parse_buffers_policy(v->value, &confp->chan.buf_no, &confp->chan.buf_policy)) {
+ ast_log(LOG_WARNING, "Using default buffer policy.\n");
confp->chan.buf_no = numbufs;
- continue;
- }
- if (confp->chan.buf_no < 0)
- confp->chan.buf_no = numbufs;
- if (!strcasecmp(policy, "full")) {
- confp->chan.buf_policy = DAHDI_POLICY_WHEN_FULL;
- } else if (!strcasecmp(policy, "immediate")) {
confp->chan.buf_policy = DAHDI_POLICY_IMMEDIATE;
-#ifdef HAVE_DAHDI_HALF_FULL
- } else if (!strcasecmp(policy, "half_full")) {
- confp->chan.buf_policy = DAHDI_POLICY_HALF_FULL;
-#endif
- } else {
- ast_log(LOG_WARNING, "Invalid policy name given (%s).\n", policy);
}
} else if (!strcasecmp(v->name, "faxbuffers")) {
- int res;
- char policy[21] = "";
-
- res = sscanf(v->value, "%d,%20s", &confp->chan.faxbuf_no, policy);
- if (res != 2) {
- ast_log(LOG_WARNING, "Parsing faxbuffers option data failed, using defaults.\n");
- confp->chan.faxbuf_no = numbufs;
- continue;
- }
- confp->chan.usefaxbuffers = 1;
- if (confp->chan.faxbuf_no < 0)
- confp->chan.faxbuf_no = numbufs;
- if (!strcasecmp(policy, "full")) {
- confp->chan.faxbuf_policy = DAHDI_POLICY_WHEN_FULL;
- } else if (!strcasecmp(policy, "immediate")) {
- confp->chan.faxbuf_policy = DAHDI_POLICY_IMMEDIATE;
- } else {
- ast_log(LOG_WARNING, "Invalid policy name given (%s).\n", policy);
- confp->chan.usefaxbuffers = 0;
+ if (!parse_buffers_policy(v->value, &confp->chan.faxbuf_no, &confp->chan.faxbuf_policy)) {
+ confp->chan.usefaxbuffers = 1;
}
} else if (!strcasecmp(v->name, "dahdichan")) {
ast_copy_string(dahdichan, v->value, sizeof(dahdichan));
Propchange: team/group/issue14068/configure
('svn:eol-style' removed)
Propchange: team/group/issue14068/configure
('svn:keywords' removed)
Propchange: team/group/issue14068/configure
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Fri May 1 12:03:45 2009
@@ -1,1 +1,1 @@
-text/plain
+application/octet-stream
Modified: team/group/issue14068/configure.ac
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue14068/configure.ac?view=diff&rev=191482&r1=191481&r2=191482
==============================================================================
--- team/group/issue14068/configure.ac (original)
+++ team/group/issue14068/configure.ac Fri May 1 12:03:45 2009
@@ -653,6 +653,8 @@
AST_C_DEFINE_CHECK([DAHDI_HALF_FULL], [DAHDI_POLICY_HALF_FULL], [dahdi/user.h])
AST_C_COMPILE_CHECK([DAHDI_LINEREVERSE_VMWI], [struct dahdi_vmwi_info booger], [dahdi/user.h], , [enhanced dahdi vmwi support])
+
+AST_C_COMPILE_CHECK([DAHDI_ECHOCANCEL_FAX_MODE], [int foo = DAHDI_ECHOCANCEL_FAX_MODE], [dahdi/user.h])
# BSD might not have exp2, and/or log2
AST_EXT_LIB_CHECK([EXP2L], [m], [exp2l])
Modified: team/group/issue14068/include/asterisk/autoconfig.h.in
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue14068/include/asterisk/autoconfig.h.in?view=diff&rev=191482&r1=191481&r2=191482
==============================================================================
--- team/group/issue14068/include/asterisk/autoconfig.h.in (original)
+++ team/group/issue14068/include/asterisk/autoconfig.h.in Fri May 1 12:03:45 2009
@@ -192,6 +192,12 @@
/* Define if your system has the DAHDI headers. */
#undef HAVE_DAHDI
+/* Define if your system has the DAHDI_ECHOCANCEL_FAX_MODE headers. */
+#undef HAVE_DAHDI_ECHOCANCEL_FAX_MODE
+
+/* Define DAHDI_ECHOCANCEL_FAX_MODE headers version */
+#undef HAVE_DAHDI_ECHOCANCEL_FAX_MODE_VERSION
+
/* Define if your system has the DAHDI_HALF_FULL headers. */
#undef HAVE_DAHDI_HALF_FULL
@@ -1202,9 +1208,6 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION
-/* Define to 1 if the C compiler supports function prototypes. */
-#undef PROTOTYPES
-
/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
#undef PTHREAD_CREATE_JOINABLE
@@ -1220,11 +1223,6 @@
/* Define to the type of arg 5 for `select'. */
#undef SELECT_TYPE_ARG5
-
-/* Define to 1 if the `setvbuf' function takes the buffering type as its
- second argument and the buffer pointer as the third, as on System V before
- release 3. */
-#undef SETVBUF_REVERSED
/* The size of `int', as computed by sizeof. */
#undef SIZEOF_INT
@@ -1246,20 +1244,30 @@
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
#undef TM_IN_SYS_TIME
-/* Define to 1 if on AIX 3.
- System headers sometimes define this.
- We just want to avoid a redefinition error message. */
+/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
-
-/* Number of bits in a file offset, on hosts where this is settable. */
-#undef _FILE_OFFSET_BITS
-
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
+/* Enable threading extensions on Solaris. */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# undef _POSIX_PTHREAD_SEMANTICS
+#endif
+/* Enable extensions on HP NonStop. */
+#ifndef _TANDEM_SOURCE
+# undef _TANDEM_SOURCE
+#endif
+/* Enable general extensions on Solaris. */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
#undef _LARGEFILE_SOURCE
@@ -1276,20 +1284,6 @@
/* Define to 1 if you need to in order for `stat' and other things to work. */
#undef _POSIX_SOURCE
-
-/* Enable extensions on Solaris. */
-#ifndef __EXTENSIONS__
-# undef __EXTENSIONS__
-#endif
-#ifndef _POSIX_PTHREAD_SEMANTICS
-# undef _POSIX_PTHREAD_SEMANTICS
-#endif
-#ifndef _TANDEM_SOURCE
-# undef _TANDEM_SOURCE
-#endif
-
-/* Define like PROTOTYPES; this can be used by system headers. */
-#undef __PROTOTYPES
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
More information about the asterisk-commits
mailing list