aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_dial.c
diff options
context:
space:
mode:
authorseanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b>2008-11-09 01:27:00 +0000
committerseanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b>2008-11-09 01:27:00 +0000
commit70ff546e20c930fe8c28001a7cef10d8ee569896 (patch)
tree9d9c7d00ae1f93a61488a183927f7571484ce363 /apps/app_dial.c
parentcd55da2a782fe1b57c8f7c6d92615006b7d76177 (diff)
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: http://svn.digium.com/svn/asterisk/trunk@155554 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_dial.c')
-rw-r--r--apps/app_dial.c43
1 files changed, 22 insertions, 21 deletions
diff --git a/apps/app_dial.c b/apps/app_dial.c
index a42edf7a0..ecf09e868 100644
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -1462,6 +1462,27 @@ static void set_dial_features(struct ast_flags64 *opts, struct ast_dial_features
ast_app_options2str64(dial_exec_options, &perm_opts, features->options, sizeof(features->options));
}
+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 dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags64 *peerflags, int *continue_exec)
{
int res = -1; /* default: error */
@@ -2117,27 +2138,6 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
if (res) { /* some error */
res = -1;
} 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);
- }
-
if (ast_test_flag64(peerflags, OPT_CALLEE_TRANSFER))
ast_set_flag(&(config.features_callee), AST_FEATURE_REDIRECT);
if (ast_test_flag64(peerflags, OPT_CALLER_TRANSFER))
@@ -2162,6 +2162,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
ast_set_flag(&(config.features_caller), AST_FEATURE_NO_H_EXTEN);
config.end_bridge_callback = end_bridge_callback;
+ config.end_bridge_callback_data = chan;
if (moh) {
moh = 0;