diff options
author | Richard Mudgett <rmudgett@digium.com> | 2013-02-05 19:11:33 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2013-02-05 19:11:33 +0000 |
commit | fe6fc6e3b0395819fe905851324823c1b52c1b6a (patch) | |
tree | fce9f945007842b1ac74b7462237c541fee9b2f9 /apps/app_page.c | |
parent | 128d7abb05328ba4b7d6fdde17fd7f3873fa587b (diff) |
app_page and app_confbridge: Fix custom announcement on entering conference.
The Page and ConfBridge custom announcement did not play when users
entered the conference.
* Fix the CONFBRIDGE(user,announcement) file not getting played. The code
to do this got removed accidentally when the ConfBridge code was
restructured to be more state machine like.
* Fixed play_prompt_to_user() doxygen comments.
* Fixed the Page A(x) and n options for the caller. The caller never
played the announcement file and totally ignored the n option. The code
to do this was lost when the application was converted to use ConfBridge.
* Factored out setup_profile_bridge(), setup_profile_paged(), and
setup_profile_caller() routines to setup ConfBridge profiles. Made each
profile setup routine use the default template if one has not already been
setup by dialplan.
(closes issue ASTERISK-20990)
Reported by: Jeremy Kister
Tested by: rmudgett
........
Merged revisions 380894 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@380896 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_page.c')
-rw-r--r-- | apps/app_page.c | 89 |
1 files changed, 66 insertions, 23 deletions
diff --git a/apps/app_page.c b/apps/app_page.c index 95069d7d6..8e7d1d2bd 100644 --- a/apps/app_page.c +++ b/apps/app_page.c @@ -141,35 +141,85 @@ struct page_options { struct ast_flags flags; }; -static void page_state_callback(struct ast_dial *dial) +/*! + * \internal + * \brief Setup the page bridge profile. + * + * \param chan Setup bridge profile on this channel. + * \param options Options to setup bridge profile. + * + * \return Nothing + */ +static void setup_profile_bridge(struct ast_channel *chan, struct page_options *options) { - struct ast_channel *chan; - struct page_options *options; - - if (ast_dial_state(dial) != AST_DIAL_RESULT_ANSWERED || - !(chan = ast_dial_answered(dial)) || - !(options = ast_dial_get_user_data(dial))) { - return; - } - - ast_func_write(chan, "CONFBRIDGE(bridge,template)", "default_bridge"); - + /* Use default_bridge as a starting point */ + ast_func_write(chan, "CONFBRIDGE(bridge,template)", ""); if (ast_test_flag(&options->flags, PAGE_RECORD)) { ast_func_write(chan, "CONFBRIDGE(bridge,record_conference)", "yes"); } +} +/*! + * \internal + * \brief Setup the paged user profile. + * + * \param chan Setup user profile on this channel. + * \param options Options to setup paged user profile. + * + * \return Nothing + */ +static void setup_profile_paged(struct ast_channel *chan, struct page_options *options) +{ + /* Use default_user as a starting point */ + ast_func_write(chan, "CONFBRIDGE(user,template)", ""); ast_func_write(chan, "CONFBRIDGE(user,quiet)", "yes"); ast_func_write(chan, "CONFBRIDGE(user,end_marked)", "yes"); - if (!ast_test_flag(&options->flags, PAGE_DUPLEX)) { ast_func_write(chan, "CONFBRIDGE(user,startmuted)", "yes"); } + if (ast_test_flag(&options->flags, PAGE_ANNOUNCE) + && !ast_strlen_zero(options->opts[OPT_ARG_ANNOUNCE])) { + ast_func_write(chan, "CONFBRIDGE(user,announcement)", options->opts[OPT_ARG_ANNOUNCE]); + } +} - if (ast_test_flag(&options->flags, PAGE_ANNOUNCE) && !ast_strlen_zero(options->opts[OPT_ARG_ANNOUNCE])) { +/*! + * \internal + * \brief Setup the caller user profile. + * + * \param chan Setup user profile on this channel. + * \param options Options to setup caller user profile. + * + * \return Nothing + */ +static void setup_profile_caller(struct ast_channel *chan, struct page_options *options) +{ + /* Use default_user as a starting point if not already setup. */ + ast_func_write(chan, "CONFBRIDGE(user,template)", ""); + ast_func_write(chan, "CONFBRIDGE(user,quiet)", "yes"); + ast_func_write(chan, "CONFBRIDGE(user,marked)", "yes"); + if (!ast_test_flag(&options->flags, PAGE_NOCALLERANNOUNCE) + && ast_test_flag(&options->flags, PAGE_ANNOUNCE) + && !ast_strlen_zero(options->opts[OPT_ARG_ANNOUNCE])) { ast_func_write(chan, "CONFBRIDGE(user,announcement)", options->opts[OPT_ARG_ANNOUNCE]); } } +static void page_state_callback(struct ast_dial *dial) +{ + struct ast_channel *chan; + struct page_options *options; + + if (ast_dial_state(dial) != AST_DIAL_RESULT_ANSWERED || + !(chan = ast_dial_answered(dial)) || + !(options = ast_dial_get_user_data(dial))) { + return; + } + + setup_profile_bridge(chan, options); + setup_profile_paged(chan, options); +} + static int page_exec(struct ast_channel *chan, const char *data) { char *tech, *resource, *tmp; @@ -302,17 +352,10 @@ static int page_exec(struct ast_channel *chan, const char *data) } if (!res) { - ast_func_write(chan, "CONFBRIDGE(bridge,template)", "default_bridge"); - - if (ast_test_flag(&options.flags, PAGE_RECORD)) { - ast_func_write(chan, "CONFBRIDGE(bridge,record_conference)", "yes"); - } - - ast_func_write(chan, "CONFBRIDGE(user,quiet)", "yes"); - ast_func_write(chan, "CONFBRIDGE(user,marked)", "yes"); + setup_profile_bridge(chan, &options); + setup_profile_caller(chan, &options); snprintf(confbridgeopts, sizeof(confbridgeopts), "%u", confid); - pbx_exec(chan, app, confbridgeopts); } |