diff options
author | seanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-11-09 01:43:14 +0000 |
---|---|---|
committer | seanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-11-09 01:43:14 +0000 |
commit | bee3f58aa636ce684b50226753a508acf701a65b (patch) | |
tree | 508b72c8c49320b5add60ad55992311464790088 /apps | |
parent | 6297955c144166d5587cb2631403fa96f215fbfb (diff) |
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: http://svn.digium.com/svn/asterisk/branches/1.6.1@155556 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_dial.c | 43 | ||||
-rw-r--r-- | apps/app_followme.c | 43 | ||||
-rw-r--r-- | apps/app_queue.c | 17 |
3 files changed, 54 insertions, 49 deletions
diff --git a/apps/app_dial.c b/apps/app_dial.c index 1b9647142..1adfb5790 100644 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -1254,6 +1254,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 */ @@ -1909,27 +1930,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)) @@ -1954,6 +1954,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; 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 */ diff --git a/apps/app_queue.c b/apps/app_queue.c index 0cf9a31c3..351194b51 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -3211,6 +3211,15 @@ static void setup_transfer_datastore(struct queue_ent *qe, struct member *member ast_channel_unlock(qe->chan); } +static void end_bridge_callback(void *data) +{ + struct queue_ent *qe = data; + + ao2_lock(qe->parent); + set_queue_variables(qe); + ao2_unlock(qe->parent); +} + /*! \brief A large function which calls members, updates statistics, and bridges the caller and a member * * Here is the process of this function @@ -3278,13 +3287,6 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce int callcompletedinsl; struct ao2_iterator memi; struct ast_datastore *datastore; - auto void end_bridge_callback(void); - void end_bridge_callback(void) - { - ao2_lock(qe->parent); - set_queue_variables(qe); - ao2_unlock(qe->parent); - } ast_channel_lock(qe->chan); datastore = ast_channel_datastore_find(qe->chan, &dialed_interface_info, NULL); @@ -3356,6 +3358,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce } bridge_config.end_bridge_callback = end_bridge_callback; + bridge_config.end_bridge_callback_data = qe; /* Hold the lock while we setup the outgoing calls */ if (use_weight) |