aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2007-02-08 22:48:47 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2007-02-08 22:48:47 +0000
commitd0b2229ebdf2a6569b092d4adf4ad7a984b2ef15 (patch)
tree9486a727b8e1260f7df7e56c9f2dbfa10936f2a4 /apps
parent908810e23f7815eccab97be7023a1aed15f89464 (diff)
merge up to branch 1.2 and re-enable automerge
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2-netsec@53671 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r--apps/app_chanspy.c2
-rw-r--r--apps/app_dial.c13
-rw-r--r--apps/app_macro.c13
-rw-r--r--apps/app_meetme.c1
-rw-r--r--apps/app_page.c1
-rw-r--r--apps/app_queue.c1
-rw-r--r--apps/app_rpt.c5
-rw-r--r--apps/app_voicemail.c4
8 files changed, 27 insertions, 13 deletions
diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c
index fcb931d32..6b30842b8 100644
--- a/apps/app_chanspy.c
+++ b/apps/app_chanspy.c
@@ -53,7 +53,7 @@ AST_MUTEX_DEFINE_STATIC(modlock);
#define ALL_DONE(u, ret) LOCAL_USER_REMOVE(u); return ret;
#define get_volfactor(x) x ? ((x > 0) ? (1 << x) : ((1 << abs(x)) * -1)) : 0
-static const char *synopsis = "Listen to the audio of an active channel\n";
+static const char *synopsis = "Listen to the audio of an active channel";
static const char *app = "ChanSpy";
static const char *desc =
" ChanSpy([chanprefix][|options]): This application is used to listen to the\n"
diff --git a/apps/app_dial.c b/apps/app_dial.c
index 522c47a3f..69b5813d3 100644
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -80,7 +80,7 @@ static char *descrip =
" ANSWEREDTIME - This is the amount of time for actual call.\n"
" DIALSTATUS - This is the status of the call:\n"
" CHANUNAVAIL | CONGESTION | NOANSWER | BUSY | ANSWER | CANCEL\n"
-" DONTCALL | TORTURE\n"
+" DONTCALL | TORTURE | INVALIDARGS\n"
" For the Privacy and Screening Modes, the DIALSTATUS variable will be set to\n"
"DONTCALL if the called party chooses to send the calling party to the 'Go Away'\n"
"script. The DIALSTATUS variable will be set to TORTURE if the called party\n"
@@ -759,7 +759,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
char *start_sound=NULL;
char *dtmfcalled=NULL, *dtmfcalling=NULL;
char *var;
- char status[256];
+ char status[256] = "INVALIDARGS";
int play_to_caller=0,play_to_callee=0;
int sentringing=0, moh=0;
char *outbound_group = NULL;
@@ -780,21 +780,19 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "Dial requires an argument (technology/number)\n");
+ pbx_builtin_setvar_helper(chan, "DIALSTATUS", status);
return -1;
}
LOCAL_USER_ADD(u);
- if (!(parse = ast_strdupa(data))) {
- ast_log(LOG_WARNING, "Memory allocation failure\n");
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ parse = ast_strdupa(data);
AST_STANDARD_APP_ARGS(args, parse);
if (!ast_strlen_zero(args.options)) {
if (ast_app_parse_options(dial_exec_options, &opts, opt_args, args.options)) {
+ pbx_builtin_setvar_helper(chan, "DIALSTATUS", status);
LOCAL_USER_REMOVE(u);
return -1;
}
@@ -802,6 +800,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
if (ast_strlen_zero(args.peers)) {
ast_log(LOG_WARNING, "Dial requires an argument (technology/number)\n");
+ pbx_builtin_setvar_helper(chan, "DIALSTATUS", status);
LOCAL_USER_REMOVE(u);
return -1;
}
diff --git a/apps/app_macro.c b/apps/app_macro.c
index 44d3d0610..425836278 100644
--- a/apps/app_macro.c
+++ b/apps/app_macro.c
@@ -107,10 +107,10 @@ static int macro_exec(struct ast_channel *chan, void *data)
int oldpriority;
char pc[80], depthc[12];
char oldcontext[AST_MAX_CONTEXT] = "";
- char *offsets, *s;
+ char *offsets, *s, *inhangupc;
int offset, depth = 0, maxdepth = 7;
int setmacrocontext=0;
- int autoloopflag, dead = 0;
+ int autoloopflag, dead = 0, inhangup = 0;
char *save_macro_exten;
char *save_macro_context;
@@ -138,6 +138,13 @@ static int macro_exec(struct ast_channel *chan, void *data)
depth = 0;
}
+ /* Used for detecting whether to return when a Macro is called from another Macro after hangup */
+ if (strcmp(chan->exten, "h") == 0)
+ pbx_builtin_setvar_helper(chan, "MACRO_IN_HANGUP", "1");
+ inhangupc = pbx_builtin_getvar_helper(chan, "MACRO_IN_HANGUP");
+ if (!ast_strlen_zero(inhangupc))
+ sscanf(inhangupc, "%d", &inhangup);
+
if (depth >= maxdepth) {
ast_log(LOG_ERROR, "Macro(): possible infinite loop detected. Returning early.\n");
LOCAL_USER_REMOVE(u);
@@ -252,7 +259,7 @@ static int macro_exec(struct ast_channel *chan, void *data)
break;
}
/* don't stop executing extensions when we're in "h" */
- if (chan->_softhangup && strcasecmp(oldexten,"h") && strcasecmp(chan->macroexten,"h")) {
+ if (chan->_softhangup && !inhangup) {
ast_log(LOG_DEBUG, "Extension %s, macroexten %s, priority %d returned normally even though call was hung up\n",
chan->exten, chan->macroexten, chan->priority);
goto out;
diff --git a/apps/app_meetme.c b/apps/app_meetme.c
index a29289ed8..1efd4bbb4 100644
--- a/apps/app_meetme.c
+++ b/apps/app_meetme.c
@@ -862,6 +862,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
ast_verbose(VERBOSE_PREFIX_4 "Starting recording of MeetMe Conference %s into file %s.%s.\n",
conf->confno, conf->recordingfilename, conf->recordingformat);
ast_pthread_create(&conf->recordthread, &conf->attr, recordthread, conf);
+ pthread_attr_destroy(&conf->attr);
}
time(&user->jointime);
diff --git a/apps/app_page.c b/apps/app_page.c
index c1668cc7f..e57e5d051 100644
--- a/apps/app_page.c
+++ b/apps/app_page.c
@@ -135,6 +135,7 @@ static void launch_page(struct ast_channel *chan, const char *meetmeopts, const
ast_log(LOG_WARNING, "Unable to create paging thread: %s\n", strerror(errno));
free(cd);
}
+ pthread_attr_destroy(&attr);
}
}
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 64117322f..b6d809862 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -562,6 +562,7 @@ static int statechange_queue(const char *dev, int state, void *ign)
ast_log(LOG_WARNING, "Failed to create update thread!\n");
free(sc);
}
+ pthread_attr_destroy(&attr);
return 0;
}
diff --git a/apps/app_rpt.c b/apps/app_rpt.c
index 913baaba8..a3f86c820 100644
--- a/apps/app_rpt.c
+++ b/apps/app_rpt.c
@@ -1521,6 +1521,7 @@ pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
ast_pthread_create(&tele->threadid,&attr,rpt_tele_thread,(void *) tele);
+ pthread_attr_destroy(&attr);
return;
}
@@ -2153,6 +2154,7 @@ static int function_autopatchup(struct rpt *myrpt, char *param, char *digitbuf,
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
ast_pthread_create(&myrpt->rpt_call_thread,&attr,rpt_call,(void *) myrpt);
+ pthread_attr_destroy(&attr);
return DC_COMPLETE;
}
@@ -5239,6 +5241,7 @@ char cmd[MAXDTMF+1] = "";
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
ast_pthread_create(&myrpt->rpt_call_thread,&attr,rpt_call,(void *)myrpt);
+ pthread_attr_destroy(&attr);
continue;
}
}
@@ -5781,6 +5784,7 @@ pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
ast_pthread_create(&rpt_vars[i].rpt_thread,&attr,rpt,(void *) &rpt_vars[i]);
+ pthread_attr_destroy(&attr);
}
usleep(500000);
for(;;)
@@ -5816,6 +5820,7 @@ pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
ast_pthread_create(&rpt_vars[i].rpt_thread,&attr,rpt,(void *) &rpt_vars[i]);
+ pthread_attr_destroy(&attr);
ast_log(LOG_WARNING, "rpt_thread restarted on node %s\n", rpt_vars[i].name);
}
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 47896a0d6..c857096ee 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -1746,7 +1746,7 @@ static int sendmail(char *srcemail, struct ast_vm_user *vmu, int msgnum, char *c
memset(passdata, 0, vmlen);
prep_email_sub_vars(ast,vmu,msgnum + 1,context,mailbox,cidnum, cidname,dur,date,passdata, vmlen);
pbx_substitute_variables_helper(ast,fromstring,passdata,vmlen);
- len_passdata = strlen(passdata) * 2 + 1;
+ len_passdata = strlen(passdata) * 2 + 3;
passdata2 = alloca(len_passdata);
fprintf(p, "From: %s <%s>\n", quote(passdata, passdata2, len_passdata), who);
} else ast_log(LOG_WARNING, "Cannot allocate workspace for variable substitution\n");
@@ -1754,7 +1754,7 @@ static int sendmail(char *srcemail, struct ast_vm_user *vmu, int msgnum, char *c
} else ast_log(LOG_WARNING, "Cannot allocate the channel for variables substitution\n");
} else
fprintf(p, "From: Asterisk PBX <%s>\n", who);
- len_passdata = strlen(vmu->fullname) * 2 + 1;
+ len_passdata = strlen(vmu->fullname) * 2 + 3;
passdata2 = alloca(len_passdata);
fprintf(p, "To: %s <%s>\n", quote(vmu->fullname, passdata2, len_passdata), vmu->email);