Send progress before in-band indications for BUSY/CONGESTION
authorMark Spencer <markster@digium.com>
Sat, 13 Nov 2004 23:56:50 +0000 (23:56 +0000)
committerMark Spencer <markster@digium.com>
Sat, 13 Nov 2004 23:56:50 +0000 (23:56 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4232 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_zap.c

index 2233789..a98bc26 100755 (executable)
@@ -4262,6 +4262,17 @@ static int zt_indicate(struct ast_channel *chan, int condition)
                                chan->hangupcause = AST_CAUSE_USER_BUSY;
                                chan->_softhangup |= AST_SOFTHANGUP_DEV;
                                res = 0;
+                       } else if (!p->proceeding && p->sig==SIG_PRI && p->pri && !p->outgoing) {
+                               if (p->pri->pri) {              
+                                       if (!pri_grab(p, p->pri)) {
+                                               pri_progress(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=1;
+                               res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_BUSY);
                        } else
 #endif
                                res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_BUSY);
@@ -4332,6 +4343,17 @@ static int zt_indicate(struct ast_channel *chan, int condition)
                                chan->hangupcause = AST_CAUSE_SWITCH_CONGESTION;
                                chan->_softhangup |= AST_SOFTHANGUP_DEV;
                                res = 0;
+                       } else if (!p->proceeding && p->sig==SIG_PRI && p->pri && !p->outgoing) {
+                               if (p->pri->pri) {              
+                                       if (!pri_grab(p, p->pri)) {
+                                               pri_progress(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=1;
+                               res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_CONGESTION);
                        } else
 #endif
                                res = tone_zone_play_tone(p->subs[index].zfd, ZT_TONE_CONGESTION);