/** * @verb GET * @returns - the conference list * @uri /conferences */ function get_conferences($params) { $conferences = conferences_list(); foreach ($conferences as $conference) { $room = new stdClass(); $room->id = $conference[0]; $room->description = $conference[1]; $list[$conference[0]] = $room; } return $list ? $list : false; }
needreload(); redirect_standard(); break; case "edit": //just delete and re-add conferences_del($account); conferences_add($account, $_REQUEST['name'], $_REQUEST['userpin'], $_REQUEST['adminpin'], $_REQUEST['options'], $_REQUEST['joinmsg_id'], $music, $users); needreload(); redirect_standard('extdisplay'); break; } } //get meetme rooms //this function needs to be available to other modules (those that use goto destinations) //therefore we put it in globalfunctions.php $meetmes = conferences_list(); ?> </div> <!-- right side menu --> <div class="rnav"><ul> <li><a id="<?php echo $extdisplay == '' ? 'current' : ''; ?> " href="config.php?display=<?php echo urlencode($dispnum); ?> "><?php echo _("Add Conference"); ?>
function conferences_get_config($engine) { global $ext; // is this the best way to pass this? global $conferences_conf; global $version; global $amp_conf; switch ($engine) { case "asterisk": $ext->addInclude('from-internal-additional', 'ext-meetme'); $contextname = 'ext-meetme'; if (is_array($conflist = conferences_list())) { $ast_ge_14 = version_compare($version, "1.4", "ge"); // Start the conference if ($ast_ge_14) { $ext->add($contextname, 'STARTMEETME', '', new ext_execif('$["${MEETME_MUSIC}" != ""]', 'Set', 'CHANNEL(musicclass)=${MEETME_MUSIC}')); } else { $ext->add($contextname, 'STARTMEETME', '', new ext_execif('$["${MEETME_MUSIC}" != ""]', 'SetMusicOnHold', '${MEETME_MUSIC}')); } $ext->add($contextname, 'STARTMEETME', '', new ext_setvar('GROUP(meetme)', '${MEETME_ROOMNUM}')); $ext->add($contextname, 'STARTMEETME', '', new ext_gotoif('$[${MAX_PARTICIPANTS} > 0 && ${GROUP_COUNT(${MEETME_ROOMNUM}@meetme)}>${MAX_PARTICIPANTS}]', 'MEETMEFULL,1')); $ext->add($contextname, 'STARTMEETME', '', new ext_meetme('${MEETME_ROOMNUM}', '${MEETME_OPTS}', '${PIN}')); $ext->add($contextname, 'STARTMEETME', '', new ext_hangup('')); //meetme full $ext->add($contextname, 'MEETMEFULL', '', new ext_playback('im-sorry&conf-full&goodbye')); $ext->add($contextname, 'MEETMEFULL', '', new ext_hangup('')); // hangup for whole context $ext->add($contextname, 'h', '', new ext_hangup('')); foreach ($conflist as $item) { $room = conferences_get(ltrim($item['0'])); $roomnum = ltrim($item['0']); $roomoptions = $room['options']; if ($ast_ge_14) { $roomoptions = str_replace('i', 'I', $roomoptions); } if (!$ast_ge_14) { $roomoptions = str_replace('o', '', $roomoptions); $roomoptions = str_replace('T', '', $roomoptions); } $roomuserpin = $room['userpin']; $roomadminpin = $room['adminpin']; $roomusers = $room['users']; if (isset($room['music']) && $room['music'] != '' && $room['music'] != 'inherit') { $music = $room['music']; } else { $music = '${MOHCLASS}'; // inherit channel moh class } if (isset($room['joinmsg_id']) && $room['joinmsg_id'] != '') { $roomjoinmsg = recordings_get_file($room['joinmsg_id']); } else { $roomjoinmsg = ''; } // Add optional hint if ($amp_conf['USEDEVSTATE']) { $ext->addHint($contextname, $roomnum, "MeetMe:" . $roomnum); } // entry point $ext->add($contextname, $roomnum, '', new ext_macro('user-callerid')); $ext->add($contextname, $roomnum, '', new ext_setvar('MEETME_ROOMNUM', $roomnum)); $ext->add($contextname, $roomnum, '', new ext_setvar('MAX_PARTICIPANTS', $roomusers)); $ext->add($contextname, $roomnum, '', new ext_setvar('MEETME_MUSIC', $music)); if (strstr($room['options'], 'r') !== false) { $ext->add($contextname, $roomnum, '', new ext_setvar('MEETME_RECORDINGFILE', '${ASTSPOOLDIR}/monitor/meetme-conf-rec-${MEETME_ROOMNUM}-${UNIQUEID}')); } $ext->add($contextname, $roomnum, '', new ext_gotoif('$["${DIALSTATUS}" = "ANSWER"]', $roomuserpin == '' && $roomadminpin == '' ? 'USER' : 'READPIN')); $ext->add($contextname, $roomnum, '', new ext_answer('')); $ext->add($contextname, $roomnum, '', new ext_wait(1)); // Deal with PINs -- if exist if ($roomuserpin != '' || $roomadminpin != '') { $ext->add($contextname, $roomnum, '', new ext_setvar('PINCOUNT', '0')); $ext->add($contextname, $roomnum, 'READPIN', new ext_read('PIN', 'enter-conf-pin-number')); // userpin -- must do always, otherwise if there is just an adminpin // there would be no way to get to the conference ! $ext->add($contextname, $roomnum, '', new ext_gotoif('$[x${PIN} = x' . $roomuserpin . ']', 'USER')); // admin pin -- exists if ($roomadminpin != '') { $ext->add($contextname, $roomnum, '', new ext_gotoif('$[x${PIN} = x' . $roomadminpin . ']', 'ADMIN')); } // pin invalid $ext->add($contextname, $roomnum, '', new ext_setvar('PINCOUNT', '$[${PINCOUNT}+1]')); $ext->add($contextname, $roomnum, '', new ext_gotoif('$[${PINCOUNT}>3]', "h")); $ext->add($contextname, $roomnum, '', new ext_playback('conf-invalidpin')); $ext->add($contextname, $roomnum, '', new ext_goto('READPIN')); // admin mode -- only valid if there is an admin pin if ($roomadminpin != '') { $ext->add($contextname, $roomnum, 'ADMIN', new ext_setvar('MEETME_OPTS', 'aA' . $roomoptions)); if ($roomjoinmsg != '') { // play joining message if one defined $ext->add($contextname, $roomnum, '', new ext_playback($roomjoinmsg)); } $ext->add($contextname, $roomnum, '', new ext_goto('STARTMEETME,1')); } } // user mode $ext->add($contextname, $roomnum, 'USER', new ext_setvar('MEETME_OPTS', $roomoptions)); if ($roomjoinmsg != '') { // play joining message if one defined $ext->add($contextname, $roomnum, '', new ext_playback($roomjoinmsg)); } $ext->add($contextname, $roomnum, '', new ext_goto('STARTMEETME,1')); // add meetme config $conferences_conf->addMeetme($room['exten'], $room['userpin'], $room['adminpin']); } } break; } }
<?php if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } // License for all code of this FreePBX module can be found in the license file inside the module directory // Copyright 2015 Sangoma Technologies. // $confs = conferences_list(); foreach ($confs as $conf) { $crows .= '<tr>'; $crows .= '<td>'; $crows .= $conf[0]; $crows .= '</td>'; $crows .= '<td>'; $crows .= $conf[1]; $crows .= '</td>'; $crows .= '</tr>'; } ?> <div id="toolbar-all-side"> <a href="config.php?display=conferences" class="btn"><i class="fa fa-list"></i> <?php echo _("List Conferences"); ?> </a> <a class="btn btn-primary" href="config.php?display=conferences&view=form"><i class="fa fa-plus"></i> <?php echo _("Add"); ?> </a> </div> <table id="conferences-side" data-toolbar="#toolbar-all-side" data-search="true" data-toggle="table" class="table">
function conferences_get_config($engine) { global $ext, $conferences_conf, $version, $amp_conf, $astman; $ast_ge_162 = version_compare($version, '1.6.2', 'ge'); $ast_ge_10 = version_compare($version, '10', 'ge'); switch ($engine) { case "asterisk": $ext->addInclude('from-internal-additional', 'ext-meetme'); $contextname = 'ext-meetme'; if ($conflist = conferences_list()) { // Start the conference if ($amp_conf['ASTCONFAPP'] == 'app_confbridge' && $ast_ge_10) { $ext->add($contextname, 'STARTMEETME', '', new ext_execif('$["${MEETME_MUSIC}" != ""]', 'Set', 'CONFBRIDGE(user,music_on_hold_class)=${MEETME_MUSIC}')); } //Always reset the musicclass for the channel because inbound routes might have previously set one, or whereever we came from before //http://issues.freepbx.org/browse/FREEPBX-8782 $ext->add($contextname, 'STARTMEETME', '', new ext_execif('$["${MEETME_MUSIC}" != ""]', 'Set', 'CHANNEL(musicclass)=${MEETME_MUSIC}')); $ext->add($contextname, 'STARTMEETME', '', new ext_setvar('GROUP(meetme)', '${MEETME_ROOMNUM}')); $ext->add($contextname, 'STARTMEETME', '', new ext_gotoif('$[${MAX_PARTICIPANTS} > 0 && ${GROUP_COUNT(${MEETME_ROOMNUM}@meetme)}>${MAX_PARTICIPANTS}]', 'MEETMEFULL,1')); // No harm done if quietmode, these will just then be ignored // if ($amp_conf['ASTCONFAPP'] == 'app_confbridge' && !$ast_ge_10) { $ext->add($contextname, 'STARTMEETME', '', new ext_set('CONFBRIDGE_JOIN_SOUND', 'beep')); $ext->add($contextname, 'STARTMEETME', '', new ext_set('CONFBRIDGE_LEAVE_SOUND', 'beeperr')); } if ($amp_conf['ASTCONFAPP'] == 'app_confbridge' && $ast_ge_10) { $ext->add($contextname, 'STARTMEETME', '', new ext_meetme('${MEETME_ROOMNUM}', ',', '${MENU_PROFILE}')); } else { $ext->add($contextname, 'STARTMEETME', '', new ext_meetme('${MEETME_ROOMNUM}', '${MEETME_OPTS}', '${PIN}')); } $ext->add($contextname, 'STARTMEETME', '', new ext_hangup('')); //meetme full $ext->add($contextname, 'MEETMEFULL', '', new ext_playback('im-sorry&conf-full&goodbye')); $ext->add($contextname, 'MEETMEFULL', '', new ext_hangup('')); // hangup for whole context $ext->add($contextname, 'h', '', new ext_hangup('')); foreach ($conflist as $item) { $room = conferences_get(ltrim($item['0'])); $roomnum = ltrim($item['0']); $roomoptions = $room['options']; $roomusers = $room['users']; $roomuserpin = $room['userpin']; $roomadminpin = $room['adminpin']; // Add optional hint if ($amp_conf['USEDEVSTATE']) { $hint_pre = $amp_conf['ASTCONFAPP'] == 'app_meetme' ? 'MeetMe' : 'confbridge'; $ext->addHint($contextname, $roomnum, $hint_pre . ":" . $roomnum); $hints[] = $hint_pre . ":" . $roomnum; } // entry point $ext->add($contextname, $roomnum, '', new ext_macro('user-callerid')); $ext->add($contextname, $roomnum, '', new ext_setvar('MEETME_ROOMNUM', $roomnum)); $ext->add($contextname, $roomnum, '', new ext_setvar('MAX_PARTICIPANTS', '0')); $ext->add($contextname, $roomnum, '', new ext_setvar('MEETME_MUSIC', '${MOHCLASS}')); $ext->add($contextname, $roomnum, '', new ext_execif('$["${DB(CONFERENCE/' . $roomnum . '/users)}" != ""]', 'Set', 'MAX_PARTICIPANTS=${DB(CONFERENCE/' . $roomnum . '/users)}')); $ext->add($contextname, $roomnum, '', new ext_execif('$["${DB(CONFERENCE/' . $roomnum . '/music)}" != "inherit" & "${DB(CONFERENCE/' . $roomnum . '/music)}" != ""]', 'Set', 'MEETME_MUSIC=${DB(CONFERENCE/' . $roomnum . '/music)}')); $ext->add($contextname, $roomnum, '', new ext_gotoif('$["${DIALSTATUS}" = "ANSWER"]', 'ANSWERED')); $ext->add($contextname, $roomnum, '', new ext_answer('')); $ext->add($contextname, $roomnum, '', new ext_wait(1)); //Check if a pin exists $ext->add($contextname, $roomnum, 'ANSWERED', new ext_gotoif('$["${DB(CONFERENCE/' . $roomnum . '/userpin)}" = "" & "${DB(CONFERENCE/' . $roomnum . '/adminpin)}" = ""]', 'USER', 'CHECKPIN')); // Deal with PINs -- if exist //First check to see if the PIN variable has already been set (through a call file per say) $ext->add($contextname, $roomnum, 'CHECKPIN', new ext_gotoif('$["${PIN}" = ""]', "READPIN")); //Are user pin and admin pin both blank? Ok then they area user $ext->add($contextname, $roomnum, '', new ext_gotoif('$["${DB(CONFERENCE/' . $roomnum . '/userpin)}" = "" & "${DB(CONFERENCE/' . $roomnum . '/adminpin)}" = ""]', 'USER')); //Check if user $ext->add($contextname, $roomnum, '', new ext_gotoif('$["${DB(CONFERENCE/' . $roomnum . '/userpin)}" != "" & "${PIN}" = "${DB(CONFERENCE/' . $roomnum . '/userpin)}"]', 'USER')); //Check if admin $ext->add($contextname, $roomnum, '', new ext_gotoif('$["${DB(CONFERENCE/' . $roomnum . '/adminpin)}" != "" & "${PIN}" = "${DB(CONFERENCE/' . $roomnum . '/adminpin)}"]', 'ADMIN')); //No pins set so ask the user now $ext->add($contextname, $roomnum, 'READPIN', new ext_setvar('PINCOUNT', '0')); $ext->add($contextname, $roomnum, 'RETRYPIN', new ext_read('PIN', 'enter-conf-pin-number')); // userpin -- must do always, otherwise if there is just an adminpin // there would be no way to get to the conference ! $ext->add($contextname, $roomnum, '', new ext_gotoif('$["${DB(CONFERENCE/' . $roomnum . '/userpin)}" != "" & "${PIN}" = "${DB(CONFERENCE/' . $roomnum . '/userpin)}"]', 'USER')); // admin pin -- exists $ext->add($contextname, $roomnum, '', new ext_gotoif('$["${DB(CONFERENCE/' . $roomnum . '/adminpin)}" != "" & "${PIN}" = "${DB(CONFERENCE/' . $roomnum . '/adminpin)}"]', 'ADMIN')); //fall back if no pin exists on this room they are a user $ext->add($contextname, $roomnum, '', new ext_gotoif('$["${DB(CONFERENCE/' . $roomnum . '/userpin)}" = ""]', 'USER')); // pin invalid $ext->add($contextname, $roomnum, '', new ext_setvar('PINCOUNT', '$[${PINCOUNT}+1]')); $ext->add($contextname, $roomnum, '', new ext_gotoif('$[${PINCOUNT}>3]', "h,1")); $ext->add($contextname, $roomnum, '', new ext_playback('conf-invalidpin')); $ext->add($contextname, $roomnum, '', new ext_goto('RETRYPIN')); $subconfcontext = 'sub-conference-options'; // admin mode -- only valid if there is an admin pin $ext->add($contextname, $roomnum, 'ADMIN', new ext_gosub('1', 's', $subconfcontext, $roomnum . ',ADMIN')); $ext->add($contextname, $roomnum, '', new ext_gosub('1', 's', 'sub-record-check', "conf,{$roomnum}," . (strstr($room['options'], 'r') !== false ? 'always' : 'never'))); $ext->add($contextname, $roomnum, '', new ext_execif('$["${DB(CONFERENCE/' . $roomnum . '/joinmsg)}" != ""]', 'Playback', '${DB(CONFERENCE/' . $roomnum . '/joinmsg)}')); $ext->add($contextname, $roomnum, '', new ext_goto('STARTMEETME,1')); //end pin checking // user mode $ext->add($contextname, $roomnum, 'USER', new ext_gosub('1', 's', $subconfcontext, $roomnum . ',USER')); $ext->add($contextname, $roomnum, '', new ext_gosub('1', 's', 'sub-record-check', "conf,{$roomnum}," . (strstr($room['options'], 'r') !== false ? 'always' : 'never'))); $ext->add($contextname, $roomnum, '', new ext_execif('$["${DB(CONFERENCE/' . $roomnum . '/joinmsg)}" != ""]', 'Playback', '${DB(CONFERENCE/' . $roomnum . '/joinmsg)}')); $ext->add($contextname, $roomnum, '', new ext_goto('STARTMEETME,1')); // add meetme config if ($amp_conf['ASTCONFAPP'] == 'app_meetme') { $conferences_conf->addMeetme($room['exten'], $room['userpin'], $room['adminpin']); } } $fcc = new featurecode('conferences', 'conf_status'); $conf_code = $fcc->getCodeActive(); unset($fcc); if ($conf_code != '') { $ext->add($contextname, $conf_code, '', new ext_hangup('')); if ($amp_conf['USEDEVSTATE']) { $ext->addHint($contextname, $conf_code, implode('&', $hints)); } } $subconfcontext = 'sub-conference-options'; $ext->add($subconfcontext, 's', '', new ext_noop('Setting options for Conference ${ARG1}')); // $ext->add($subconfcontext, 's', '', new ext_execif('$["${DB(CONFERENCE/${ARG1}/language)}" == ""]', 'Set', 'CONFBRIDGE(bridge,language)=${CHANNEL(language)}', 'Set', 'CONFBRIDGE(bridge,language)=${DB(CONFERENCE/${ARG1}/language)}')); $ext->add($subconfcontext, 's', '', new ext_goto('${ARG2}')); if ($amp_conf['ASTCONFAPP'] == 'app_confbridge' && $ast_ge_10) { //w $ext->add($subconfcontext, 's', 'USER', new ext_execif('${REGEX("w" ${DB(CONFERENCE/${ARG1}/options)})}', 'Set', 'CONFBRIDGE(user,wait_marked)=yes')); $ext->add($subconfcontext, 's', '', new ext_execif('${REGEX("x" ${DB(CONFERENCE/${ARG1}/options)})}', 'Set', 'CONFBRIDGE(user,end_marked)=yes')); //s $ext->add($subconfcontext, 's', '', new ext_execif('${REGEX("s" ${DB(CONFERENCE/${ARG1}/options)})}', 'Set', 'MENU_PROFILE=user_menu')); //m $ext->add($subconfcontext, 's', '', new ext_execif('${REGEX("m" ${DB(CONFERENCE/${ARG1}/options)})}', 'Set', 'CONFBRIDGE(user,startmuted)=yes')); $ext->add($subconfcontext, 's', '', new ext_goto('RETURN')); $ext->add($subconfcontext, 's', 'ADMIN', new ext_setvar('CONFBRIDGE(user,admin)', 'yes')); $ext->add($subconfcontext, 's', '', new ext_setvar('CONFBRIDGE(user,marked)', 'yes')); //s $ext->add($subconfcontext, 's', '', new ext_execif('${REGEX("s" ${DB(CONFERENCE/${ARG1}/options)})}', 'Set', 'MENU_PROFILE=admin_menu')); $ext->add($subconfcontext, 's', '', new ext_goto('RETURN')); } else { $ext->add($subconfcontext, 's', 'USER', new ext_noop('meetme user')); $ext->add($subconfcontext, 's', '', new ext_setvar('MEETME_OPTS', '${DB(CONFERENCE/${ARG1}/options)}')); $ext->add($subconfcontext, 's', '', new ext_goto('RETURN')); $ext->add($subconfcontext, 's', 'ADMIN', new ext_noop('meetme admin')); $ext->add($subconfcontext, 's', '', new ext_setvar('MEETME_OPTS', 'aA${DB(CONFERENCE/${ARG1}/options)}')); $ext->add($subconfcontext, 's', '', new ext_setvar('MEETME_OPTS', '${REPLACE(MEETME_OPTS,"m","")}')); $ext->add($subconfcontext, 's', '', new ext_goto('RETURN')); } if ($amp_conf['ASTCONFAPP'] == 'app_confbridge' && $ast_ge_10) { $ext->add($subconfcontext, 's', 'RETURN', new ext_noop('Setting Additional Options:')); //q $ext->add($subconfcontext, 's', '', new ext_execif('${REGEX("q" ${DB(CONFERENCE/${ARG1}/options)})}', 'Set', 'CONFBRIDGE(user,quiet)=yes')); //c $ext->add($subconfcontext, 's', '', new ext_execif('${REGEX("c" ${DB(CONFERENCE/${ARG1}/options)})}', 'Set', 'CONFBRIDGE(user,announce_user_count)=yes')); //I $ext->add($subconfcontext, 's', '', new ext_execif('${REGEX("I" ${DB(CONFERENCE/${ARG1}/options)})}', 'Set', 'CONFBRIDGE(user,announce_join_leave)=yes')); //o $ext->add($subconfcontext, 's', '', new ext_execif('${REGEX("o" ${DB(CONFERENCE/${ARG1}/options)})}', 'Set', 'CONFBRIDGE(user,dsp_drop_silence)=yes')); //T $ext->add($subconfcontext, 's', '', new ext_execif('${REGEX("T" ${DB(CONFERENCE/${ARG1}/options)})}', 'Set', 'CONFBRIDGE(user,talk_detection_events)=yes')); //M $ext->add($subconfcontext, 's', '', new ext_execif('${REGEX("M" ${DB(CONFERENCE/${ARG1}/options)})}', 'Set', 'CONFBRIDGE(user,music_on_hold_when_empty)=yes')); $ext->add($subconfcontext, 's', '', new ext_return()); } else { $ext->add($subconfcontext, 's', 'RETURN', new ext_return()); } } break; } }