| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
function tweet2call_get_config($engine) { |
|---|
| 25 |
global $db; |
|---|
| 26 |
global $ext; |
|---|
| 27 |
global $version; |
|---|
| 28 |
global $astman; |
|---|
| 29 |
switch($engine) { |
|---|
| 30 |
case "asterisk": |
|---|
| 31 |
$id = "app-tweet2call"; |
|---|
| 32 |
$results = sql("SELECT * FROM `tweet2call_departments`;","getAll",DB_FETCHMODE_ASSOC); |
|---|
| 33 |
if (empty($results)) { |
|---|
| 34 |
return array(); |
|---|
| 35 |
} else { |
|---|
| 36 |
foreach ($results as $result) { |
|---|
| 37 |
$exten = $result['queue']; |
|---|
| 38 |
$priority = $result['weight']; |
|---|
| 39 |
$department = $result['department']; |
|---|
| 40 |
$ext->add($id , $department , '' , new ext_setvar("QUEUE_PRIO", $priority)); |
|---|
| 41 |
$ext->add($id , $department , '' , new ext_goto('1', $exten, 'ext-queues')); |
|---|
| 42 |
} |
|---|
| 43 |
} |
|---|
| 44 |
} |
|---|
| 45 |
} |
|---|
| 46 |
|
|---|
| 47 |
function tweet2call_add_department($dept, $queue, $weight){ |
|---|
| 48 |
global $db; |
|---|
| 49 |
$results = sql("INSERT INTO tweet2call_departments (department, queue, weight) VALUES ('$dept', '$queue', '$weight') ON DUPLICATE KEY UPDATE queue='$queue', weight = '$weight'"); |
|---|
| 50 |
needreload(); |
|---|
| 51 |
} |
|---|
| 52 |
|
|---|
| 53 |
function tweet2call_del_department($dept){ |
|---|
| 54 |
global $db; |
|---|
| 55 |
|
|---|
| 56 |
$sql= "DELETE FROM tweet2call_departments WHERE department = '$dept'"; |
|---|
| 57 |
$result = $db->query($sql); |
|---|
| 58 |
DB::IsError($result)) { |
|---|
| 59 |
die_freepbx($result->getMessage().$sql); |
|---|
| 60 |
|
|---|
| 61 |
needreload(); |
|---|
| 62 |
|
|---|
| 63 |
} |
|---|
| 64 |
|
|---|
| 65 |
function tweet2call_add_settings($twitid, $twitpass, $polltime, $blacklist, $trunk){ |
|---|
| 66 |
global $db; |
|---|
| 67 |
$results = sql("INSERT INTO tweet2call_settings (twitid, twitpass, polltime, blacklist, trunk) VALUES ('$twitid', '$twitpass', '$polltime', '$blacklist', '$trunk') ON DUPLICATE KEY UPDATE twitpass='$twitpass', polltime = '$polltime', blacklist='$blacklist', trunk = '$trunk'"); |
|---|
| 68 |
} |
|---|
| 69 |
|
|---|
| 70 |
?> |
|---|
| 71 |
|
|---|