From 2040c4ebe42ed6a222b87f0148c0c08701afc2fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Mon, 7 Jun 2010 14:20:42 +0300 Subject: [PATCH] add 'n' flag to prevent dynamic create of conference --- konference/Dialplan.txt | 2 ++ konference/conference.c | 27 ++++++++++++++++++--------- konference/conference.h | 2 +- konference/member.c | 12 +++++++----- konference/member.h | 3 +++ 5 files changed, 31 insertions(+), 15 deletions(-) diff --git a/konference/Dialplan.txt b/konference/Dialplan.txt index 455703d..17287dd 100644 --- a/konference/Dialplan.txt +++ b/konference/Dialplan.txt @@ -45,6 +45,8 @@ exten => ,,Konference(,,,no_create_flag ) + { + DEBUG("conference not found, and create of new conference not allowed\n") ; + pbx_builtin_setvar_helper(member->chan, "KONFERENCE", "NOTFOUND"); + } + else + { + // create a new conference + DEBUG("attempting to create requested conference\n") ; - // create the new conference with one member - conf = create_conf( member->conf_name, member ) ; + // create the new conference with one member + conf = create_conf( member->conf_name, member ) ; - // return an error if create_conf() failed - if ( conf == NULL ) - ast_log( LOG_ERROR, "unable to find or create requested conference\n" ) ; + // return an error if create_conf() failed + if ( conf == NULL ) { + ast_log( LOG_ERROR, "unable to find or create requested conference\n" ) ; + pbx_builtin_setvar_helper(member->chan, "KONFERENCE", "NORESOURCES"); + } + } } else { @@ -656,7 +666,6 @@ struct ast_conference* join_conference( struct ast_conf_member* member, char* ma add_member( member, conf ) ; } else { pbx_builtin_setvar_helper(member->chan, "KONFERENCE", "MAXUSERS"); - *max_users_flag = 1; conf = NULL; } } diff --git a/konference/conference.h b/konference/conference.h index 3322f3f..e8da836 100644 --- a/konference/conference.h +++ b/konference/conference.h @@ -157,7 +157,7 @@ int hash( const char *channel_name ) ; int count_exec( struct ast_channel* chan, void* data ) ; -struct ast_conference* join_conference( struct ast_conf_member* member, char* max_users_flag, const char* recfile, const char* recformat ) ; +struct ast_conference* join_conference( struct ast_conf_member* member, const char* recfile, const char* recformat ) ; int end_conference( const char *name, int hangup ) ; diff --git a/konference/member.c b/konference/member.c index c18fcdc..ff93b36 100644 --- a/konference/member.c +++ b/konference/member.c @@ -758,14 +758,13 @@ int member_exec( struct ast_channel* chan, void* data ) // setup a conference for the new member // - char max_users_flag = 0 ; - conf = join_conference( member, &max_users_flag, recfile, recformat ) ; + conf = join_conference( member, recfile, recformat ) ; if ( conf == NULL ) { - ast_log( LOG_NOTICE, "unable to setup member conference %s: max_users_flag is %d\n", member->conf_name, max_users_flag ) ; + ast_log( LOG_NOTICE, "unable to setup member conference %s\n", member->conf_name) ; delete_member( member) ; - return (max_users_flag ? 0 : -1 ) ; + return -1; } // @@ -1349,7 +1348,7 @@ struct ast_conf_member* create_member( struct ast_channel *chan, const char* dat else #endif { - // allowed flags are C, c, L, l, V, D, A, C, X, r, R, T, t, M, S, z, o, F, H + // allowed flags are C, c, L, l, V, D, A, C, X, r, R, T, t, M, S, z, o, F, H, n // mute/no_recv options switch ( flags[i] ) { @@ -1405,6 +1404,9 @@ struct ast_conf_member* create_member( struct ast_channel *chan, const char* dat case 'M': member->ismoderator = 1; break; + case 'n': + member->no_create_flag = 1; + break; #ifdef VIDEO case 'N': member->no_camera = 1; diff --git a/konference/member.h b/konference/member.h index 0f9005b..28eff6b 100644 --- a/konference/member.h +++ b/konference/member.h @@ -105,6 +105,9 @@ struct ast_conf_member // wait option flag char wait_for_moderator_flag; + // creation of new conference not allowed + char no_create_flag; + // temp flag for when star is pressed char star_pressed; -- 1.7.0.4