[Asterisk-cvs] asterisk/channels chan_zap.c,1.275,1.276
markster at lists.digium.com
markster at lists.digium.com
Sun Jun 20 03:07:57 CDT 2004
Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv24887/channels
Modified Files:
chan_zap.c
Log Message:
Hold pending digits until setup_ack is received, then send (bug#1875)
Index: chan_zap.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v
retrieving revision 1.275
retrieving revision 1.276
diff -u -d -r1.275 -r1.276
--- chan_zap.c 18 Jun 2004 15:24:29 -0000 1.275
+++ chan_zap.c 20 Jun 2004 06:53:53 -0000 1.276
@@ -845,12 +845,19 @@
index = zt_get_index(ast, p, 0);
if (index == SUB_REAL) {
#ifdef ZAPATA_PRI
- if (p->sig == SIG_PRI && ast->_state == AST_STATE_DIALING && p->setup_ack && (p->proceeding < 2)) {
- if (!pri_grab(p, p->pri)) {
- pri_information(p->pri->pri,p->call,digit);
- pri_rel(p->pri);
- } else
- ast_log(LOG_WARNING, "Unable to grab PRI on span %d\n", p->span);
+ if (p->sig == SIG_PRI && ast->_state == AST_STATE_DIALING && (p->proceeding < 2)) {
+ if (p->setup_ack) {
+ if (!pri_grab(p, p->pri)) {
+ pri_information(p->pri->pri,p->call,digit);
+ pri_rel(p->pri);
+ } else
+ ast_log(LOG_WARNING, "Unable to grab PRI on span %d\n", p->span);
+ } else if (strlen(p->dialdest) < sizeof(p->dialdest) - 1) {
+ ast_log(LOG_DEBUG, "Queueing digit '%c' since setup_ack not yet received\n", digit);
+ res = strlen(p->dialdest);
+ p->dialdest[res++] = digit;
+ p->dialdest[res] = '\0';
+ }
} else {
#else
{
@@ -1658,7 +1665,8 @@
ast_setstate(ast, AST_STATE_UP);
break;
case SIG_PRI:
- /* We'll get it in a moment */
+ /* We'll get it in a moment -- but use dialdest to store pre-setup_ack digits */
+ strcpy(p->dialdest, "");
break;
default:
ast_log(LOG_DEBUG, "not yet implemented\n");
@@ -7469,6 +7477,12 @@
} else {
ast_mutex_lock(&pri->pvts[chanpos]->lock);
pri->pvts[chanpos]->setup_ack = 1;
+ /* Send any queued digits */
+ for (x=0;x<strlen(pri->pvts[chanpos]->dialdest);x++) {
+ ast_log(LOG_DEBUG, "Sending pending digit '%c'\n", pri->pvts[chanpos]->dialdest[x]);
+ pri_information(pri->pri, pri->pvts[chanpos]->call,
+ pri->pvts[chanpos]->dialdest[x]);
+ }
ast_mutex_unlock(&pri->pvts[chanpos]->lock);
}
break;
More information about the svn-commits
mailing list