[svn-commits] jpeeler: trunk r208155 - /trunk/channels/chan_dahdi.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Wed Jul 22 17:42:37 CDT 2009
Author: jpeeler
Date: Wed Jul 22 17:42:33 2009
New Revision: 208155
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=208155
Log:
Reset the fax buffers back to default settings regardless of signaling in use -
Pointed out by Matt F.
Also in the case of not using a signaling module, set the law back to the
default as well.
Modified:
trunk/channels/chan_dahdi.c
Modified: trunk/channels/chan_dahdi.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=208155&r1=208154&r2=208155
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Wed Jul 22 17:42:33 2009
@@ -4854,10 +4854,33 @@
}
#endif
+static int revert_fax_buffers(struct dahdi_pvt *p, struct ast_channel *ast)
+{
+ if (p->bufferoverrideinuse) {
+ /* faxbuffers are in use, revert them */
+ struct dahdi_bufferinfo bi = {
+ .txbufpolicy = p->buf_policy,
+ .rxbufpolicy = p->buf_policy,
+ .bufsize = p->bufsize,
+ .numbufs = p->buf_no
+ };
+ int bpres;
+
+ if ((bpres = ioctl(p->subs[SUB_REAL].dfd, DAHDI_SET_BUFINFO, &bi)) < 0) {
+ ast_log(LOG_WARNING, "Channel '%s' unable to revert buffer policy: %s\n", ast->name, strerror(errno));
+ }
+ p->bufferoverrideinuse = 0;
+ return bpres;
+ }
+
+ return -1;
+}
+
static int dahdi_hangup(struct ast_channel *ast)
{
int res = 0;
int idx,x;
+ int law;
/*static int restore_gains(struct dahdi_pvt *p);*/
struct dahdi_pvt *p = ast->tech_pvt;
struct dahdi_pvt *tmp = NULL;
@@ -4877,23 +4900,8 @@
restore_gains(p);
p->ignoredtmf = 0;
- if (p->bufferoverrideinuse) {
- /* faxbuffers are in use, revert them */
- struct dahdi_bufferinfo bi = {
- .txbufpolicy = p->buf_policy,
- .rxbufpolicy = p->buf_policy,
- .bufsize = p->bufsize,
- .numbufs = p->buf_no
- };
- int bpres;
-
- if ((bpres = ioctl(p->subs[SUB_REAL].dfd, DAHDI_SET_BUFINFO, &bi)) < 0) {
- ast_log(LOG_WARNING, "Channel '%s' unable to revert buffer policy: %s\n", ast->name, strerror(errno));
- }
- p->bufferoverrideinuse = 0;
- }
-
res = analog_hangup(p->sig_pvt, ast);
+ revert_fax_buffers(p, ast);
goto hangup_out;
}
@@ -4913,6 +4921,7 @@
ast_dsp_free(p->dsp);
p->dsp = NULL;
}
+ revert_fax_buffers(p, ast);
dahdi_setlinear(p->subs[SUB_REAL].dfd, 0);
law = DAHDI_LAW_DEFAULT;
res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_SETLAW, &law);
@@ -5076,22 +5085,10 @@
p->dsp = NULL;
}
- if (p->bufferoverrideinuse) {
- /* faxbuffers are in use, revert them */
- struct dahdi_bufferinfo bi = {
- .txbufpolicy = p->buf_policy,
- .rxbufpolicy = p->buf_policy,
- .bufsize = p->bufsize,
- .numbufs = p->buf_no
- };
- int bpres;
-
- if ((bpres = ioctl(p->subs[SUB_REAL].dfd, DAHDI_SET_BUFINFO, &bi)) < 0) {
- ast_log(LOG_WARNING, "Channel '%s' unable to revert buffer policy: %s\n", ast->name, strerror(errno));
- }
- p->bufferoverrideinuse = 0;
- }
-
+ revert_fax_buffers(p, ast);
+
+ law = DAHDI_LAW_DEFAULT;
+ res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_SETLAW, &law);
if (res < 0)
ast_log(LOG_WARNING, "Unable to set law on channel %d to default: %s\n", p->channel, strerror(errno));
/* Perform low level hangup if no owner left */
More information about the svn-commits
mailing list