Minor code tweaks. Variables were being checked wrong in some situations and didn...
authorJoshua Colp <jcolp@digium.com>
Wed, 18 Jul 2007 13:59:01 +0000 (13:59 +0000)
committerJoshua Colp <jcolp@digium.com>
Wed, 18 Jul 2007 13:59:01 +0000 (13:59 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@75566 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_voicemail.c
channels/chan_agent.c
channels/chan_sip.c
pbx/pbx_realtime.c

index 96461fc..b5897df 100644 (file)
@@ -619,9 +619,9 @@ static struct ast_flags globalflags = {0};
 
 static int saydurationminfo;
 
-static char dialcontext[AST_MAX_CONTEXT];
-static char callcontext[AST_MAX_CONTEXT];
-static char exitcontext[AST_MAX_CONTEXT];
+static char dialcontext[AST_MAX_CONTEXT] = "";
+static char callcontext[AST_MAX_CONTEXT] = "";
+static char exitcontext[AST_MAX_CONTEXT] = "";
 
 static char cidinternalcontexts[MAX_NUM_CID_CONTEXTS][64];
 
@@ -665,12 +665,9 @@ static void populate_defaults(struct ast_vm_user *vmu)
        ast_copy_flags(vmu, (&globalflags), AST_FLAGS_ALL);     
        if (saydurationminfo)
                vmu->saydurationm = saydurationminfo;
-       if (callcontext)
-               ast_copy_string(vmu->callback, callcontext, sizeof(vmu->callback));
-       if (dialcontext)
-               ast_copy_string(vmu->dialout, dialcontext, sizeof(vmu->dialout));
-       if (exitcontext)
-               ast_copy_string(vmu->exit, exitcontext, sizeof(vmu->exit));
+       ast_copy_string(vmu->callback, callcontext, sizeof(vmu->callback));
+       ast_copy_string(vmu->dialout, dialcontext, sizeof(vmu->dialout));
+       ast_copy_string(vmu->exit, exitcontext, sizeof(vmu->exit));
        if (vmmaxsecs)
                vmu->maxsecs = vmmaxsecs;
        if (maxmsg)
index cda841f..d123155 100644 (file)
@@ -390,10 +390,10 @@ static int __agent_start_monitoring(struct ast_channel *ast, struct agent_pvt *p
                /* substitute . for - */
                if ((pointer = strchr(filename, '.')))
                        *pointer = '-';
-               snprintf(tmp, sizeof(tmp), "%s%s",savecallsin ? savecallsin : "", filename);
+               snprintf(tmp, sizeof(tmp), "%s%s", savecallsin, filename);
                ast_monitor_start(ast, recordformat, tmp, needlock, X_REC_IN | X_REC_OUT);
                ast_monitor_setjoinfiles(ast, 1);
-               snprintf(tmp2, sizeof(tmp2), "%s%s.%s", urlprefix ? urlprefix : "", filename, recordformatext);
+               snprintf(tmp2, sizeof(tmp2), "%s%s.%s", urlprefix, filename, recordformatext);
 #if 0
                ast_verbose("name is %s, link is %s\n",tmp, tmp2);
 #endif
index b22d798..2f5c5c5 100644 (file)
@@ -4948,7 +4948,7 @@ static int sip_register(char *value, int lineno)
        regobjs++;
        ASTOBJ_INIT(reg);
        ast_string_field_set(reg, callback, callback);
-       if (username)
+       if (!ast_strlen_zero(username))
                ast_string_field_set(reg, username, username);
        if (hostname)
                ast_string_field_set(reg, hostname, hostname);
index 9ee770c..d1011fe 100644 (file)
@@ -211,7 +211,7 @@ static int realtime_exec(struct ast_channel *chan, const char *context, const ch
                                                          "Application: %s\r\n"
                                                          "AppData: %s\r\n"
                                                          "Uniqueid: %s\r\n",
-                                                         chan->name, chan->context, chan->exten, chan->priority, app, appdata ? appdata : "(NULL)", chan->uniqueid);
+                                                         chan->name, chan->context, chan->exten, chan->priority, app, !ast_strlen_zero(appdata) ? appdata : "(NULL)", chan->uniqueid);
                                
                                res = pbx_exec(chan, a, appdata);
                        } else