-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathfunctions.inc.php
More file actions
39 lines (34 loc) · 1.34 KB
/
functions.inc.php
File metadata and controls
39 lines (34 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
function contactmanager_getdest($id) {
return array('ext-contactmanager-sd,'.$id.',1');
}
function contactmanager_getdestinfo($dest) {
if (substr(trim($dest),0,22) == 'ext-contactmanager-sd,') {
$fcc = new \featurecode('contactmanager', 'app-contactmanager-sd');
$code = $fcc->getCodeActive();
if (empty($code)) {
return array();
}
$parts = explode(',',$dest);
$id = $parts[1];
$cm = \FreePBX::Contactmanager();
$speeddial = $cm->getSpeedDialByID($id);
if(!empty($speeddial)) {
$name = !empty($speeddial['displayname']) ? $speeddial['displayname'] : $speeddial['fname'] . " " . $speeddial['lname'];
switch($speeddial['grouptype']) {
case "private":
case "internal":
case "external":
return array('description' => sprintf(_("Contact Manager: %s (Speed Dial: %s) [%s]"),$name,$code.$speeddial['id'],$speeddial['number']),'edit_url' => 'config.php?display=contactmanager&action=showentry&group='.urlencode($speeddial['groupid']).'&entry='.urlencode($speeddial['entryid']));
break;
case "userman":
return array('description' => sprintf(_("Contact Manager: %s (Speed Dial: %s) [%s]"),$name,$code.$speeddial['id'],$speeddial['number']),'edit_url' => 'display=userman&action=showuser&user='.urlencode($speeddial['entryid']));
break;
}
return array();
}
return array();
} else {
return false;
}
}