]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
automerge commit
authorAutomerge script <automerge@asterisk.org>
Fri, 5 May 2006 21:07:01 +0000 (21:07 +0000)
committerAutomerge script <automerge@asterisk.org>
Fri, 5 May 2006 21:07:01 +0000 (21:07 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2-netsec@25055 65c4cc65-6c06-0410-ace0-fbb531ad65f3

app.c
apps/app_voicemail.c
channels/chan_h323.c
include/asterisk/app.h

diff --git a/app.c b/app.c
index 8041a8e7316ed5025cbc0f50e72c4a4ffa3abcbe..4971f4d7714a39e006a45b251c6d98e544646a74 100644 (file)
--- a/app.c
+++ b/app.c
@@ -537,7 +537,7 @@ int ast_play_and_wait(struct ast_channel *chan, const char *fn)
 static int global_silence_threshold = 128;
 static int global_maxsilence = 0;
 
-int ast_play_and_record(struct ast_channel *chan, const char *playfile, const char *recordfile, int maxtime, const char *fmt, int *duration, int silencethreshold, int maxsilence, const char *path)
+int ast_play_and_record_full(struct ast_channel *chan, const char *playfile, const char *recordfile, int maxtime, const char *fmt, int *duration, int silencethreshold, int maxsilence, const char *path, const char *acceptdtmf, const char *canceldtmf)
 {
        int d;
        char *fmts;
@@ -688,19 +688,18 @@ int ast_play_and_record(struct ast_channel *chan, const char *playfile, const ch
                                /* Write only once */
                                ast_writestream(others[0], f);
                        } else if (f->frametype == AST_FRAME_DTMF) {
-                               if (f->subclass == '#') {
+                               if (strchr(acceptdtmf, f->subclass)) {
                                        if (option_verbose > 2)
-                                               ast_verbose( VERBOSE_PREFIX_3 "User ended message by pressing %c\n", f->subclass);
-                                       res = '#';
+                                               ast_verbose(VERBOSE_PREFIX_3 "User ended message by pressing %c\n", f->subclass);
+                                       res = f->subclass;
                                        outmsg = 2;
                                        ast_frfree(f);
                                        break;
                                }
-                               if (f->subclass == '0') {
-                               /* Check for a '0' during message recording also, in case caller wants operator */
+                               if (strchr(canceldtmf, f->subclass)) {
                                        if (option_verbose > 2)
-                                               ast_verbose(VERBOSE_PREFIX_3 "User cancelled by pressing %c\n", f->subclass);
-                                       res = '0';
+                                               ast_verbose(VERBOSE_PREFIX_3 "User cancelled message by pressing %c\n", f->subclass);
+                                       res = f->subclass;
                                        outmsg = 0;
                                        ast_frfree(f);
                                        break;
@@ -762,6 +761,14 @@ int ast_play_and_record(struct ast_channel *chan, const char *playfile, const ch
        return res;
 }
 
+static char default_acceptdtmf[] = "#";
+static char default_canceldtmf[] = "0";
+
+int ast_play_and_record(struct ast_channel *chan, const char *playfile, const char *recordfile, int maxtime, const char *fmt, int *duration, int silencethreshold, int maxsilence, const char *path)
+{
+       return ast_play_and_record_full(chan, playfile, recordfile, maxtime, fmt, duration, silencethreshold, maxsilence, path, default_acceptdtmf, default_canceldtmf);
+}
+
 int ast_play_and_prepend(struct ast_channel *chan, char *playfile, char *recordfile, int maxtime, char *fmt, int *duration, int beep, int silencethreshold, int maxsilence)
 {
        int d = 0;
index d720fb761b1f9c34bdf107be5517d7c63bd99166..efc0de82679c4eeb8df0395fd333299bc75f0702 100644 (file)
@@ -668,13 +668,9 @@ static void vm_change_password(struct ast_vm_user *vmu, const char *newpassword)
                char *user = NULL, *pass = NULL, *rest = NULL, *comment = NULL, *tmpctx = NULL, *tmpctxend = NULL;
 
                /* Read in the line */
-               fgets(inbuf, sizeof(inbuf), configin);
-               linenum++;
-
-               if (ast_strlen_zero(inbuf)) {
-                       fprintf(configout, "\n");
+               if (fgets(inbuf, sizeof(inbuf), configin) == NULL)
                        continue;
-               }
+               linenum++;
 
                /* Make a backup of it */
                ast_copy_string(orig, inbuf, sizeof(orig));
@@ -2375,6 +2371,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
        int duration = 0;
        int ausemacro = 0;
        int ousemacro = 0;
+       int ouseexten = 0;
        char date[256];
        char dir[256];
        char fn[256];
@@ -2433,14 +2430,20 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
        create_dirpath(dir, sizeof(dir), vmu->context, ext, "INBOX");
 
        /* Check current or macro-calling context for special extensions */
-       if (!ast_strlen_zero(vmu->exit)) {
-               if (ast_exists_extension(chan, vmu->exit, "o", 1, chan->cid.cid_num))
+       if (ast_test_flag(vmu, VM_OPERATOR)) {
+               if (!ast_strlen_zero(vmu->exit)) {
+                       if (ast_exists_extension(chan, vmu->exit, "o", 1, chan->cid.cid_num)) {
+                               strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1);
+                               ouseexten = 1;
+                       }
+               } else if (ast_exists_extension(chan, chan->context, "o", 1, chan->cid.cid_num)) {
+                       strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1);
+                       ouseexten = 1;
+               }
+               else if (!ast_strlen_zero(chan->macrocontext) && ast_exists_extension(chan, chan->macrocontext, "o", 1, chan->cid.cid_num)) {
                        strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1);
-       } else if (ast_exists_extension(chan, chan->context, "o", 1, chan->cid.cid_num))
-               strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1);
-       else if (!ast_strlen_zero(chan->macrocontext) && ast_exists_extension(chan, chan->macrocontext, "o", 1, chan->cid.cid_num)) {
-               strncat(ecodes, "0", sizeof(ecodes) - strlen(ecodes) - 1);
-               ousemacro = 1;
+                       ousemacro = 1;
+               }
        }
 
        if (!ast_strlen_zero(vmu->exit)) {
@@ -2502,10 +2505,11 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
                pbx_builtin_setvar_helper(chan, "VMSTATUS", "USEREXIT");
                return 0;
        }
+
        /* Check for a '0' here */
        if (res == '0') {
        transfer:
-               if (ast_test_flag(vmu, VM_OPERATOR)) {
+               if(ouseexten || ousemacro) {
                        chan->exten[0] = 'o';
                        chan->exten[1] = '\0';
                        if (!ast_strlen_zero(vmu->exit)) {
@@ -2517,12 +2521,8 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
                        chan->priority = 0;
                        free_user(vmu);
                        pbx_builtin_setvar_helper(chan, "VMSTATUS", "USEREXIT");
-                       return 0;
-               } else {
-                       ast_play_and_wait(chan, "vm-sorry");
-                       pbx_builtin_setvar_helper(chan, "VMSTATUS", "USEREXIT");
-                       return 0;
                }
+               return 0;
        }
        if (res < 0) {
                free_user(vmu);
@@ -5248,7 +5248,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
                        while ((cmd > -1) && (cmd != 't') && (cmd != '#')) {
                                switch(cmd) {
                                case '1': /* Reply */
-                                       if (vms.lastmsg > -1) {
+                                       if (vms.lastmsg > -1 && !vms.starting) {
                                                cmd = advanced_options(chan, vmu, &vms, vms.curmsg, 1, record_gain);
                                                if (cmd == ERROR_LOCK_PATH) {
                                                        res = cmd;
@@ -5259,9 +5259,9 @@ static int vm_execmain(struct ast_channel *chan, void *data)
                                        cmd = 't';
                                        break;
                                case '2': /* Callback */
-                                       if (option_verbose > 2)
+                                       if (option_verbose > 2 && !vms.starting)
                                                ast_verbose( VERBOSE_PREFIX_3 "Callback Requested\n");
-                                       if (!ast_strlen_zero(vmu->callback) && vms.lastmsg > -1) {
+                                       if (!ast_strlen_zero(vmu->callback) && vms.lastmsg > -1 && !vms.starting) {
                                                cmd = advanced_options(chan, vmu, &vms, vms.curmsg, 2, record_gain);
                                                if (cmd == 9) {
                                                        silentexit = 1;
@@ -5276,7 +5276,7 @@ static int vm_execmain(struct ast_channel *chan, void *data)
                                        cmd = 't';
                                        break;
                                case '3': /* Envelope */
-                                       if (vms.lastmsg > -1) {
+                                       if (vms.lastmsg > -1 && !vms.starting) {
                                                cmd = advanced_options(chan, vmu, &vms, vms.curmsg, 3, record_gain);
                                                if (cmd == ERROR_LOCK_PATH) {
                                                        res = cmd;
@@ -6440,6 +6440,9 @@ static int advanced_options(struct ast_channel *chan, struct ast_vm_user *vmu, s
                        res = play_message_datetime(chan, vmu, origtime, filename);
                if (!res)
                        res = play_message_callerid(chan, vms, cid, context, 0);
+
+               res = 't';
+
        } else if (option == 2) { /* Call back */
 
                if (!ast_strlen_zero(cid)) {
@@ -6584,6 +6587,9 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re
        int recorded = 0;
        int message_exists = 0;
        signed char zero_gain = 0;
+       char *acceptdtmf = "#";
+       char *canceldtmf = "";
+
        /* Note that urgent and private are for flagging messages as such in the future */
  
        /* barf if no pointer passed to store duration in */
@@ -6637,7 +6643,9 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re
                        /* After an attempt has been made to record message, we have to take care of INTRO and beep for incoming messages, but not for greetings */
                        if (record_gain)
                                ast_channel_setoption(chan, AST_OPTION_RXGAIN, &record_gain, sizeof(record_gain), 0);
-                       cmd = ast_play_and_record(chan, playfile, recordfile, maxtime, fmt, duration, silencethreshold, maxsilence, unlockdir);
+                       if (ast_test_flag(vmu, VM_OPERATOR))
+                               canceldtmf = "0";
+                       cmd = ast_play_and_record_full(chan, playfile, recordfile, maxtime, fmt, duration, silencethreshold, maxsilence, unlockdir, acceptdtmf, canceldtmf);
                        if (record_gain)
                                ast_channel_setoption(chan, AST_OPTION_RXGAIN, &zero_gain, sizeof(zero_gain), 0);
                        if (cmd == -1) {
@@ -6700,6 +6708,10 @@ static int play_record_review(struct ast_channel *chan, char *playfile, char *re
                                return 1;
 #endif
                case '0':
+                       if(!ast_test_flag(vmu, VM_OPERATOR)) {
+                               cmd = ast_play_and_wait(chan, "vm-sorry");
+                               break;
+                       }
                        if (message_exists || recorded) {
                                cmd = ast_play_and_wait(chan, "vm-saveoper");
                                if (!cmd)
index 469ce398ec9cbec4e67eac502f2bd3570bbdea6a..ee0bdbd1ddf09ef59cba1bd8335df1c48ea120ce 100644 (file)
@@ -1233,7 +1233,6 @@ void setup_rtp_connection(unsigned call_reference, const char *remoteIp, int rem
   */
 void connection_made(unsigned call_reference, const char *token)
 {
-       struct ast_channel *c = NULL;
        struct oh323_pvt *pvt;
 
        if (h323debug)
@@ -1435,7 +1434,6 @@ int setup_outgoing_call(call_details_t *cd)
   */
 void chan_ringing(unsigned call_reference, const char *token)
 {
-       struct ast_channel *c = NULL;
        struct oh323_pvt *pvt;
 
        if (h323debug)
@@ -2281,7 +2279,7 @@ static char *convertcap(int cap)
        }
 }
 
-static int oh323_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp, struct ast_rtp *vrtp, int codecs)
+static int oh323_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp, struct ast_rtp *vrtp, int codecs, int nat_active)
 {
        /* XXX Deal with Video */
        struct oh323_pvt *pvt;
@@ -2310,7 +2308,7 @@ static struct ast_rtp_protocol oh323_rtp = {
        .type = type,
        .get_rtp_info = oh323_get_rtp_peer,
        .get_vrtp_info = oh323_get_vrtp_peer,
-       .set_rtp_peer oh323_set_rtp_peer,
+       .set_rtp_peer = oh323_set_rtp_peer,
 };
 
 int load_module()
index 38b1fdb73ff87e6e87dd7116e2909789fe9fdf85..972314c5700ced2b2e1f9a14cc1b5ed36a4959e4 100644 (file)
@@ -130,6 +130,8 @@ int ast_control_streamfile(struct ast_channel *chan, const char *file, const cha
 /*! Play a stream and wait for a digit, returning the digit that was pressed */
 int ast_play_and_wait(struct ast_channel *chan, const char *fn);
 
+int ast_play_and_record_full(struct ast_channel *chan, const char *playfile, const char *recordfile, int maxtime_sec, const char *fmt, int *duration, int silencethreshold, int maxsilence_ms, const char *path, const char *acceptdtmf, const char *canceldtmf);
+
 /*! Record a file for a max amount of time (in seconds), in a given list of formats separated by '|', outputting the duration of the recording, and with a maximum 
  \n
  permitted silence time in milliseconds of 'maxsilence' under 'silencethreshold' or use '-1' for either or both parameters for defaults.