aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_followme.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/app_followme.c')
-rw-r--r--apps/app_followme.c43
1 files changed, 22 insertions, 21 deletions
diff --git a/apps/app_followme.c b/apps/app_followme.c
index 5f16583b6..6728a0fd7 100644
--- a/apps/app_followme.c
+++ b/apps/app_followme.c
@@ -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 */