]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
automerge commit
authorAutomerge script <automerge@asterisk.org>
Wed, 24 May 2006 17:05:22 +0000 (17:05 +0000)
committerAutomerge script <automerge@asterisk.org>
Wed, 24 May 2006 17:05:22 +0000 (17:05 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2-netsec@30001 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_queue.c
channels/chan_zap.c
res/res_agi.c

index 4fd6b53640330a461a17a65c667786d3584061fc..704573de5a2dff82bf65d9bd023ea0ac87339402 100644 (file)
@@ -1181,13 +1181,16 @@ static int say_position(struct queue_ent *qe)
                ast_verbose(VERBOSE_PREFIX_3 "Told %s in %s their queue position (which was %d)\n",
                            qe->chan->name, qe->parent->name, qe->pos);
        res = play_file(qe->chan, qe->parent->sound_thanks);
+       if (res && !valid_exit(qe, res))
+               res = 0;
 
  playout:
        /* Set our last_pos indicators */
        qe->last_pos = now;
        qe->last_pos_said = qe->pos;
+
        /* Don't restart music on hold if we're about to exit the caller from the queue */
-       if (res)
+       if (!res)
                ast_moh_start(qe->chan, qe->moh);
 
        return res;
@@ -1556,7 +1559,7 @@ static int background_file(struct queue_ent *qe, struct ast_channel *chan, char
        if (!res) {
                /* Wait for a keypress */
                res = ast_waitstream(chan, AST_DIGIT_ANY);
-               if (res <= 0 || !valid_exit(qe, res))
+               if (res < 0 || !valid_exit(qe, res))
                        res = 0;
 
                /* Stop playback */
@@ -1594,8 +1597,9 @@ static int say_periodic_announcement(struct queue_ent *qe)
        /* play the announcement */
        res = background_file(qe, qe->chan, qe->parent->sound_periodicannounce);
 
-       /* Resume Music on Hold */
-       ast_moh_start(qe->chan, qe->moh);
+       /* Resume Music on Hold if the caller is going to stay in the queue */
+       if (!res)
+               ast_moh_start(qe->chan, qe->moh);
 
        /* update last_periodic_announce_time */
        qe->last_periodic_announce_time = now;
@@ -1920,18 +1924,17 @@ static int wait_our_turn(struct queue_ent *qe, int ringing, enum queue_result *r
                }
 
                /* Make a position announcement, if enabled */
-               if (qe->parent->announcefrequency && !ringing)
-                       res = say_position(qe);
-               if (res)
+               if (qe->parent->announcefrequency && !ringing &&
+                   (res = say_position(qe)))
                        break;
 
                /* Make a periodic announcement, if enabled */
-               if (qe->parent->periodicannouncefrequency && !ringing)
-                       res = say_periodic_announcement(qe);
+               if (qe->parent->periodicannouncefrequency && !ringing &&
+                   (res = say_periodic_announcement(qe)))
+                       break;
 
                /* Wait a second before checking again */
-               if (!res) res = ast_waitfordigit(qe->chan, RECHECK * 1000);
-               if (res)
+               if ((res = ast_waitfordigit(qe->chan, RECHECK * 1000)))
                        break;
        }
        return res;
@@ -2230,7 +2233,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
                if (res < 0) {
                        ast_queue_log(queuename, qe->chan->uniqueid, peer->name, "SYSCOMPAT", "%s", "");
                        ast_log(LOG_WARNING, "Had to drop call because I couldn't make %s compatible with %s\n", qe->chan->name, peer->name);
-               record_abandoned(qe);
+                       record_abandoned(qe);
                        ast_hangup(peer);
                        return -1;
                }
@@ -2307,13 +2310,10 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
                                              (long)(time(NULL) - callstart));
                }
 
-               if(bridge != AST_PBX_NO_HANGUP_PEER)
+               if (bridge != AST_PBX_NO_HANGUP_PEER)
                        ast_hangup(peer);
                update_queue(qe->parent, member);
-               if (bridge == 0) 
-                       res = 1; /* JDG: bridge successfull, leave app_queue */
-               else 
-                       res = bridge; /* bridge error, stay in the queue */
+               res = bridge ? 0 : -1;
        }       
 out:
        hangupcalls(outgoing, NULL);
@@ -2991,9 +2991,8 @@ check_turns:
 
                                if (makeannouncement) {
                                        /* Make a position announcement, if enabled */
-                                       if (qe.parent->announcefrequency && !ringing)
-                                               res = say_position(&qe);
-                                       if (res) {
+                                       if (qe.parent->announcefrequency && !ringing &&
+                                           (res = say_position(&qe))) {
                                                ast_queue_log(queuename, chan->uniqueid, "NONE", "EXITWITHKEY", "%s|%d", qe.digits, qe.pos);
                                                break;
                                        }
@@ -3002,10 +3001,8 @@ check_turns:
                                makeannouncement = 1;
 
                                /* Make a periodic announcement, if enabled */
-                               if (qe.parent->periodicannouncefrequency && !ringing)
-                                       res = say_periodic_announcement(&qe);
-
-                               if (res && valid_exit(&qe, res)) {
+                               if (qe.parent->periodicannouncefrequency && !ringing &&
+                                   (res = say_periodic_announcement(&qe))) {
                                        ast_queue_log(queuename, chan->uniqueid, "NONE", "EXITWITHKEY", "%c|%d", res, qe.pos);
                                        break;
                                }
@@ -3018,8 +3015,9 @@ check_turns:
                                                        record_abandoned(&qe);
                                                        ast_queue_log(queuename, chan->uniqueid, "NONE", "ABANDON", "%d|%d|%ld", qe.pos, qe.opos, (long)time(NULL) - qe.start);
                                                }
-                                       } else if (res > 0)
+                                       } else if (valid_exit(&qe, res)) {
                                                ast_queue_log(queuename, chan->uniqueid, "NONE", "EXITWITHKEY", "%s|%d", qe.digits, qe.pos);
+                                       }
                                        break;
                                }
 
@@ -3082,7 +3080,7 @@ check_turns:
                                if (!is_our_turn(&qe)) {
                                        if (option_debug)
                                                ast_log(LOG_DEBUG, "Darn priorities, going back in queue (%s)!\n",
-                                                               qe.chan->name);
+                                                       qe.chan->name);
                                        goto check_turns;
                                }
                        }
index 847063a5babe30a1921866aecb5c9b1d425b3f7a..c167db2ba9a745295af71f551cc9831eff12a6c4 100644 (file)
@@ -2119,9 +2119,8 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
                                prilocaldialplan = PRI_LOCAL_ISDN;
                        }
                }
-               pri_sr_set_caller(sr, l ? (l + ldp_strip) : NULL, n, prilocaldialplan, 
-                                       l ? (p->use_callingpres ? ast->cid.cid_pres : PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN) : 
-                                                PRES_NUMBER_NOT_AVAILABLE);
+               pri_sr_set_caller(sr, l ? (l + ldp_strip) : NULL, n, prilocaldialplan,
+                                 p->use_callingpres ? ast->cid.cid_pres : (l ? PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN : PRES_NUMBER_NOT_AVAILABLE));
                pri_sr_set_redirecting(sr, ast->cid.cid_rdnis, p->pri->localdialplan - 1, PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN, PRI_REDIR_UNCONDITIONAL);
 
 #ifdef SUPPORT_USERUSER
index 8f96544433316f914dc15cec1012c1ba081cfcef..14713fcc25cc1e20df6c86471517f58b44409774 100644 (file)
@@ -941,6 +941,9 @@ static int handle_recordfile(struct ast_channel *chan, AGI *agi, int argc, char
                        return RESULT_FAILURE;
                }
                
+               /* Request a video update */
+               ast_indicate(chan, AST_CONTROL_VIDUPDATE);
+       
                chan->stream = fs;
                ast_applystream(chan,fs);
                /* really should have checks */
@@ -1004,6 +1007,9 @@ static int handle_recordfile(struct ast_channel *chan, AGI *agi, int argc, char
                                         }
                                }
                                break;
+                       case AST_FRAME_VIDEO:
+                               ast_writestream(fs, f);
+                               break;
                        }
                        ast_frfree(f);
                        if (gotsilence)