aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authormattf <mattf@f38db490-d61c-443f-a65b-d21fe96a405b>2005-07-22 18:07:53 +0000
committermattf <mattf@f38db490-d61c-443f-a65b-d21fe96a405b>2005-07-22 18:07:53 +0000
commit60890de31772b1ae8344a8f8592e82db7d7f5bf7 (patch)
tree8aa3d4899910e1110267d57a6b29e208ae23f57e /channels
parent99c911fbba5e7c3edc23084b8ebfae5a4f95d607 (diff)
Fixed little oops with DTMF tone duration
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6182 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rwxr-xr-xchannels/chan_zap.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index b10b2741c..e040fc3c4 100755
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -167,7 +167,6 @@ static const char config[] = "zapata.conf";
#define DCHAN_AVAILABLE (DCHAN_PROVISIONED | DCHAN_NOTINALARM | DCHAN_UP)
static int cur_emdigitwait = 250; /* Wait time in ms for digits on EM channel */
-static int cur_toneduration = -1; /* Tone duration */
static char context[AST_MAX_CONTEXT] = "default";
static char cid_num[256] = "";
@@ -6550,7 +6549,6 @@ static struct zt_pvt *mkintf(int channel, int signalling, int radio, struct zt_p
struct zt_bufferinfo bi;
#endif
struct zt_spaninfo si;
- struct zt_dialparams dps;
int res;
int span=0;
int here = 0;
@@ -6823,15 +6821,6 @@ static struct zt_pvt *mkintf(int channel, int signalling, int radio, struct zt_p
p.debouncetime = cur_debounce;
}
- if (cur_toneduration > -1) {
- dps.dtmf_tonelen = dps.mfv1_tonelen = cur_toneduration;
- res = ioctl(tmp->subs[SUB_REAL].zfd, ZT_SET_DIALPARAMS, &dps);
- if (res < 0) {
- ast_log(LOG_ERROR, "Invalid tone duration: %d ms\n", cur_toneduration);
- destroy_zt_pvt(&tmp);
- return NULL;
- }
- }
/* dont set parms on a pseudo-channel (or CRV) */
if (tmp->subs[SUB_REAL].zfd >= 0)
{
@@ -10522,7 +10511,28 @@ static int setup_zap(int reload)
} else if (!strcasecmp(v->name, "emdigitwait")) {
cur_emdigitwait = atoi(v->value);
} else if (!strcasecmp(v->name, "toneduration")) {
- cur_toneduration = atoi(v->value);
+ int toneduration;
+ int ctlfd;
+ int res;
+ struct zt_dialparams dps;
+
+ ctlfd = open("/dev/zap/ctl", O_RDWR);
+ if (ctlfd == -1) {
+ ast_log(LOG_ERROR, "Unable to open /dev/zap/ctl to set toneduration\n");
+ return -1;
+ }
+
+ toneduration = atoi(v->value);
+ if (toneduration > -1) {
+ dps.dtmf_tonelen = dps.mfv1_tonelen = toneduration;
+ res = ioctl(ctlfd, ZT_SET_DIALPARAMS, &dps);
+ if (res < 0) {
+ ast_log(LOG_ERROR, "Invalid tone duration: %d ms\n", toneduration);
+ destroy_zt_pvt(&tmp);
+ return NULL;
+ }
+ }
+ close(ctlfd);
} else if (!strcasecmp(v->name, "polarityonanswerdelay")) {
polarityonanswerdelay = atoi(v->value);
} else if (!strcasecmp(v->name, "answeronpolarityswitch")) {