Enable named group functionality
This commit is contained in:
parent
845ccc2278
commit
fb6e2d8782
|
@ -2056,6 +2056,24 @@ and open the template in the editor. Base Version before all crash :-)
|
|||
</input>
|
||||
<help>Context: This is the context in which your phones will operate. It should match the context you are using for the rest of your phones (if you have any). The FreePBX default is 'from-internal'</help>
|
||||
</item>
|
||||
<item type="SLG" id="7">
|
||||
<label>Named Call Group</label>
|
||||
<name>namedcallgroup</name>
|
||||
<select>
|
||||
<default></default>
|
||||
</select>
|
||||
<help>Sets the groups this line is a member of. Incoming calls to this line are given these groups as an identifier. This is a comma separated list of group names.
|
||||
(It is not recommended to use numeric names)
|
||||
</help>
|
||||
</item>
|
||||
<item type="SLG" id="7">
|
||||
<label>Named Pickup Group</label>
|
||||
<name>namedpickupgroup</name>
|
||||
<select>
|
||||
<default></default>
|
||||
</select>
|
||||
<help>This is the list of groups that this line can pickup from. This is a comma separated list of group names</help>
|
||||
</item>
|
||||
<item type="IE" id="7">
|
||||
<label>Directed pickup context</label>
|
||||
<input>
|
||||
|
@ -2064,23 +2082,23 @@ and open the template in the editor. Base Version before all crash :-)
|
|||
<options placeholder="from_internal"></options>
|
||||
<class>sccp-custom</class>
|
||||
</input>
|
||||
<help>Context where direct pickup search for extensions. if not set current context will be use.</help>
|
||||
<help>Context where direct pickup searches for extensions. if not set current context will be use.</help>
|
||||
</item>
|
||||
<item type="SLG" id="7">
|
||||
<label>Named Call Group</label>
|
||||
<name>namedcallgroup</name>
|
||||
<select>
|
||||
<default></default>
|
||||
</select>
|
||||
<help>Sets the named caller groups this line is a member of</help>
|
||||
<item type="IS" id="11">
|
||||
<name>directed_pickup</name>
|
||||
<label>Directed Pickup</label>
|
||||
<default></default>
|
||||
<button value="yes">Yes</button>
|
||||
<button value="no">No</button>
|
||||
<help>Enable/disable directed Pickup button (to do directed pickup from a specific extension).</help>
|
||||
</item>
|
||||
<item type="SLG" id="7">
|
||||
<label>Named Pickup Group</label>
|
||||
<name>namedpickupgroup</name>
|
||||
<select>
|
||||
<default></default>
|
||||
</select>
|
||||
<help>Named PickupGroup - the list is of pickup groups used on the system</help>
|
||||
<item type="IS" id="11">
|
||||
<name>pickup_modeanswer</name>
|
||||
<label>Directed Pickup Answer</label>
|
||||
<default>off</default>
|
||||
<button value="yes">Yes</button>
|
||||
<button value="no">No</button>
|
||||
<help>When using directed pickup, if this flag is set to Yes, the call will automatically be answered upon pickup</help>
|
||||
</item>
|
||||
<item type="IE" id="7">
|
||||
<label>Secondary dialtone digits</label>
|
||||
|
@ -2099,22 +2117,6 @@ and open the template in the editor. Base Version before all crash :-)
|
|||
</select>
|
||||
<help>Outside dialtone frequency (default 0x22)</help>
|
||||
</item>
|
||||
<item type="IS" id="11">
|
||||
<name>directed_pickup</name>
|
||||
<label>Directed Pickup</label>
|
||||
<default></default>
|
||||
<button value="yes">Yes</button>
|
||||
<button value="no">No</button>
|
||||
<help>Enable/disable Pickup button to do directed pickup from a specific extension.</help>
|
||||
</item>
|
||||
<item type="IS" id="11">
|
||||
<name>pickup_modeanswer</name>
|
||||
<label>Directed Pickup Answer</label>
|
||||
<default>off</default>
|
||||
<button value="yes">Yes</button>
|
||||
<button value="no">No</button>
|
||||
<help>Directed Pickup Mode (Answer): If a call is sent with the "directed pickup" flag, the phone will answer when set to "Yes".</help>
|
||||
</item>
|
||||
<item type="IS" id="1" seq="0">
|
||||
<name>transfer</name>
|
||||
<label>Transfer</label>
|
||||
|
|
|
@ -142,8 +142,8 @@ function Get_DB_config($sccp_compatible)
|
|||
'directed_pickup' => array('create' => "enum('yes','no') NOT NULL default 'no'", 'modify' => "enum('yes','no')"),
|
||||
'directed_pickup_context' => array('create' => "VARCHAR(100) NULL DEFAULT NULL"),
|
||||
'pickup_modeanswer' => array('create' => "enum('yes','no') NOT NULL default 'yes'", 'modify' => "enum('yes','no')"),
|
||||
'namedcallgroup' => array('create' => "VARCHAR(100) NULL DEFAULT NULL AFTER `setvar`", 'modify' => "VARCHAR(100)"),
|
||||
'namedpickupgroup' => array('create' => "VARCHAR(100) NULL DEFAULT NULL AFTER `namedcallgroup`", 'modify' => "VARCHAR(100)"),
|
||||
'namedcallgroup' => array('create' => "VARCHAR(255) NULL DEFAULT NULL AFTER `setvar`", 'modify' => "VARCHAR(100)"),
|
||||
'namedpickupgroup' => array('create' => "VARCHAR(255) NULL DEFAULT NULL AFTER `namedcallgroup`", 'modify' => "VARCHAR(100)"),
|
||||
'adhocNumber' => array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `namedpickupgroup`"),
|
||||
'meetme' => array('create' => "VARCHAR(5) NULL DEFAULT NULL AFTER `adhocNumber`"),
|
||||
'context' => array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `description`", 'def_modify' => 'from-internal'),
|
||||
|
|
|
@ -200,8 +200,8 @@
|
|||
<field name="silencesuppression" type="string" default="off"/>
|
||||
<field name="callgroup" type="string" length="45" notnull="false"/>
|
||||
<field name="pickupgroup" type="string" length="45" notnull="false"/>
|
||||
<field name="namedcallgroup" type="string" length="100" notnull="false"/>
|
||||
<field name="namedpickupgroup" type="string" length="100" notnull="false"/>
|
||||
<field name="namedcallgroup" type="string" length="255" notnull="false"/>
|
||||
<field name="namedpickupgroup" type="string" length="255" notnull="false"/>
|
||||
<field name="adhocNumber" type="string" length="45" notnull="false"/>
|
||||
<field name="meetme" type="string" length="5" notnull="false"/>
|
||||
<field name="meetmenum" type="string" length="45" notnull="false"/>
|
||||
|
|
|
@ -413,21 +413,29 @@ class Sccp extends \FreePBX\modules\Core\Driver {
|
|||
unset($select);
|
||||
break;
|
||||
case 'SLG':
|
||||
// namedcallgroup and namedpickupgroup.
|
||||
//$extensionId = $display_info['id'];
|
||||
$elementID = (string)$child->name;
|
||||
$named_group = \FreePbx::sccp_manager()->dbinterface->getNamedGroup($elementID);
|
||||
if (!empty($named_group[$elementID])) {
|
||||
$setting[$elementID] = \FreePbx::sccp_manager()->dbinterface->getLineGroups($elementID, $deviceInfo['id']);
|
||||
$named_group = \FreePbx::sccp_manager()->dbinterface->getNamedGroup('namedcallgroup');
|
||||
if (!empty($named_group['namedcallgroup'])) {
|
||||
/* This commented out code will display as a list
|
||||
foreach ($named_group[$elementID] as $val) {
|
||||
$select[] = array('value' => $val, 'text' => $val);
|
||||
}
|
||||
*/
|
||||
$select = ltrim(implode(',', $named_group['namedcallgroup']), " ,");
|
||||
}
|
||||
// Disable and hide list elements if there are no valid values
|
||||
$thisHelp = (string)$child->help . ". <br>Known sccp named groups are: " . $select;
|
||||
//Need element (array)select in array below to have list.
|
||||
dbug($setting[$elementID]);
|
||||
$tmparr[(string)$child->name] = array('prompttext' => _((string)$child->label),
|
||||
'value' => $this->line_defaults[(string)$child->name],
|
||||
'tt' => (string)$child->help,
|
||||
'select' => $select,
|
||||
'value' => $setting[$elementID],
|
||||
'tt' => $thisHelp,
|
||||
'level' => 1,
|
||||
'disable' => empty($named_group[$elementID][0]),
|
||||
'hidden' => empty($named_group[$elementID][0]),
|
||||
'disable' => empty($named_group),
|
||||
'hidden' => empty($named_group),
|
||||
'section' => $section,
|
||||
'category' => $gn_category
|
||||
);
|
||||
|
|
|
@ -435,9 +435,14 @@ class dbinterface
|
|||
return $result;
|
||||
}
|
||||
|
||||
public function getLineGroups($element, $id){
|
||||
$sth = $this->db->prepare("SELECT {$element} FROM sccpline WHERE name='{$id}'");
|
||||
$sth->execute();
|
||||
return $sth->fetchAll()[$element];
|
||||
}
|
||||
public function getNamedGroup($callGroup) {
|
||||
$sql = "SELECT {$callGroup} FROM sccpline GROUP BY {$callGroup}";
|
||||
$sth = $this->db->prepare($sql);
|
||||
//$sql = "SELECT {$callGroup} FROM sccpline GROUP BY {$callGroup}";
|
||||
$sth = $this->db->prepare("SELECT {$callGroup} FROM sccpline GROUP BY {$callGroup}");
|
||||
$result = array();
|
||||
$tech = array();
|
||||
try {
|
||||
|
@ -447,6 +452,7 @@ class dbinterface
|
|||
$tech[$callGroup][] = $val[0];
|
||||
}
|
||||
} catch(\Exception $e) {}
|
||||
dbug($tech);
|
||||
return $tech;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue