[Asterisk-cvs] asterisk/channels chan_h323.c,1.57,1.58 chan_sip.c,1.409,1.410 chan_skinny.c,1.45,1.46 chan_zap.c,1.265,1.266
markster at lists.digium.com
markster at lists.digium.com
Mon Jun 14 16:14:19 CDT 2004
Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv4974/channels
Modified Files:
chan_h323.c chan_sip.c chan_skinny.c chan_zap.c
Log Message:
Separate PROCEEDING and PROGRESS
Index: chan_h323.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_h323.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- chan_h323.c 12 Jun 2004 03:44:51 -0000 1.57
+++ chan_h323.c 14 Jun 2004 21:18:52 -0000 1.58
@@ -653,6 +653,7 @@
break;
}
return -1;
+ case AST_CONTROL_PROCEEDING:
case -1:
return -1;
default:
Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.409
retrieving revision 1.410
diff -u -d -r1.409 -r1.410
--- chan_sip.c 13 Jun 2004 21:25:10 -0000 1.409
+++ chan_sip.c 14 Jun 2004 21:18:52 -0000 1.410
@@ -1724,6 +1724,7 @@
}
return -1;
case AST_CONTROL_PROGRESS:
+ case AST_CONTROL_PROCEEDING:
if ((ast->_state != AST_STATE_UP) && !p->progress && !p->outgoing) {
transmit_response_with_sdp(p, "183 Session Progress", &p->initreq, 0);
p->progress = 1;
Index: chan_skinny.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_skinny.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- chan_skinny.c 9 Jun 2004 01:45:08 -0000 1.45
+++ chan_skinny.c 14 Jun 2004 21:18:52 -0000 1.46
@@ -1736,6 +1736,8 @@
case -1:
transmit_tone(s, SKINNY_SILENCE);
break;
+ case AST_CONTROL_PROCEEDING:
+ break;
default:
ast_log(LOG_WARNING, "Don't know how to indicate condition %d\n", ind);
return -1;
Index: chan_zap.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v
retrieving revision 1.265
retrieving revision 1.266
diff -u -d -r1.265 -r1.266
--- chan_zap.c 13 Jun 2004 21:25:10 -0000 1.265
+++ chan_zap.c 14 Jun 2004 21:18:52 -0000 1.266
@@ -670,6 +670,24 @@
}
}
+static void zap_queue_frame(struct zt_pvt *p, struct ast_frame *f)
+{
+ for (;;) {
+ if (p->owner) {
+ if (ast_mutex_trylock(&p->owner->lock)) {
+ ast_mutex_unlock(&p->lock);
+ usleep(1);
+ ast_mutex_lock(&p->lock);
+ } else {
+ ast_queue_frame(p->owner, f);
+ ast_mutex_unlock(&p->owner->lock);
+ break;
+ }
+ } else
+ break;
+ }
+}
+
static void swap_subs(struct zt_pvt *p, int a, int b)
{
int tchan;
@@ -827,7 +845,7 @@
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) {
+ 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);
@@ -2201,7 +2219,7 @@
case SIG_PRI:
/* Send a pri acknowledge */
if (!pri_grab(p, p->pri)) {
- p->proceeding = 1;
+ p->proceeding = 2;
res = pri_answer(p->pri->pri, p->call, 0, 1);
pri_rel(p->pri);
} else {
@@ -3845,7 +3863,7 @@
}
} else if (f->frametype == AST_FRAME_DTMF) {
#ifdef ZAPATA_PRI
- if (!p->proceeding && p->sig==SIG_PRI && p->pri && p->pri->overlapdial) {
+ if ((p->proceeding < 2) && p->sig==SIG_PRI && p->pri && p->pri->overlapdial) {
/* Don't accept in-band DTMF when in overlap dial mode */
f->frametype = AST_FRAME_NULL;
f->subclass = 0;
@@ -4048,7 +4066,7 @@
break;
case AST_CONTROL_RINGING:
#ifdef ZAPATA_PRI
- if (!p->proceeding && p->sig==SIG_PRI && p->pri && !p->outgoing) {
+ if ((p->proceeding < 2) && p->sig==SIG_PRI && p->pri && !p->outgoing) {
if (p->pri->pri) {
if (!pri_grab(p, p->pri)) {
pri_acknowledge(p->pri->pri,p->call, PVT_TO_CHANNEL(p), 1);
@@ -4057,7 +4075,7 @@
else
ast_log(LOG_WARNING, "Unable to grab PRI on span %d\n", p->span);
}
- p->proceeding=1;
+ p->proceeding=2;
}
#endif
res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_RINGTONE);
@@ -4069,6 +4087,24 @@
ast_setstate(chan, AST_STATE_RINGING);
}
break;
+ case AST_CONTROL_PROCEEDING:
+ ast_log(LOG_DEBUG,"Received AST_CONTROL_PROCEEDING on %s\n",chan->name);
+#ifdef ZAPATA_PRI
+ if ((p->proceeding < 2) && p->sig==SIG_PRI && p->pri && !p->outgoing) {
+ if (p->pri->pri) {
+ if (!pri_grab(p, p->pri)) {
+ pri_proceeding(p->pri->pri,p->call, PVT_TO_CHANNEL(p), 1);
+ pri_rel(p->pri);
+ }
+ else
+ ast_log(LOG_WARNING, "Unable to grab PRI on span %d\n", p->span);
+ }
+ p->proceeding=2;
+ }
+#endif
+ /* don't continue in ast_indicate */
+ res = 0;
+ break;
case AST_CONTROL_PROGRESS:
ast_log(LOG_DEBUG,"Received AST_CONTROL_PROGRESS on %s\n",chan->name);
#ifdef ZAPATA_PRI
@@ -6923,7 +6959,7 @@
digit = e->ring.callednum[i];
{
struct ast_frame f = { AST_FRAME_DTMF, digit, };
- ast_queue_frame(pri->pvts[chanpos]->owner, &f);
+ zap_queue_frame(pri->pvts[chanpos], &f);
}
}
}
@@ -7110,8 +7146,7 @@
} else
ast_log(LOG_DEBUG, "Deferring ringing notification because of extra digits to dial...\n");
}
- /* Fall through */
- if (chanpos < 0) break;
+ break;
case PRI_EVENT_PROCEEDING:
/* Get chan value if e->e is not PRI_EVNT_RINGING */
if (e->e == PRI_EVENT_PROCEEDING)
@@ -7121,9 +7156,9 @@
struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_PROGRESS, };
ast_log(LOG_DEBUG, "Queuing frame from PRI_EVENT_PROCEEDING on channel %d/%d span %d\n",
pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset,pri->span);
- if (pri->pvts[chanpos]->owner)
- ast_queue_frame(pri->pvts[chanpos]->owner, &f);
-
+ zap_queue_frame(pri->pvts[chanpos], &f);
+ f.subclass = AST_CONTROL_PROCEEDING;
+ zap_queue_frame(pri->pvts[chanpos], &f);
pri->pvts[chanpos]->proceeding=1;
}
}
@@ -8088,7 +8123,7 @@
}
for (i=0; i<strlen(number); i++) {
struct ast_frame f = { AST_FRAME_DTMF, number[i] };
- ast_queue_frame(p->owner, &f);
+ zap_queue_frame(p, &f);
}
astman_send_ack(s, m, "ZapDialOffhook");
return 0;
More information about the svn-commits
mailing list