<item url="config/" uploadstatus="1" />
<item modified_time="1120073766" url="config/conf.xml" uploadstatus="1" />
<item url="dialplan/" uploadstatus="1" />
- <item modified_time="1121689003" url="dialplan/edit.php" uploadstatus="1" />
+ <item modified_time="1130716381" url="dialplan/edit.php" uploadstatus="1" />
<item url="lib/" uploadstatus="1" />
<item url="lib/Driver/" uploadstatus="1" />
- <item modified_time="1126200076" url="lib/Driver/ldap.php" uploadstatus="1" />
- <item modified_time="1120648387" url="lib/base.php" uploadstatus="1" />
+ <item modified_time="1130709096" url="lib/Driver/ldap.php" uploadstatus="1" />
+ <item modified_time="1130704853" url="lib/base.php" uploadstatus="1" />
<item modified_time="1121689003" url="lib/Dialplan.php" uploadstatus="1" />
- <item modified_time="1120815592" url="lib/Driver.php" uploadstatus="1" />
- <item modified_time="1129871131" url="lib/Shout.php" uploadstatus="1" />
+ <item modified_time="1130705377" url="lib/Driver.php" uploadstatus="1" />
+ <item modified_time="1130703542" url="lib/Shout.php" uploadstatus="1" />
<item modified_time="1121689003" url="lib/System.php" uploadstatus="1" />
- <item modified_time="1122529264" url="lib/User.php" uploadstatus="1" />
+ <item modified_time="1130724077" url="lib/User.php" uploadstatus="1" />
<item url="main/" uploadstatus="1" />
<item modified_time="1121689003" url="main/dialplan.php" uploadstatus="1" />
<item modified_time="1121401845" url="main/moh.php" uploadstatus="1" />
- <item modified_time="1121401845" url="main/system.php" uploadstatus="1" />
+ <item modified_time="1130716385" url="main/system.php" uploadstatus="1" />
<item modified_time="1121689003" url="main/users.php" uploadstatus="1" />
<item url="templates/" uploadstatus="1" />
<item url="templates/context/" uploadstatus="1" />
<item url="users/" uploadstatus="1" />
<item modified_time="1122704539" url="users/add.php" uploadstatus="1" />
<item modified_time="1122704539" url="users/delete.php" uploadstatus="1" />
- <item modified_time="1121834514" url="users/edit.php" uploadstatus="1" />
- <item modified_time="1122529264" url="users/save.php" uploadstatus="1" />
+ <item modified_time="1130716394" url="users/edit.php" uploadstatus="1" />
+ <item modified_time="1130716388" url="users/save.php" uploadstatus="1" />
<item modified_time="1121689003" url="dialplan.php" uploadstatus="1" />
- <item modified_time="1129871121" url="index.php" uploadstatus="1" />
+ <item modified_time="1121689003" url="index.php" uploadstatus="1" />
<item modified_time="1122704475" url="users.php" uploadstatus="1" />
<item url="" uploadstatus="1" />
<uploadprofiles showtreeviews="true" defaultProfile="Shout" >
<profile remote_host="" remote_port="" remote_path="" remote_protocol="ftp" user="" name="@" />
- <profile remote_host="picasso.v-office.biz" remote_port="22" remote_path="/srv/vhost/users/alkaloid/sites/intranet.v-office.biz/shout" remote_protocol="sftp" user="aklang" name="Shout" >
+ <profile remote_host="picasso.v-office.biz" remote_port="22" remote_path="/srv/vhost/users/alkaloid/sites/intranet.v-office.biz/shout" remote_protocol="sftp" user="alkaloid" name="Shout" >
<uploadeditem upload_time="0" url="config/" />
<uploadeditem upload_time="1120073766" url="config/conf.xml" />
<uploadeditem upload_time="1121689003" url="dialplan.php" />
<uploadeditem upload_time="0" url="dialplan/" />
- <uploadeditem upload_time="1121689003" url="dialplan/edit.php" />
- <uploadeditem upload_time="1129871121" url="index.php" />
+ <uploadeditem upload_time="1130716381" url="dialplan/edit.php" />
+ <uploadeditem upload_time="1121689003" url="index.php" />
<uploadeditem upload_time="0" url="lib/" />
<uploadeditem upload_time="1121689003" url="lib/Dialplan.php" />
- <uploadeditem upload_time="1120815592" url="lib/Driver.php" />
+ <uploadeditem upload_time="1130705377" url="lib/Driver.php" />
<uploadeditem upload_time="0" url="lib/Driver/" />
- <uploadeditem upload_time="1126200076" url="lib/Driver/ldap.php" />
- <uploadeditem upload_time="1129871131" url="lib/Shout.php" />
+ <uploadeditem upload_time="1130709096" url="lib/Driver/ldap.php" />
+ <uploadeditem upload_time="1130703542" url="lib/Shout.php" />
<uploadeditem upload_time="1121689003" url="lib/System.php" />
- <uploadeditem upload_time="1122529264" url="lib/User.php" />
- <uploadeditem upload_time="1120648387" url="lib/base.php" />
+ <uploadeditem upload_time="1130724077" url="lib/User.php" />
+ <uploadeditem upload_time="1130705457" url="lib/api.php" />
+ <uploadeditem upload_time="1130704853" url="lib/base.php" />
+ <uploadeditem upload_time="1130706300" url="lib/defines.php" />
<uploadeditem upload_time="0" url="main/" />
<uploadeditem upload_time="1121689003" url="main/dialplan.php" />
<uploadeditem upload_time="1121401845" url="main/moh.php" />
- <uploadeditem upload_time="1121401845" url="main/system.php" />
+ <uploadeditem upload_time="1130716385" url="main/system.php" />
<uploadeditem upload_time="1121689003" url="main/users.php" />
<uploadeditem upload_time="0" url="templates/" />
<uploadeditem upload_time="1120174958" url="templates/common-header.inc" />
<uploadeditem upload_time="0" url="users/" />
<uploadeditem upload_time="1122704539" url="users/add.php" />
<uploadeditem upload_time="1122704539" url="users/delete.php" />
- <uploadeditem upload_time="1121834514" url="users/edit.php" />
- <uploadeditem upload_time="1122529264" url="users/save.php" />
+ <uploadeditem upload_time="1130716394" url="users/edit.php" />
+ <uploadeditem upload_time="1130716388" url="users/save.php" />
</profile>
</uploadprofiles>
<templates>templates/</templates>
<toolbars>toolbars/</toolbars>
+ <item modified_time="1130705457" url="lib/api.php" uploadstatus="1" />
<author>Ben Klang</author>
<email>ben@alkaloid.net</email>
<debuggerclient>No Debugger</debuggerclient>
- <exclude cvsignore="false" >*~;</exclude>
+ <exclude cvsignore="true" >*~;CVS;.*~;</exclude>
<teamdata>
<taskleaders/>
<subprojectleaders/>
<mailinglist address="" />
</teamdata>
<events/>
+ <item modified_time="1130706300" url="lib/defines.php" />
<treestatus>
+ <openfolder url="config" />
<openfolder url="dialplan" />
<openfolder url="lib" />
<openfolder url="lib/Driver" />
+ <openfolder url="main" />
+ <openfolder url="users" />
</treestatus>
</project>
</webproject>
* @var boolean $_connected
*/
var $_connected = false;
+
// }}}
// {{{ Shout_Driver_ldap constructor
{
parent::Shout_Driver($params);
$this->_connect();
-
- /* These next lines will translate between indexes used in the
- * application and LDAP. The rationale is that translation here will
- * help make Shout more driver-independant. The keys used to contruct
- * user arrays should be more appropriate to human-legibility (name
- * instead of 'cn' and email instead of 'mail'). This translation is
- * only needed because LDAP indexes users based on an arbitrary
- * attribute and the application indexes by extension/context. In my
- * environment users are indexed by their 'mail' attribute and others
- * may index based on 'cn' or 'uid'. Any time a new $prefs['uid'] needs
- * to be supported, this function should be checked and possibly
- * modified to handle that translation.
- */
- switch($this->_params['uid']) {
- case 'cn':
- $this->_ldapKey = 'cn';
- $this->_appKey = 'name';
- break;
- case 'mail':
- $this->_ldapKey = 'mail';
- $this->_appKey = 'email';
- break;
- case 'uid':
- # There is no value that maps uid to LDAP so we can choose to use
- # either extension or name, or anything really. I want to
- # support it since it's a very common DN attribute.
- # Since it's entirely administrator's preference, I'll
- # set it to name for now
- $this->_ldapKey = 'uid';
- $this->_appKey = 'name';
- break;
- case 'voiceMailbox':
- $this->_ldapKey = 'voiceMailbox';
- $this->_appKey = 'extension';
- break;
- }
}
// }}}
$searchfilter="(objectClass=asteriskObject)";
} else {
$searchfilter = "(|";
+ # FIXME Change this to non-V-Office specific objectClass
if ($searchfilters & SHOUT_CONTEXT_CUSTOMERS) {
$searchfilter.="(objectClass=vofficeCustomer)";
} else {
$searchfilter .= ")";
}
-
# Collect all the possible contexts from the backend
$res = @ldap_search($this->_LDAP,
SHOUT_ASTERISK_BRANCH.','.$this->_params['basedn'],
- "(&(objectClass=asteriskObject)$searchfilter)",
- array('context'));
+ "$searchfilter");
+ #array('context', 'associatedDomain'));
if (!$res) {
return PEAR::raiseError("Unable to locate any contexts " .
"underneath ".SHOUT_ASTERISK_BRANCH.",".$this->_params['basedn'] .
- " matching those search filters");
+ " matching those search filters" . ldap_error($this->_LDAP));
}
$res = ldap_get_entries($this->_LDAP, $res);
$entries[$searchfilters] = array();
while ($i < $res['count']) {
$context = $res[$i]['context'][0];
+ @$domain = $res[$i]['associateddomain'][0];
if (Shout::checkRights("shout:contexts:$context", $filterperms)) {
- $entries[$searchfilters][] = $context;
+ $entries[$searchfilters][$context] =
+ array('domain' => $domain);
}
$i++;
}
*/
function &getUsers($context)
{
-
+
static $entries = array();
if (isset($entries[$context])) {
return $entries[$context];
}
-
- $search = @ldap_search($this->_LDAP,
- SHOUT_USERS_BRANCH.','.$this->_params['basedn'],
- '(&(objectClass='.SHOUT_USER_OBJECTCLASS.')(context='.$context.'))',
- array('voiceMailbox', 'asteriskUserDialOptions',
- 'asteriskVoiceMailboxOptions', 'voiceMailboxPin',
- 'cn', 'telephoneNumber',
- 'asteriskUserDialTimeout', 'mail', 'asteriskPager'));
- if (!$search) {
- return PEAR::raiseError("Unable to search directory: " .
- ldap_error($this->_LDAP));
- }
- $res = ldap_get_entries($this->_LDAP, $search);
- $entries[$context] = array();
- $i = 0;
- while ($i < $res['count']) {
- $extension = $res[$i]['voicemailbox'][0];
- $entries[$context][$extension] = array();
-
- $j = 0;
- $entries[$context][$extension]['dialopts'] = array();
- while ($j < @$res[$i]['asteriskuserdialoptions']['count']) {
- $entries[$context][$extension]['dialopts'][] =
- $res[$i]['asteriskuserdialoptions'][$j];
- $j++;
- }
-
- $j = 0;
- $entries[$context][$extension]['mailboxopts'] = array();
- while ($j < @$res[$i]['asteriskvoicemailboxoptions']['count']) {
- $entries[$context][$extension]['mailboxopts'][] =
- $res[$i]['asteriskvoicemailboxoptions'][$j];
- $j++;
- }
-
- $entries[$context][$extension]['mailboxpin'] =
- $res[$i]['voicemailboxpin'][0];
-
- @$entries[$context][$extension]['name'] =
- $res[$i]['cn'][0];
-
- $j = 0;
- $entries[$context][$extension]['phonenumbers'] = array();
- while ($j < @$res[$i]['telephonenumber']['count']) {
- $entries[$context][$extension]['phonenumbers'][] =
- $res[$i]['telephonenumber'][$j];
- $j++;
- }
-
- # FIXME Do some sanity checking here. Also set a default?
- @$entries[$context][$extension]['dialtimeout'] =
- $res[$i]['asteriskuserdialtimeout'][0];
- @$entries[$context][$extension]['email'] =
- $res[$i]['mail'][0];
-
- @$entries[$context][$extension]['pageremail'] =
- $res[$i]['asteriskpager'][0];
-
- $i++;
- }
-
- return $entries[$context];
+ $contexts = &$this->getContexts();
+ $domain = $contexts[$context]['domain'];
+
+ $registry = &Registry::singleton();
+ require_once $registry->applicationFilePath('%application%/lib/defines.php', 'congregation');
+ $users = $registry->callByPackage('congregation', 'getUsersByDomain',
+ array($domain, CONGREGATION_USER_PHONE));
+
+ foreach ($users as $user) {
+ $extension = $user['extension'];
+ $entries[$context][$extension] = $user;
+ }
+ ksort($entries[$context]);
+
+ return($entries[$context]);
+
+// $search = @ldap_search($this->_LDAP,
+// SHOUT_USERS_BRANCH.','.$this->_params['basedn'],
+//'(&(objectClass='.SHOUT_USER_OBJECTCLASS.')(context='.$context.'))',
+// array('voiceMailbox', 'asteriskUserDialOptions',
+// 'asteriskVoiceMailboxOptions', 'voiceMailboxPin',
+// 'cn', 'telephoneNumber',
+// 'asteriskUserDialTimeout', 'mail', 'asteriskPager'));
+// if (!$search) {
+// return PEAR::raiseError("Unable to search directory: " .
+// ldap_error($this->_LDAP));
+// }
+// $res = ldap_get_entries($this->_LDAP, $search);
+// $entries[$context] = array();
+// $i = 0;
+// while ($i < $res['count']) {
+// $extension = $res[$i]['voicemailbox'][0];
+// $entries[$context][$extension] = array();
+//
+// $j = 0;
+// $entries[$context][$extension]['dialopts'] = array();
+// while ($j < @$res[$i]['asteriskuserdialoptions']['count']) {
+// $entries[$context][$extension]['dialopts'][] =
+// $res[$i]['asteriskuserdialoptions'][$j];
+// $j++;
+// }
+//
+// $j = 0;
+// $entries[$context][$extension]['mailboxopts'] = array();
+// while ($j < @$res[$i]['asteriskvoicemailboxoptions']['count']) {
+// $entries[$context][$extension]['mailboxopts'][] =
+// $res[$i]['asteriskvoicemailboxoptions'][$j];
+// $j++;
+// }
+//
+// $entries[$context][$extension]['mailboxpin'] =
+// $res[$i]['voicemailboxpin'][0];
+//
+// @$entries[$context][$extension]['name'] =
+// $res[$i]['cn'][0];
+//
+// $j = 0;
+// $entries[$context][$extension]['phonenumbers'] = array();
+// while ($j < @$res[$i]['telephonenumber']['count']) {
+// $entries[$context][$extension]['phonenumbers'][] =
+// $res[$i]['telephonenumber'][$j];
+// $j++;
+// }
+//
+// # FIXME Do some sanity checking here. Also set a default?
+// @$entries[$context][$extension]['dialtimeout'] =
+// $res[$i]['asteriskuserdialtimeout'][0];
+//
+// @$entries[$context][$extension]['email'] =
+// $res[$i]['mail'][0];
+//
+// @$entries[$context][$extension]['pageremail'] =
+// $res[$i]['asteriskpager'][0];
+//
+// $i++;
+// }
+//
+// return $entries[$context];
}
// }}}
*/
function getHomeContext()
{
+ # FIXME Probably should key this off the domain part of the user's
+ # FIXME Auth::getAuth() and match context with associatedDomain
+ # FIXME Also, cache this lookup
$res = @ldap_search($this->_LDAP,
SHOUT_USERS_BRANCH.','.$this->_params['basedn'],
"(&(mail=".Auth::getAuth().")(objectClass=asteriskUser))",
if (isset($dialplans[$context])) {
return $dialplans[$context];
}
-
+
$res = @ldap_search($this->_LDAP,
SHOUT_ASTERISK_BRANCH.','.$this->_params['basedn'],
"(&(objectClass=asteriskExtensions)(context=$context))",
return $dialplans[$context];
}
// }}}
-
+
// {{{
/**
* Get the limits for the current user, the user's context, and global
* Return the most specific values in every case. Return default values
- * where no data is found. If $extension is specified, $context must
+ * where no data is found. If $extension is specified, $context must
* also be specified.
*
* @param optional string $context Context to search
*
* @return array Array with elements indicating various limits
*/
+ # FIXME Figure out how this fits into Shout/Congregation better
function &getLimits($context = null, $extension = null)
{
-
+
$limits = array('telephonenumbersmax',
'voicemailboxesmax',
'asteriskusers');
}
return $limits[$context];
}
-
+
# Set some default limits (to unlimited)
static $cachedlimits = array();
# Initialize the limits with defaults
$cachedlimits[$limit] = 99999;
}
}
-
+
# Collect the global limits
$res = @ldap_search($this->_LDAP,
SHOUT_ASTERISK_BRANCH.','.$this->_params['basedn'],
'(&(objectClass=asteriskLimits)(cn=globals))',
$limits);
-
+
if (!$res) {
return PEAR::raiseError('Unable to search the LDAP server for ' .
'global limits');
}
-
+
$res = ldap_get_entries($this->_LDAP, $res);
# There should only have been one object returned so we'll just take the
# first result returned
$cachedlimits[$limit] = $res[0][$limit][0];
}
}
- } else {
+ } else {
return PEAR::raiseError("No global object found.");
}
$res = ldap_search($this->_LDAP,
SHOUT_ASTERISK_BRANCH.','.$this->_params['basedn'],
"(&(objectClass=asteriskLimits)(cn=$context))");
-
+
if (!$res) {
return PEAR::raiseError('Unable to search the LDAP server ' .
"for $context specific limits");
}
-
+
$cachedlimits[$context][$extension] = array();
if ($res['count'] > 0) {
foreach ($limits as $limit) {
$cachedlimits[$limit];
}
}
-
+
if (isset($extension)) {
$res = @ldap_search($this->_LDAP,
SHOUT_USERS_BRANCH.','.$this->_params['basedn'],
"(&(objectClass=asteriskLimits)(voiceMailbox=$extension)".
"(context=$context))");
-
+
if (!$res) {
return PEAR::raiseError('Unable to search the LDAP server '.
"for Extension $extension, $context specific limits");
}
-
+
$cachedlimits[$context][$extension] = array();
if ($res['count'] > 0) {
foreach ($limits as $limit) {
}
}
// }}}
-
+
// {{{
/**
* Save a user to the LDAP tree
*/
function saveUser($context, $extension, $userdetails)
{
- # FIXME: Add test to make sure we aren't duplicating the extension
- $res = ldap_search($this->_LDAP, SHOUT_USERS_BRANCH.','.$this->_params['basedn'],
- "(&(objectClass=asteriskUser)(voiceMailbox=".
- $userdetails['newextension']."))");
- $res = ldap_get_entries($this->_LDAP, $res);
- if ($res['count'] > 0) {
- # The extension already exists. Do some sanity checking to make
- # sure we know we're modifying an existing user
- # FIXME
- }
-
# FIXME Access Control/Authorization
if (!Shout::checkRights("shout:contexts:$context:users",
PERMS_DELETE, 1)) {
}
$ldapKey = &$this->_ldapKey;
$appKey = &$this->_appKey;
-
+
+ $contexts = &$this->getContexts();
+ $domain = $contexts[$context]['domain'];
+
+ # Check to ensure the extension is unique within this context
+ $filter = '(&(objectClass=asteriskVoiceMailbox)(context='.$context.'))';
+ $reqattrs = array('dn', $ldapKey);
+ $res = @ldap_search($this->_LDAP,
+ SHOUT_USERS_BRANCH . ',' . $this->_params['basedn'],
+ $filter, $reqattrs);
+ if (!$res) {
+ return PEAR::raiseError('Unable to check directory for duplicate extension: ' .
+ ldap_error($this->_LDAP));
+ }
+ if (($res['count'] > 1) ||
+ ($res['count'] != 0 &&
+ !in_array($res[0][$ldapKey], $userdetails[$appKey])_) {
+ return PEAR::raiseError('Duplicate extension found. Not saving changes.');
+ }
+
+ $validusers = &$this->getUsers($context);
+ $userId = $validusers[$extension][$appKey];
+
+ $registry = &Registry::singleton();
+ require_once $registry->applicationFilePath('%application%/lib/defines.php', 'congregation');
+ $userModes = $registry->callByPackage('congregation', 'getUserModes',
+ array($domain, $userId));
+ # FIXME Handle error here
+
+ $registry->callByPackage('congregation', 'saveUser',
+ array($domain, $userId, $userModes | CONGREGATION_USER_PHONE, ));
+
$entry = array(
'cn' => $userdetails['name'],
'mail' => $userdetails['email'],
'context' => $context,
'asteriskUserDialOptions' => $userdetails['dialopts'],
);
-
+
if (!empty ($userdetails['telephonenumbers'])) {
$entry['telephoneNumber'] = $userdetails['telephonenumbers'];
}
-
+
$validusers = &$this->getUsers($context);
if (!isset($validusers[$extension])) {
# Test to see if we're modifying an existing user that has
# no telephone system objectClasses and update that object/user
$rdn = "$ldapKey=".$userdetails[$appKey].',';
$branch = SHOUT_USERS_BRANCH.','.$this->_params['basedn'];
-
+
# This test is something of a hack. I want a cheap way to check
# for the existance of an object. I don't want to do a full search
# so instead I compare that the dn equals the dn. If the object
# The object/user exists but doesn't have the Asterisk
# objectClasses
$extension = $userdetails['newextension'];
-
+
# $tmp is the minimal information required to establish
# an account in LDAP as required by the objectClasses.
# The entry will be fully populated below.
return PEAR::raiseError("Unable to modify the user: " .
ldap_error($this->_LDAP));
}
-
+
# Populate the $validusers array to make the edit go smoothly
# below
$validusers[$extension] = array();
# The remainder of the work is done at the outside of the
# parent if() like a normal edit.
-
+
} elseif ($res === -1) {
# We must be adding a new user.
$entry['objectClass'] = array(
'asteriskUser',
'asteriskVoiceMailbox'
);
-
+
# Check to see if the maximum number of users for this context
# has been reached
$limits = $this->getLimits($context);
print count($validusers).$limits['asteriskusers'];
return PEAR::raiseError('Maximum number of users reached.');
}
-
+
$res = @ldap_add($this->_LDAP, $rdn.$branch, $entry);
if (!$res) {
return PEAR::raiseError('LDAP Add failed: ' .
ldap_error($this->_LDAP));
}
-
+
return true;
}
}
-
+
# Anything after this point is an edit.
-
+
# Check to see if the object needs to be renamed (DN changed)
if ($validusers[$extension][$appKey] != $entry[$ldapKey]) {
$oldrdn = $ldapKey.'='.$validusers[$extension][$appKey];
ldap_error($this->_LDAP));
}
}
-
+
# Update the object/user
$dn = $ldapKey.'='.$entry[$ldapKey];
$dn .= ','.SHOUT_USERS_BRANCH.','.$this->_params['basedn'];
return PEAR::raiseError('LDAP Modify failed: ' .
ldap_error($this->_LDAP));
}
-
+
# We must have been successful
return true;
}
// }}}
-
+
// {{{ deleteUser method
/**
* Deletes a user from the LDAP tree
- *
+ *
* @param string $context Context to delete the user from
* @param string $extension Extension of the user to be deleted
*
{
$ldapKey = &$this->_ldapKey;
$appKey = &$this->_appKey;
-
+
if (!Shout::checkRights("shout:contexts:$context:users",
PERMS_DELETE, 1)) {
return PEAR::raiseError("No permission to delete users in this " .
"context.");
}
-
+
$validusers = $this->getUsers($context);
if (!isset($validusers[$extension])) {
return PEAR::raiseError("That extension does not exist.");
}
-
+
$dn = "$ldapKey=".$validusers[$extension][$appKey];
$dn .= ',' . SHOUT_USERS_BRANCH . ',' . $this->_params['basedn'];
-
+
$res = @ldap_delete($this->_LDAP, $dn);
if (!$res) {
return PEAR::raiseError("Unable to delete $extension from " .
return true;
}
// }}}
-
+
// {{{ connect method
/**
* Attempts to open a connection to the LDAP server.
global $shout;
$context = $vars->get("context");
$extension = $vars->get("extension");
-
+
$users = &$shout->getUsers($context);
if (array_key_exists($extension, $users)) {
# We must be editing an existing user
}
parent::Horde_Form($vars, _("$formtitle - Context: $context"));
-
+
$this->addHidden('', 'context', 'text', true);
$this->addHidden('', 'curextension', 'text', true);
$vars->set('curextension', $extension);
$this->addVariable(_("Full Name"), 'name', 'text', true);
$this->addVariable(_("Extension"), 'newextension', 'int', true);
$this->addVariable(_("E-Mail Address"), 'email', 'text', true);
+ $this->addVariable(_("Pager E-Mail Address"), 'pageremail', 'text', false);
# TODO: Integrate with To-Be-Written user manager and possibly make this
# TODO: new user also an email account.
$this->addVariable(_("PIN"), 'pin', 'int', true);
-
+
$t = 1;
while ($t <= $limits['telephonenumbersmax']) {
$this->addVariable(_("Telephone Number $t:"), "telephone$t",
false);
$t++;
}
-
+
$this->addVariable(_("Music on Hold while transferring"), 'moh',
- 'radio', true, false, null,
- array('values' => array(true => 'Yes', false => 'No')));
+ 'boolean', true, false);#, _("When checked, a calling user will hear music on hold while the caller is connected"));
$this->addVariable(_("Allow Call Transfers"), 'transfer',
- 'radio', true, false, null,
- array('values' => array(true => 'Yes', false => 'No')));
+ 'boolean', true, false);#, _("When checked, the called user will be allowed to transfer the incoming call to other extensions"));
+ $this->addVariable(_("Explicit Call Acceptance"), 'eca',
+ 'boolean', true, false);#, _("When checked, the called user will be required to press 1 to accept the call. Only turn this off if you really know what you're doing!"));
+ $this->addVariable(_("Call Appearance"), 'callappearance',
+ 'radio', true, false, null, array('values' =>
+ array('caller' => 'From Calling Party',
+ 'self' => 'From Self',
+ 'v-office' => 'From V-Office',
+ )
+ )
+ );
}
-
+
// {{{ fillUserForm method
/**
* Fill in the blanks for the UserDetailsForm
{
#Array ( [dialopts] => Array ( [0] => m [1] => t ) [mailboxopts] => Array (
#) [mailboxpin] => 1234 [name] => Ricardo Paul [phonenumbers] => Array ( )
- #[dialtimeout] => 30 [email] => ricardo.paul@v-office.biz [pageremail] => )
+ #[dialtimeout] => 30 [email] => ricardo.paul@v-office.biz [pageremail] => )
$vars->set('name', $userdetails['name']);
$vars->set('email', @$userdetails['email']);
$vars->set('pin', $userdetails['mailboxpin']);
$vars->set('newextension', $vars->get('extension'));
-
+
$i = 1;
foreach($userdetails['phonenumbers'] as $number) {
$vars->set("telephone$i", $number);
$i++;
}
-
+
if (in_array('m', $userdetails['dialopts'])) {
$vars->set('moh', true);
} else {
$vars->set('moh', false);
}
-
+
if (in_array('t', $userdetails['dialopts'])) {
$vars->set('transfer', true);
} else {
$vars->set('transfer', false);
}
-
+
+ if (in_array('e', $userdetails['dialopts'])) {
+ $vars->set('eca', true);
+ } else {
+ $vars->set('eca', false);
+ }
+
+ if (in_array('__CALLPRESENT:${VOFFICENUM}', $userdetails['dialopts'])) {
+ $vars->set('eca', true);
+ $vars->set('callappearance', 'v-office');
+ } elseif (in_array('__CALLPRESENT:${CALLER}', $userdetails['dialopts'])) {
+ $vars->set('eca', true);
+ $vars->set('callappearance', 'caller');
+ } elseif (in_array('__CALLPRESENT:${SELF}', $userdetails['dialopts'])) {
+ $vars->set('eca', true);
+ $vars->set('callappearance', 'self');
+ }
+
return true;
}
// }}}