[asterisk-commits] dvossel: branch dvossel/hd_confbridge r310412 - in /team/dvossel/hd_confbridg...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Mar 11 17:01:00 CST 2011
Author: dvossel
Date: Fri Mar 11 17:00:57 2011
New Revision: 310412
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=310412
Log:
Addition of the ability to use conference pins in ConfBridge
Modified:
team/dvossel/hd_confbridge/apps/app_confbridge.c
team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c
team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h
team/dvossel/hd_confbridge/configs/confbridge.conf.sample
Modified: team/dvossel/hd_confbridge/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/apps/app_confbridge.c?view=diff&rev=310412&r1=310411&r2=310412
==============================================================================
--- team/dvossel/hd_confbridge/apps/app_confbridge.c (original)
+++ team/dvossel/hd_confbridge/apps/app_confbridge.c Fri Mar 11 17:00:57 2011
@@ -547,6 +547,36 @@
return 0;
}
+
+static int conf_get_pin(struct ast_channel *chan, const char *pin)
+{
+ char pin_guess[MAX_PIN] = { 0, };
+ char *tmp = pin_guess;
+ int i, res;
+ unsigned int len = MAX_PIN - 1;
+
+ /* give them three tries to get the pin right */
+ for (i = 0; i < 3; i++) {
+ if (ast_app_getdata(chan, "conf-getpin", tmp, len, 0) >= 0) {
+ if (!strcasecmp(pin, pin_guess)) {
+ return 0;
+ }
+ }
+ ast_streamfile(chan, "conf-invalidpin", chan->language);
+ res = ast_waitstream(chan, AST_DIGIT_ANY);
+ if (res > 0) {
+ pin_guess[0] = res;
+ pin_guess[1] = '\0';
+ tmp = pin_guess + 1;
+ len = MAX_PIN - 2;
+ } else {
+ tmp = pin_guess;
+ len = MAX_PIN - 1;
+ }
+ }
+ return -1;
+}
+
/*! \brief The ConfBridge application */
static int confbridge_exec(struct ast_channel *chan, const char *data)
{
@@ -588,6 +618,13 @@
}
conf_find_user_profile(u_profile_name, &conference_bridge_user.u_profile);
+ /* ask for a PIN immediately after finding user profile */
+ if (!ast_strlen_zero(conference_bridge_user.u_profile.pin)) {
+ if (conf_get_pin(chan, conference_bridge_user.u_profile.pin)) {
+ return -1; /* invalid PIN */
+ }
+ }
+
/* Always initialize the features structure, we are in most cases always going to need it. */
ast_bridge_features_init(&conference_bridge_user.features);
/* menu name */
Modified: team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c?view=diff&rev=310412&r1=310411&r2=310412
==============================================================================
--- team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c (original)
+++ team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c Fri Mar 11 17:00:57 2011
@@ -184,6 +184,7 @@
ao2_lock(u_profile);
/* set defaults */
u_profile->flags = 0;
+ memset(u_profile->pin, 0, sizeof(u_profile->pin));
for (var = ast_variable_browse(cfg, cat); var; var = var->next) {
if (!strcasecmp(var->name, "type")) {
continue;
@@ -219,6 +220,8 @@
u_profile->flags = ast_true(var->value) ?
u_profile->flags | USER_OPT_WAITMARKED :
u_profile->flags & ~USER_OPT_WAITMARKED;
+ } else if (!strcasecmp(var->name, "pin")) {
+ ast_copy_string(u_profile->pin, var->value, sizeof(u_profile->pin));
} else if (!strcasecmp(var->name, "denoise")) {
u_profile->flags = ast_true(var->value) ?
u_profile->flags | USER_OPT_DENOISE :
@@ -467,6 +470,10 @@
ast_cli(a->fd,"Denoise: %s\n",
u_profile.flags & USER_OPT_DENOISE ?
"enabled" : "disabled");
+ ast_cli(a->fd,"PIN: %s\n",
+ ast_strlen_zero(u_profile.pin) ?
+ "None" : u_profile.pin);
+
ast_cli(a->fd,"\n");
return CLI_SUCCESS;
Modified: team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h?view=diff&rev=310412&r1=310411&r2=310412
==============================================================================
--- team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h (original)
+++ team/dvossel/hd_confbridge/apps/confbridge/include/confbridge.h Fri Mar 11 17:00:57 2011
@@ -28,6 +28,8 @@
/* Maximum length of a conference bridge name */
#define MAX_CONF_NAME 32
+/* Maximum length of a conference pin */
+#define MAX_PIN 80
enum user_profile_flags {
USER_OPT_ADMIN = (1 << 0), /*!< Set if the caller is an administrator */
@@ -37,8 +39,8 @@
USER_OPT_MUSICONHOLD = (1 << 4), /*!< Set if music on hold should be played if nobody else is in the conference bridge */
USER_OPT_QUIET = (1 << 5), /*!< Set if no audio prompts should be played */
USER_OPT_ANNOUNCEUSERCOUNT = (1 << 6), /*!< Set if the number of users should be announced to the caller */
- USER_OPT_WAITMARKED = (1 << 7), /*!< Set if the conference must wait for a marked user before starting */
- USER_OPT_DENOISE = (1 << 8), /*!< Sets if denoise filter should be used on audio before mixing. */
+ USER_OPT_WAITMARKED = (1 << 7), /*!< Set if the conference must wait for a marked user before starting */
+ USER_OPT_DENOISE = (1 << 8), /*!< Sets if denoise filter should be used on audio before mixing. */
};
enum conf_menu_action_id {
@@ -86,13 +88,14 @@
* of DTMF sequences coupled with the actions those
* sequences invoke.*/
struct conf_menu {
- char name[64];
+ char name[128];
int delme;
AST_LIST_HEAD_NOLOCK(, conf_menu_entry) entries;
};
struct user_profile {
- char name[64];
+ char name[128];
+ char pin[MAX_PIN];
unsigned int flags;
int delme;
};
Modified: team/dvossel/hd_confbridge/configs/confbridge.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/configs/confbridge.conf.sample?view=diff&rev=310412&r1=310411&r2=310412
==============================================================================
--- team/dvossel/hd_confbridge/configs/confbridge.conf.sample (original)
+++ team/dvossel/hd_confbridge/configs/confbridge.conf.sample Fri Mar 11 17:00:57 2011
@@ -25,6 +25,8 @@
;denoise=yes ; Sets whether or not a denoise filter should be applied
; to the audio before mixing or not. Off by default. Requires
; codec_speex to be built and installed.
+;pin=1234 ; Sets if this user must enter a PIN number before entering
+ ; the conference. The PIN will be prompted for.
[default_bridge]
type=bridge
More information about the asterisk-commits
mailing list