mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-07 02:18:15 +00:00
Merged revisions 155554 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r155554 | seanbright | 2008-11-08 20:27:00 -0500 (Sat, 08 Nov 2008) | 14 lines Merged revisions 155553 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r155553 | seanbright | 2008-11-08 20:08:07 -0500 (Sat, 08 Nov 2008) | 6 lines Use static functions here instead of nested ones. This requires a small change to the ast_bridge_config struct as well. To understand the reason for this change, see the following post: http://gcc.gnu.org/ml/gcc-help/2008-11/msg00049.html ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.1@155556 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -871,6 +871,27 @@ static void findmeexec(struct fm_args *tpargs)
|
||||
return;
|
||||
}
|
||||
|
||||
static void end_bridge_callback(void *data)
|
||||
{
|
||||
char buf[80];
|
||||
time_t end;
|
||||
struct ast_channel *chan = data;
|
||||
|
||||
time(&end);
|
||||
|
||||
ast_channel_lock(chan);
|
||||
if (chan->cdr->answer.tv_sec) {
|
||||
snprintf(buf, sizeof(buf), "%ld", end - chan->cdr->answer.tv_sec);
|
||||
pbx_builtin_setvar_helper(chan, "ANSWEREDTIME", buf);
|
||||
}
|
||||
|
||||
if (chan->cdr->start.tv_sec) {
|
||||
snprintf(buf, sizeof(buf), "%ld", end - chan->cdr->start.tv_sec);
|
||||
pbx_builtin_setvar_helper(chan, "DIALEDTIME", buf);
|
||||
}
|
||||
ast_channel_unlock(chan);
|
||||
}
|
||||
|
||||
static int app_exec(struct ast_channel *chan, void *data)
|
||||
{
|
||||
struct fm_args targs;
|
||||
@@ -981,27 +1002,6 @@ static int app_exec(struct ast_channel *chan, void *data)
|
||||
ast_stream_and_wait(chan, targs.sorryprompt, "");
|
||||
res = 0;
|
||||
} else {
|
||||
auto void end_bridge_callback(void);
|
||||
void end_bridge_callback (void)
|
||||
{
|
||||
char buf[80];
|
||||
time_t end;
|
||||
|
||||
time(&end);
|
||||
|
||||
ast_channel_lock(chan);
|
||||
if (chan->cdr->answer.tv_sec) {
|
||||
snprintf(buf, sizeof(buf), "%ld", end - chan->cdr->answer.tv_sec);
|
||||
pbx_builtin_setvar_helper(chan, "ANSWEREDTIME", buf);
|
||||
}
|
||||
|
||||
if (chan->cdr->start.tv_sec) {
|
||||
snprintf(buf, sizeof(buf), "%ld", end - chan->cdr->start.tv_sec);
|
||||
pbx_builtin_setvar_helper(chan, "DIALEDTIME", buf);
|
||||
}
|
||||
ast_channel_unlock(chan);
|
||||
}
|
||||
|
||||
caller = chan;
|
||||
outbound = targs.outbound;
|
||||
/* Bridge the two channels. */
|
||||
@@ -1011,6 +1011,7 @@ static int app_exec(struct ast_channel *chan, void *data)
|
||||
ast_set_flag(&(config.features_callee), AST_FEATURE_AUTOMON);
|
||||
ast_set_flag(&(config.features_caller), AST_FEATURE_AUTOMON);
|
||||
config.end_bridge_callback = end_bridge_callback;
|
||||
config.end_bridge_callback_data = chan;
|
||||
|
||||
ast_moh_stop(caller);
|
||||
/* Be sure no generators are left on it */
|
||||
|
||||
Reference in New Issue
Block a user