mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-09 03:18:30 +00:00
Transition app_page to using app_confbridge internally for the conference bridge portion of paging. This also adds a new 'announcement' option to ConfBridge user profiles.
Review: https://reviewboard.asterisk.org/r/1754/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@358730 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
2
CHANGES
2
CHANGES
@@ -39,6 +39,8 @@ ConfBridge
|
|||||||
occurs to be overriden using sound_participants_unmuted and sound_participants_muted.
|
occurs to be overriden using sound_participants_unmuted and sound_participants_muted.
|
||||||
* Added menu action participant_count. This will playback the number of current
|
* Added menu action participant_count. This will playback the number of current
|
||||||
participants in a conference.
|
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
|
Voicemail
|
||||||
------------------
|
------------------
|
||||||
|
|||||||
@@ -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);
|
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 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 (ast_test_flag(&conference_bridge_user->u_profile, USER_OPT_MARKEDUSER | USER_OPT_WAITMARKED)) {
|
||||||
if (post_join_marked(conference_bridge, conference_bridge_user)) {
|
if (post_join_marked(conference_bridge, conference_bridge_user)) {
|
||||||
|
|||||||
@@ -26,8 +26,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*** MODULEINFO
|
/*** MODULEINFO
|
||||||
<depend>dahdi</depend>
|
<depend>app_confbridge</depend>
|
||||||
<depend>app_meetme</depend>
|
|
||||||
<support_level>core</support_level>
|
<support_level>core</support_level>
|
||||||
***/
|
***/
|
||||||
|
|
||||||
@@ -76,7 +75,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
<para>Quiet, do not play beep to caller</para>
|
<para>Quiet, do not play beep to caller</para>
|
||||||
</option>
|
</option>
|
||||||
<option name="r">
|
<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>
|
||||||
<option name="s">
|
<option name="s">
|
||||||
<para>Only dial a channel if its device state says that it is <literal>NOT_INUSE</literal></para>
|
<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>
|
destroyed when the original callers leaves.</para>
|
||||||
</description>
|
</description>
|
||||||
<see-also>
|
<see-also>
|
||||||
<ref type="application">MeetMe</ref>
|
<ref type="application">ConfBridge</ref>
|
||||||
</see-also>
|
</see-also>
|
||||||
</application>
|
</application>
|
||||||
***/
|
***/
|
||||||
@@ -136,12 +135,46 @@ AST_APP_OPTIONS(page_opts, {
|
|||||||
AST_APP_OPTION('n', PAGE_NOCALLERANNOUNCE),
|
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)
|
static int page_exec(struct ast_channel *chan, const char *data)
|
||||||
{
|
{
|
||||||
char *tech, *resource, *tmp;
|
char *tech, *resource, *tmp;
|
||||||
char meetmeopts[128], originator[AST_CHANNEL_NAME], *opts[OPT_ARG_ARRAY_SIZE];
|
char confbridgeopts[128], originator[AST_CHANNEL_NAME];
|
||||||
struct ast_flags flags = { 0 };
|
struct page_options options = { { 0, }, { 0, } };
|
||||||
unsigned int confid = ast_random();
|
unsigned int confid = ast_random();
|
||||||
struct ast_app *app;
|
struct ast_app *app;
|
||||||
int res = 0, pos = 0, i = 0;
|
int res = 0, pos = 0, i = 0;
|
||||||
@@ -161,8 +194,8 @@ static int page_exec(struct ast_channel *chan, const char *data)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(app = pbx_findapp("MeetMe"))) {
|
if (!(app = pbx_findapp("ConfBridge"))) {
|
||||||
ast_log(LOG_WARNING, "There is no MeetMe application available!\n");
|
ast_log(LOG_WARNING, "There is no ConfBridge application available!\n");
|
||||||
return -1;
|
return -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -176,20 +209,14 @@ static int page_exec(struct ast_channel *chan, const char *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!ast_strlen_zero(args.options)) {
|
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)) {
|
if (!ast_strlen_zero(args.timeout)) {
|
||||||
timeout = atoi(args.timeout);
|
timeout = atoi(args.timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ast_test_flag(&flags, PAGE_ANNOUNCE) && !ast_strlen_zero(opts[OPT_ARG_ANNOUNCE])) {
|
snprintf(confbridgeopts, sizeof(confbridgeopts), "ConfBridge,%u", confid);
|
||||||
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" : "") );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Count number of extensions in list by number of ampersands + 1 */
|
/* Count number of extensions in list by number of ampersands + 1 */
|
||||||
num_dials = 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 */
|
/* 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);
|
state = ast_device_state(tech);
|
||||||
if (state == AST_DEVICE_UNKNOWN) {
|
if (state == AST_DEVICE_UNKNOWN) {
|
||||||
ast_log(LOG_WARNING, "Destination '%s' has device state '%s'. Paging anyway.\n", tech, ast_devstate2str(state));
|
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 */
|
/* 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) {
|
if (timeout) {
|
||||||
ast_dial_set_global_timeout(dial, timeout * 1000);
|
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_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 */
|
/* Run this dial in async mode */
|
||||||
ast_dial_run(dial, chan, 1);
|
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;
|
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));
|
res = ast_streamfile(chan, "beep", ast_channel_language(chan));
|
||||||
if (!res)
|
if (!res)
|
||||||
res = ast_waitstream(chan, "");
|
res = ast_waitstream(chan, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!res) {
|
if (!res) {
|
||||||
/* Default behaviour */
|
ast_func_write(chan, "CONFBRIDGE(bridge,template)", "default_bridge");
|
||||||
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(&options.flags, PAGE_RECORD)) {
|
||||||
if (ast_test_flag(&flags, PAGE_ANNOUNCE) && !ast_strlen_zero(opts[OPT_ARG_ANNOUNCE]) &&
|
ast_func_write(chan, "CONFBRIDGE(bridge,record_conference)", "yes");
|
||||||
!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] );
|
|
||||||
}
|
}
|
||||||
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 */
|
/* Go through each dial attempt cancelling, joining, and destroying */
|
||||||
for (i = 0; i < pos; i++) {
|
for (i = 0; i < pos; i++) {
|
||||||
struct ast_dial *dial = dial_list[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);
|
ast_dial_join(dial);
|
||||||
|
|
||||||
/* Hangup all channels */
|
/* Hangup all channels */
|
||||||
|
|||||||
@@ -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));
|
ast_copy_string(u_profile->pin, value, sizeof(u_profile->pin));
|
||||||
} else if (!strcasecmp(name, "music_on_hold_class")) {
|
} else if (!strcasecmp(name, "music_on_hold_class")) {
|
||||||
ast_copy_string(u_profile->moh_class, value, sizeof(u_profile->moh_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")) {
|
} else if (!strcasecmp(name, "denoise")) {
|
||||||
ast_set2_flag(u_profile, ast_true(value), USER_OPT_DENOISE);
|
ast_set2_flag(u_profile, ast_true(value), USER_OPT_DENOISE);
|
||||||
} else if (!strcasecmp(name, "dsp_talking_threshold")) {
|
} 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;
|
u_profile->talking_threshold = DEFAULT_TALKING_THRESHOLD;
|
||||||
memset(u_profile->pin, 0, sizeof(u_profile->pin));
|
memset(u_profile->pin, 0, sizeof(u_profile->pin));
|
||||||
memset(u_profile->moh_class, 0, sizeof(u_profile->moh_class));
|
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) {
|
for (var = ast_variable_browse(cfg, cat); var; var = var->next) {
|
||||||
if (!strcasecmp(var->name, "type")) {
|
if (!strcasecmp(var->name, "type")) {
|
||||||
continue;
|
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_cli(a->fd,"MOH Class: %s\n",
|
||||||
ast_strlen_zero(u_profile.moh_class) ?
|
ast_strlen_zero(u_profile.moh_class) ?
|
||||||
"default" : 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",
|
ast_cli(a->fd,"Quiet: %s\n",
|
||||||
u_profile.flags & USER_OPT_QUIET ?
|
u_profile.flags & USER_OPT_QUIET ?
|
||||||
"enabled" : "disabled");
|
"enabled" : "disabled");
|
||||||
|
|||||||
@@ -128,6 +128,7 @@ struct user_profile {
|
|||||||
char name[128];
|
char name[128];
|
||||||
char pin[MAX_PIN];
|
char pin[MAX_PIN];
|
||||||
char moh_class[128];
|
char moh_class[128];
|
||||||
|
char announcement[PATH_MAX];
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
unsigned int announce_user_count_all_after;
|
unsigned int announce_user_count_all_after;
|
||||||
/*! The time in ms of talking before a user is considered to be talking by the dsp. */
|
/*! The time in ms of talking before a user is considered to be talking by the dsp. */
|
||||||
|
|||||||
@@ -126,6 +126,7 @@ type=user
|
|||||||
; the conference. This option is off by default.
|
; the conference. This option is off by default.
|
||||||
;dtmf_passthrough=yes ; Sets whether or not DTMF should pass through the conference.
|
;dtmf_passthrough=yes ; Sets whether or not DTMF should pass through the conference.
|
||||||
; This option is off by default.
|
; 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 ---
|
; --- ConfBridge Bridge Profile Options ---
|
||||||
[default_bridge]
|
[default_bridge]
|
||||||
|
|||||||
@@ -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);
|
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
|
/*! \brief Set the maximum time (globally) allowed for trying to ring phones
|
||||||
* \param dial The dial structure to apply the time limit to
|
* \param dial The dial structure to apply the time limit to
|
||||||
* \param timeout Maximum time allowed in milliseconds
|
* \param timeout Maximum time allowed in milliseconds
|
||||||
|
|||||||
11
main/dial.c
11
main/dial.c
@@ -47,6 +47,7 @@ struct ast_dial {
|
|||||||
enum ast_dial_result state; /*!< Status of dial */
|
enum ast_dial_result state; /*!< Status of dial */
|
||||||
void *options[AST_DIAL_OPTION_MAX]; /*!< Global options */
|
void *options[AST_DIAL_OPTION_MAX]; /*!< Global options */
|
||||||
ast_dial_state_callback state_callback; /*!< Status callback */
|
ast_dial_state_callback state_callback; /*!< Status callback */
|
||||||
|
void *user_data; /*!< Attached user data */
|
||||||
AST_LIST_HEAD(, ast_dial_channel) channels; /*!< Channels being dialed */
|
AST_LIST_HEAD(, ast_dial_channel) channels; /*!< Channels being dialed */
|
||||||
pthread_t thread; /*!< Thread (if running in async) */
|
pthread_t thread; /*!< Thread (if running in async) */
|
||||||
ast_mutex_t lock; /*! Lock to protect the thread information above */
|
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;
|
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
|
/*! \brief Set the maximum time (globally) allowed for trying to ring phones
|
||||||
* \param dial The dial structure to apply the time limit to
|
* \param dial The dial structure to apply the time limit to
|
||||||
* \param timeout Maximum time allowed
|
* \param timeout Maximum time allowed
|
||||||
|
|||||||
Reference in New Issue
Block a user