Insure ring cadence is set for fxs ports

Moved SETCADENCE ioctl call to before call into new analog signal module
to insure that it gets set. 

(closes issue #15381)
Reported by: alecdavis
Patches:
      fix15381.diff uploaded by dbailey (license 819)
Tested by: dbailey



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@203126 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Doug Bailey 2009-06-25 16:18:48 +00:00
parent c6a986222e
commit ce70b28f38
1 changed files with 23 additions and 16 deletions

View File

@ -4154,7 +4154,29 @@ static int dahdi_call(struct ast_channel *ast, char *rdest, int timeout)
p->outgoing = 1;
set_actual_gain(p->subs[SUB_REAL].dfd, 0, p->rxgain, p->txgain, p->law);
/* Set the ring cadence */
mysig = p->sig;
if (p->outsigmod > -1)
mysig = p->outsigmod;
switch (mysig) {
case SIG_FXOLS:
case SIG_FXOGS:
case SIG_FXOKS:
if (p->owner == ast) {
/* Choose proper cadence */
if ((p->distinctivering > 0) && (p->distinctivering <= num_cadence)) {
if (ioctl(p->subs[SUB_REAL].dfd, DAHDI_SETCADENCE, &cadences[p->distinctivering - 1]))
ast_log(LOG_WARNING, "Unable to set distinctive ring cadence %d on '%s': %s\n", p->distinctivering, ast->name, strerror(errno));
p->cidrings = cidrings[p->distinctivering - 1];
} else {
if (ioctl(p->subs[SUB_REAL].dfd, DAHDI_SETCADENCE, NULL))
ast_log(LOG_WARNING, "Unable to reset default ring on '%s': %s\n", ast->name, strerror(errno));
p->cidrings = p->sendcalleridafter;
}
}
break;
}
/* If this is analog signalling we can exit here */
if (analog_lib_handles(p->sig, p->radio, p->oprmode)) {
p->callwaitrings = 0;
@ -4163,10 +4185,6 @@ static int dahdi_call(struct ast_channel *ast, char *rdest, int timeout)
return res;
}
mysig = p->sig;
if (p->outsigmod > -1)
mysig = p->outsigmod;
switch (mysig) {
case SIG_FXOLS:
case SIG_FXOGS:
@ -4189,17 +4207,6 @@ static int dahdi_call(struct ast_channel *ast, char *rdest, int timeout)
send_callerid(p);
}
}
/* Choose proper cadence */
if ((p->distinctivering > 0) && (p->distinctivering <= num_cadence)) {
if (ioctl(p->subs[SUB_REAL].dfd, DAHDI_SETCADENCE, &cadences[p->distinctivering - 1]))
ast_log(LOG_WARNING, "Unable to set distinctive ring cadence %d on '%s': %s\n", p->distinctivering, ast->name, strerror(errno));
p->cidrings = cidrings[p->distinctivering - 1];
} else {
if (ioctl(p->subs[SUB_REAL].dfd, DAHDI_SETCADENCE, NULL))
ast_log(LOG_WARNING, "Unable to reset default ring on '%s': %s\n", ast->name, strerror(errno));
p->cidrings = p->sendcalleridafter;
}
/* nick@dccinc.com 4/3/03 mods to allow for deferred dialing */
c = strchr(dest, '/');
if (c)