aboutsummaryrefslogtreecommitdiffstats
path: root/pbx.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-09-10 05:24:49 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-09-10 05:24:49 +0000
commit976304e2d745787a11d40773e5e89bc1f5ed441e (patch)
tree7369fb6f917cb30c67faa951c0b0cdf29ff0eb73 /pbx.c
parent2d2f69d9b8a98aa5a4fb1247c5346becaed1793d (diff)
Fix small logic errors (bug #242)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1494 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx.c')
-rwxr-xr-xpbx.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/pbx.c b/pbx.c
index 5a99f5c18..5ad920948 100755
--- a/pbx.c
+++ b/pbx.c
@@ -1134,7 +1134,7 @@ static int pbx_extension_helper(struct ast_channel *c, char *context, char *exte
ast_mutex_unlock(&conlock);
if (app) {
if (c->context != context)
- strncpy(c->context, context, sizeof(c->context-1));
+ strncpy(c->context, context, sizeof(c->context)-1);
if (c->exten != exten)
strncpy(c->exten, exten, sizeof(c->exten)-1);
c->priority = priority;
@@ -2512,7 +2512,7 @@ static int handle_show_dialplan(int fd, int argc, char *argv[])
/* try to lock contexts */
if (ast_lock_contexts()) {
- ast_cli(LOG_WARNING, "Failed to lock contexts list\n");
+ ast_log(LOG_WARNING, "Failed to lock contexts list\n");
return RESULT_FAILURE;
}
@@ -3798,12 +3798,16 @@ int ast_pbx_outgoing_exten(char *type, int format, void *data, int timeout, char
res = 0;
if (option_verbose > 3)
ast_verbose(VERBOSE_PREFIX_4 "Channel %s was answered.\n", chan->name);
- if (context && strlen(context))
+ if (context && *context)
strncpy(chan->context, context, sizeof(chan->context) - 1);
- if (exten && strlen(exten))
+ if (exten && *exten)
strncpy(chan->exten, exten, sizeof(chan->exten) - 1);
- if (callerid && strlen(callerid))
- strncpy(chan->callerid, callerid, sizeof(chan->callerid) - 1);
+ if (callerid && *callerid) {
+ /* XXX call ast_set_callerid? */
+ if (chan->callerid)
+ free(chan->callerid);
+ chan->callerid = strdup(callerid);
+ }
if (priority > 0)
chan->priority = priority;
if (sync > 1) {