Various updates from PCadach's chan_h323-live branch
authorMatthew Fredrickson <creslin@digium.com>
Tue, 19 Sep 2006 21:07:49 +0000 (21:07 +0000)
committerMatthew Fredrickson <creslin@digium.com>
Tue, 19 Sep 2006 21:07:49 +0000 (21:07 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43294 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_macro.c
apps/app_voicemail.c
channels/chan_zap.c
funcs/func_callerid.c
pbx/pbx_ael.c
pbx/pbx_gtkconsole.c
res/res_musiconhold.c

index 42b32dd..21c2b7c 100644 (file)
@@ -238,14 +238,14 @@ static int _macro_exec(struct ast_channel *chan, void *data, int exclusive)
                        case AST_PBX_KEEPALIVE:
                                if (option_debug)
                                        ast_log(LOG_DEBUG, "Spawn extension (%s,%s,%d) exited KEEPALIVE in macro %s on '%s'\n", chan->context, chan->exten, chan->priority, macro, chan->name);
-                               if (option_verbose > 1)
+                               else if (option_verbose > 1)
                                        ast_verbose( VERBOSE_PREFIX_2 "Spawn extension (%s, %s, %d) exited KEEPALIVE in macro '%s' on '%s'\n", chan->context, chan->exten, chan->priority, macro, chan->name);
                                goto out;
                                break;
                        default:
                                if (option_debug)
                                        ast_log(LOG_DEBUG, "Spawn extension (%s,%s,%d) exited non-zero on '%s' in macro '%s'\n", chan->context, chan->exten, chan->priority, chan->name, macro);
-                               if (option_verbose > 1)
+                               else if (option_verbose > 1)
                                        ast_verbose( VERBOSE_PREFIX_2 "Spawn extension (%s, %s, %d) exited non-zero on '%s' in macro '%s'\n", chan->context, chan->exten, chan->priority, chan->name, macro);
                                dead = 1;
                                goto out;
index 4e605e9..99e51f2 100644 (file)
@@ -4607,12 +4607,15 @@ static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu,int box)
 static int close_mailbox(struct vm_state *vms, struct ast_vm_user *vmu)
 {
        int x = 0;
+#ifndef IMAP_STORAGE
+       int res = 0, nummsg;
+#endif
+
        if (vms->lastmsg <= -1)
                goto done;
 
        vms->curmsg = -1; 
 #ifndef IMAP_STORAGE
-       int res = 0, nummsg;
        /* Get the deleted messages fixed */ 
        if (vm_lock_path(vms->curdir))
                return ERROR_LOCK_PATH;
index b10cd6b..303b520 100644 (file)
@@ -2070,6 +2070,8 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
                int prilocaldialplan;
                int ldp_strip;
                int exclusive;
+               const char *rr_str;
+               int redirect_reason;
 
                c = strchr(dest, '/');
                if (c)
@@ -2176,7 +2178,20 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout)
                }
                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);
+               if ((rr_str = pbx_builtin_getvar_helper(ast, "PRIREDIRECTREASON"))) {
+                       if (!strcasecmp(rr_str, "UNKNOWN"))
+                               redirect_reason = 0;
+                       else if (!strcasecmp(rr_str, "BUSY"))
+                               redirect_reason = 1;
+                       else if (!strcasecmp(rr_str, "NO_REPLY"))
+                               redirect_reason = 2;
+                       else if (!strcasecmp(rr_str, "UNCONDITIONAL"))
+                               redirect_reason = 15;
+                       else
+                               redirect_reason = PRI_REDIR_UNCONDITIONAL;
+               } else
+                       redirect_reason = PRI_REDIR_UNCONDITIONAL;
+               pri_sr_set_redirecting(sr, ast->cid.cid_rdnis, p->pri->localdialplan - 1, PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN, redirect_reason);
 
 #ifdef SUPPORT_USERUSER
                /* User-user info */
index 21f13ce..6068739 100644 (file)
@@ -59,7 +59,7 @@ static int callerid_read(struct ast_channel *chan, char *cmd, char *data,
 
                        ast_copy_string(buf, num, len);
                } else {
-                       ast_log(LOG_ERROR, "Unknown callerid data type.\n");
+                       ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
                }
        } else {
                if (!strncasecmp("all", data, 3)) {
@@ -88,7 +88,7 @@ static int callerid_read(struct ast_channel *chan, char *cmd, char *data,
                                ast_copy_string(buf, chan->cid.cid_rdnis, len);
                        }
                } else {
-                       ast_log(LOG_ERROR, "Unknown callerid data type.\n");
+                       ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
                }
        }
 
@@ -125,7 +125,7 @@ static int callerid_write(struct ast_channel *chan, char *cmd, char *data,
                        free(chan->cid.cid_rdnis);
                chan->cid.cid_rdnis = ast_strdup(value);
        } else {
-               ast_log(LOG_ERROR, "Unknown callerid data type.\n");
+               ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
        }
 
        return 0;
index cbef91f..791a58c 100644 (file)
@@ -1056,6 +1056,7 @@ static void check_label(pval *item)
           The method:  well, for each label, find the first label in the context
           with the same name. If it's not the current label, then throw an error. */
        struct pval *curr;
+       struct pval *x;
        
        /* printf("==== check_label:   ====\n"); */
        if( !current_extension )
@@ -1063,7 +1064,7 @@ static void check_label(pval *item)
        else
                curr = current_extension;
        
-       struct pval *x = find_first_label_in_current_context((char *)item->u1.str, curr);
+       x = find_first_label_in_current_context((char *)item->u1.str, curr);
        /* printf("Hey, check_label found with item = %x, and x is %x, and currcont is %x, label name is %s\n", item,x, current_context, (char *)item->u1.str); */
        if( x && x != item )
        {
index 4dce4d2..9f9a189 100644 (file)
@@ -495,7 +495,7 @@ static int load_module(void *mod)
        } else {
                if (option_debug)
                        ast_log(LOG_DEBUG, "Unable to start GTK console monitor -- ignoring\n");
-               if (option_verbose > 1)
+               else if (option_verbose > 1)
                        ast_verbose( VERBOSE_PREFIX_2 "GTK is not available -- skipping monitor\n");
        }
        return 0;
index e553a99..4082017 100644 (file)
@@ -525,7 +525,7 @@ static void *monmp3thread(void *data)
                                close(class->srcfd);
                                class->srcfd = -1;
                                pthread_testcancel();
-                               if (class->pid) {
+                               if (class->pid > 1) {
                                        kill(class->pid, SIGHUP);
                                        usleep(100000);
                                        kill(class->pid, SIGTERM);
@@ -778,6 +778,10 @@ static int moh_scan_files(struct mohclass *class) {
                if ((strlen(files_dirent->d_name) < 4))
                        continue;
 
+               /* Skip standard license file - it is not audio */
+               if (!strcmp(files_dirent->d_name, "LICENSE"))
+                       continue;
+
                snprintf(filepath, sizeof(filepath), "%s/%s", class->dir, files_dirent->d_name);
 
                if (stat(filepath, &statbuf))
@@ -1095,7 +1099,7 @@ static void ast_moh_destroy(void)
 
        AST_LIST_LOCK(&mohclasses);
        while ((moh = AST_LIST_REMOVE_HEAD(&mohclasses, list))) {
-               if (moh->pid) {
+               if (moh->pid > 1) {
                        ast_log(LOG_DEBUG, "killing %d!\n", moh->pid);
                        stime = time(NULL) + 2;
                        pid = moh->pid;