summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xchannel.c2
-rwxr-xr-xchannels/chan_h323.c1
-rwxr-xr-xchannels/chan_sip.c1
-rwxr-xr-xchannels/chan_skinny.c2
-rwxr-xr-xchannels/chan_zap.c59
-rwxr-xr-xinclude/asterisk/frame.h4
6 files changed, 56 insertions, 13 deletions
diff --git a/channel.c b/channel.c
index 52a49aa45..83e39ed57 100755
--- a/channel.c
+++ b/channel.c
@@ -1365,6 +1365,8 @@ int ast_indicate(struct ast_channel *chan, int condition)
res = 0;
} else if (condition == AST_CONTROL_PROGRESS) {
/* ast_playtones_stop(chan); */
+ } else if (condition == AST_CONTROL_PROCEEDING) {
+ /* Do nothing, really */
} else {
/* not handled */
ast_log(LOG_WARNING, "Unable to handle indication %d for '%s'\n", condition, chan->name);
diff --git a/channels/chan_h323.c b/channels/chan_h323.c
index caadfcb31..ae1a6bbf2 100755
--- a/channels/chan_h323.c
+++ b/channels/chan_h323.c
@@ -653,6 +653,7 @@ static int oh323_indicate(struct ast_channel *c, int condition)
break;
}
return -1;
+ case AST_CONTROL_PROCEEDING:
case -1:
return -1;
default:
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index c076d640c..4aacae228 100755
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -1724,6 +1724,7 @@ static int sip_indicate(struct ast_channel *ast, int condition)
}
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;
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index bb8a9a9c8..e5189634e 100755
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -1736,6 +1736,8 @@ static int skinny_indicate(struct ast_channel *ast, int ind)
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;
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index 7e4f79105..7ab42edbf 100755
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -670,6 +670,24 @@ static void wakeup_sub(struct zt_pvt *p, int a)
}
}
+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 @@ static int zt_digit(struct ast_channel *ast, char digit)
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 @@ static int zt_answer(struct ast_channel *ast)
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 @@ struct ast_frame *zt_read(struct ast_channel *ast)
}
} 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 @@ static int zt_indicate(struct ast_channel *chan, int condition)
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 @@ static int zt_indicate(struct ast_channel *chan, int condition)
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 @@ static int zt_indicate(struct ast_channel *chan, int condition)
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 @@ static void *pri_dchannel(void *vpri)
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 @@ static void *pri_dchannel(void *vpri)
} 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 @@ static void *pri_dchannel(void *vpri)
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 @@ static int action_zapdialoffhook(struct mansession *s, struct message *m)
}
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;
diff --git a/include/asterisk/frame.h b/include/asterisk/frame.h
index 3f9964621..b8d6c7d8e 100755
--- a/include/asterisk/frame.h
+++ b/include/asterisk/frame.h
@@ -210,8 +210,10 @@ struct ast_frame_chain {
#define AST_CONTROL_RADIO_KEY 12
/*! Un-Key Radio */
#define AST_CONTROL_RADIO_UNKEY 13
-/*! Indicate CALL_PROCEEDING or PROGRESS */
+/*! Indicate PROGRESS */
#define AST_CONTROL_PROGRESS 14
+/*! Indicate CALL PROCEEDING */
+#define AST_CONTROL_PROCEEDING 15
#define AST_SMOOTHER_FLAG_G729 (1 << 0)