summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES2
-rw-r--r--apps/app_confbridge.c11
-rw-r--r--apps/app_page.c91
-rw-r--r--apps/confbridge/conf_config_parser.c5
-rw-r--r--apps/confbridge/include/confbridge.h1
-rw-r--r--configs/confbridge.conf.sample1
-rw-r--r--include/asterisk/dial.h13
-rw-r--r--main/dial.c11
8 files changed, 106 insertions, 29 deletions
diff --git a/CHANGES b/CHANGES
index 10c179fba..dccfb5cf2 100644
--- a/CHANGES
+++ b/CHANGES
@@ -39,6 +39,8 @@ ConfBridge
occurs to be overriden using sound_participants_unmuted and sound_participants_muted.
* Added menu action participant_count. This will playback the number of current
participants in a conference.
+ * Added announcement configuration option to user profile. If set the sound file will
+ be played to the user, and only the user, upon joining the conference bridge.
Voicemail
------------------
diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c
index b5b27ed2f..89c4354b3 100644
--- a/apps/app_confbridge.c
+++ b/apps/app_confbridge.c
@@ -997,6 +997,17 @@ static struct conference_bridge *join_conference_bridge(const char *name, struct
ast_devstate_changed(AST_DEVICE_INUSE, "confbridge:%s", conference_bridge->name);
}
+ /* If an announcement is to be played play it */
+ if (!ast_strlen_zero(conference_bridge_user->u_profile.announcement)) {
+ if (play_prompt_to_channel(conference_bridge,
+ conference_bridge_user->chan,
+ conference_bridge_user->u_profile.announcement)) {
+ ao2_unlock(conference_bridge);
+ leave_conference_bridge(conference_bridge, conference_bridge_user);
+ return NULL;
+ }
+ }
+
/* If the caller is a marked user or is waiting for a marked user to enter pass 'em off, otherwise pass them off to do regular joining stuff */
if (ast_test_flag(&conference_bridge_user->u_profile, USER_OPT_MARKEDUSER | USER_OPT_WAITMARKED)) {
if (post_join_marked(conference_bridge, conference_bridge_user)) {
diff --git a/apps/app_page.c b/apps/app_page.c
index d96b4b766..f9170d43a 100644
--- a/apps/app_page.c
+++ b/apps/app_page.c
@@ -26,8 +26,7 @@
*/
/*** MODULEINFO
- <depend>dahdi</depend>
- <depend>app_meetme</depend>
+ <depend>app_confbridge</depend>
<support_level>core</support_level>
***/
@@ -76,7 +75,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
<para>Quiet, do not play beep to caller</para>
</option>
<option name="r">
- <para>Record the page into a file (meetme option <literal>r</literal>)</para>
+ <para>Record the page into a file (ConfBridge option <literal>r</literal>)</para>
</option>
<option name="s">
<para>Only dial a channel if its device state says that it is <literal>NOT_INUSE</literal></para>
@@ -105,7 +104,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
destroyed when the original callers leaves.</para>
</description>
<see-also>
- <ref type="application">MeetMe</ref>
+ <ref type="application">ConfBridge</ref>
</see-also>
</application>
***/
@@ -136,12 +135,46 @@ AST_APP_OPTIONS(page_opts, {
AST_APP_OPTION('n', PAGE_NOCALLERANNOUNCE),
});
+/* We use this structure as a way to pass this to all dialed channels */
+struct page_options {
+ char *opts[OPT_ARG_ARRAY_SIZE];
+ struct ast_flags flags;
+};
+
+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;
+ }
+
+ 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,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]);
+ }
+}
static int page_exec(struct ast_channel *chan, const char *data)
{
char *tech, *resource, *tmp;
- char meetmeopts[128], originator[AST_CHANNEL_NAME], *opts[OPT_ARG_ARRAY_SIZE];
- struct ast_flags flags = { 0 };
+ char confbridgeopts[128], originator[AST_CHANNEL_NAME];
+ struct page_options options = { { 0, }, { 0, } };
unsigned int confid = ast_random();
struct ast_app *app;
int res = 0, pos = 0, i = 0;
@@ -161,8 +194,8 @@ static int page_exec(struct ast_channel *chan, const char *data)
return -1;
}
- if (!(app = pbx_findapp("MeetMe"))) {
- ast_log(LOG_WARNING, "There is no MeetMe application available!\n");
+ if (!(app = pbx_findapp("ConfBridge"))) {
+ ast_log(LOG_WARNING, "There is no ConfBridge application available!\n");
return -1;
};
@@ -176,20 +209,14 @@ static int page_exec(struct ast_channel *chan, const char *data)
}
if (!ast_strlen_zero(args.options)) {
- ast_app_parse_options(page_opts, &flags, opts, args.options);
+ ast_app_parse_options(page_opts, &options.flags, options.opts, args.options);
}
if (!ast_strlen_zero(args.timeout)) {
timeout = atoi(args.timeout);
}
- if (ast_test_flag(&flags, PAGE_ANNOUNCE) && !ast_strlen_zero(opts[OPT_ARG_ANNOUNCE])) {
- snprintf(meetmeopts, sizeof(meetmeopts), "MeetMe,%ud,%s%sqxdw(5)G(%s)", confid, (ast_test_flag(&flags, PAGE_DUPLEX) ? "" : "m"),
- (ast_test_flag(&flags, PAGE_RECORD) ? "r" : ""), opts[OPT_ARG_ANNOUNCE] );
- } else {
- snprintf(meetmeopts, sizeof(meetmeopts), "MeetMe,%ud,%s%sqxdw(5)", confid, (ast_test_flag(&flags, PAGE_DUPLEX) ? "" : "m"),
- (ast_test_flag(&flags, PAGE_RECORD) ? "r" : "") );
- }
+ snprintf(confbridgeopts, sizeof(confbridgeopts), "ConfBridge,%u", confid);
/* Count number of extensions in list by number of ampersands + 1 */
num_dials = 1;
@@ -222,7 +249,7 @@ static int page_exec(struct ast_channel *chan, const char *data)
}
/* Ensure device is not in use if skip option is enabled */
- if (ast_test_flag(&flags, PAGE_SKIP)) {
+ if (ast_test_flag(&options.flags, PAGE_SKIP)) {
state = ast_device_state(tech);
if (state == AST_DEVICE_UNKNOWN) {
ast_log(LOG_WARNING, "Destination '%s' has device state '%s'. Paging anyway.\n", tech, ast_devstate2str(state));
@@ -247,16 +274,19 @@ static int page_exec(struct ast_channel *chan, const char *data)
}
/* Set ANSWER_EXEC as global option */
- ast_dial_option_global_enable(dial, AST_DIAL_OPTION_ANSWER_EXEC, meetmeopts);
+ ast_dial_option_global_enable(dial, AST_DIAL_OPTION_ANSWER_EXEC, confbridgeopts);
if (timeout) {
ast_dial_set_global_timeout(dial, timeout * 1000);
}
- if (ast_test_flag(&flags, PAGE_IGNORE_FORWARDS)) {
+ if (ast_test_flag(&options.flags, PAGE_IGNORE_FORWARDS)) {
ast_dial_option_global_enable(dial, AST_DIAL_OPTION_DISABLE_CALL_FORWARDING, NULL);
}
+ ast_dial_set_state_callback(dial, &page_state_callback);
+ ast_dial_set_user_data(dial, &options);
+
/* Run this dial in async mode */
ast_dial_run(dial, chan, 1);
@@ -264,29 +294,32 @@ static int page_exec(struct ast_channel *chan, const char *data)
dial_list[pos++] = dial;
}
- if (!ast_test_flag(&flags, PAGE_QUIET)) {
+ if (!ast_test_flag(&options.flags, PAGE_QUIET)) {
res = ast_streamfile(chan, "beep", ast_channel_language(chan));
if (!res)
res = ast_waitstream(chan, "");
}
if (!res) {
- /* Default behaviour */
- snprintf(meetmeopts, sizeof(meetmeopts), "%ud,A%s%sqxd", confid, (ast_test_flag(&flags, PAGE_DUPLEX) ? "" : "t"),
- (ast_test_flag(&flags, PAGE_RECORD) ? "r" : "") );
- if (ast_test_flag(&flags, PAGE_ANNOUNCE) && !ast_strlen_zero(opts[OPT_ARG_ANNOUNCE]) &&
- !ast_test_flag(&flags, PAGE_NOCALLERANNOUNCE)) {
- snprintf(meetmeopts, sizeof(meetmeopts), "%ud,A%s%sqxdG(%s)", confid, (ast_test_flag(&flags, PAGE_DUPLEX) ? "" : "t"),
- (ast_test_flag(&flags, PAGE_RECORD) ? "r" : ""), opts[OPT_ARG_ANNOUNCE] );
+ 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");
}
- pbx_exec(chan, app, meetmeopts);
+
+ ast_func_write(chan, "CONFBRIDGE(user,quiet)", "yes");
+ ast_func_write(chan, "CONFBRIDGE(user,marked)", "yes");
+
+ snprintf(confbridgeopts, sizeof(confbridgeopts), "%u", confid);
+
+ pbx_exec(chan, app, confbridgeopts);
}
/* Go through each dial attempt cancelling, joining, and destroying */
for (i = 0; i < pos; i++) {
struct ast_dial *dial = dial_list[i];
- /* We have to wait for the async thread to exit as it's possible Meetme won't throw them out immediately */
+ /* We have to wait for the async thread to exit as it's possible ConfBridge won't throw them out immediately */
ast_dial_join(dial);
/* Hangup all channels */
diff --git a/apps/confbridge/conf_config_parser.c b/apps/confbridge/conf_config_parser.c
index a73c65820..0ae9ada94 100644
--- a/apps/confbridge/conf_config_parser.c
+++ b/apps/confbridge/conf_config_parser.c
@@ -187,6 +187,8 @@ static int set_user_option(const char *name, const char *value, struct user_prof
ast_copy_string(u_profile->pin, value, sizeof(u_profile->pin));
} else if (!strcasecmp(name, "music_on_hold_class")) {
ast_copy_string(u_profile->moh_class, value, sizeof(u_profile->moh_class));
+ } else if (!strcasecmp(name, "announcement")) {
+ ast_copy_string(u_profile->announcement, value, sizeof(u_profile->announcement));
} else if (!strcasecmp(name, "denoise")) {
ast_set2_flag(u_profile, ast_true(value), USER_OPT_DENOISE);
} else if (!strcasecmp(name, "dsp_talking_threshold")) {
@@ -515,6 +517,7 @@ static int parse_user(const char *cat, struct ast_config *cfg)
u_profile->talking_threshold = DEFAULT_TALKING_THRESHOLD;
memset(u_profile->pin, 0, sizeof(u_profile->pin));
memset(u_profile->moh_class, 0, sizeof(u_profile->moh_class));
+ memset(u_profile->announcement, 0, sizeof(u_profile->announcement));
for (var = ast_variable_browse(cfg, cat); var; var = var->next) {
if (!strcasecmp(var->name, "type")) {
continue;
@@ -859,6 +862,8 @@ static char *handle_cli_confbridge_show_user_profile(struct ast_cli_entry *e, in
ast_cli(a->fd,"MOH Class: %s\n",
ast_strlen_zero(u_profile.moh_class) ?
"default" : u_profile.moh_class);
+ ast_cli(a->fd,"Announcement: %s\n",
+ u_profile.announcement);
ast_cli(a->fd,"Quiet: %s\n",
u_profile.flags & USER_OPT_QUIET ?
"enabled" : "disabled");
diff --git a/apps/confbridge/include/confbridge.h b/apps/confbridge/include/confbridge.h
index 5337e22aa..dd4ceff89 100644
--- a/apps/confbridge/include/confbridge.h
+++ b/apps/confbridge/include/confbridge.h
@@ -128,6 +128,7 @@ struct user_profile {
char name[128];
char pin[MAX_PIN];
char moh_class[128];
+ char announcement[PATH_MAX];
unsigned int flags;
unsigned int announce_user_count_all_after;
/*! The time in ms of talking before a user is considered to be talking by the dsp. */
diff --git a/configs/confbridge.conf.sample b/configs/confbridge.conf.sample
index d113825d2..7484b28ae 100644
--- a/configs/confbridge.conf.sample
+++ b/configs/confbridge.conf.sample
@@ -126,6 +126,7 @@ type=user
; the conference. This option is off by default.
;dtmf_passthrough=yes ; Sets whether or not DTMF should pass through the conference.
; This option is off by default.
+;announcement=</path/to/file> ; Play a sound file to the user when they join the conference.
; --- ConfBridge Bridge Profile Options ---
[default_bridge]
diff --git a/include/asterisk/dial.h b/include/asterisk/dial.h
index e023fb342..04721d283 100644
--- a/include/asterisk/dial.h
+++ b/include/asterisk/dial.h
@@ -152,6 +152,19 @@ int ast_dial_option_disable(struct ast_dial *dial, int num, enum ast_dial_option
*/
void ast_dial_set_state_callback(struct ast_dial *dial, ast_dial_state_callback callback);
+/*! \brief Set user data on a dial structure
+ * \param dial The dial structure to set a user data pointer on
+ * \param user_data The user data pointer
+ * \return nothing
+ */
+void ast_dial_set_user_data(struct ast_dial *dial, void *user_data);
+
+/*! \brief Return the user data on a dial structure
+ * \param dial The dial structure
+ * \return A pointer to the user data
+ */
+void *ast_dial_get_user_data(struct ast_dial *dial);
+
/*! \brief Set the maximum time (globally) allowed for trying to ring phones
* \param dial The dial structure to apply the time limit to
* \param timeout Maximum time allowed in milliseconds
diff --git a/main/dial.c b/main/dial.c
index 24dbf2841..538471719 100644
--- a/main/dial.c
+++ b/main/dial.c
@@ -47,6 +47,7 @@ struct ast_dial {
enum ast_dial_result state; /*!< Status of dial */
void *options[AST_DIAL_OPTION_MAX]; /*!< Global options */
ast_dial_state_callback state_callback; /*!< Status callback */
+ void *user_data; /*!< Attached user data */
AST_LIST_HEAD(, ast_dial_channel) channels; /*!< Channels being dialed */
pthread_t thread; /*!< Thread (if running in async) */
ast_mutex_t lock; /*! Lock to protect the thread information above */
@@ -1049,6 +1050,16 @@ void ast_dial_set_state_callback(struct ast_dial *dial, ast_dial_state_callback
dial->state_callback = callback;
}
+void ast_dial_set_user_data(struct ast_dial *dial, void *user_data)
+{
+ dial->user_data = user_data;
+}
+
+void *ast_dial_get_user_data(struct ast_dial *dial)
+{
+ return dial->user_data;
+}
+
/*! \brief Set the maximum time (globally) allowed for trying to ring phones
* \param dial The dial structure to apply the time limit to
* \param timeout Maximum time allowed