forked from kingarthur2/superfecta-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsource-Send_to_Dreambox.module
48 lines (41 loc) · 2.07 KB
/
source-Send_to_Dreambox.module
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
40
41
42
43
44
45
46
47
48
<?php
class Send_to_Dreambox extends superfecta_base {
public $description = "This source will send the number and the Caller ID to a dreambox.<br>Enter the URL to the destination dreambox in the format `http://url:port`.<br>This datasource should be one of the last data sources on your list, as it does not provide any data of its own, and can only send what information has been collected before it is run.";
public $version_requirement = "2.11";
public $source_param = array(
'URL_address' => array(
'description' => 'Specify the URL:Port to the dreambox installation. (Example: http://script.somewhere.com:80)',
'type' => 'text',
'default' => "http://url:80"
),
'Display_Setting' => array(
'description' => 'Specify the way you want the number to be displayed on your dreambox',
'type' => 'select',
'option' => array(
1 => '(132) 456-7890',
2 => '132-456-7890',
3 => '12 34 56 78 90',
4 => 'No Formatting',
),
'default' => 4
)
);
function post_processing($cache_found, $winning_source, $first_caller_id, $run_param, $thenumber) {
if ($run_param['URL_Address'] && $run_param['URL_Port'] != '') {
$thenumberformated = $thenumber;
switch ($run_param['Display_Setting']) {
case 1:
case 2:
case 3:
$settings = $this->settings();
$thenumberformated = $this->FormatNumber($thenumber, $settings["source_param"]['Format_Incomming_Number']['option'][$run_param['Format_Incomming_Number']]);
break;
}
$cliddreambox = urlencode($first_caller_id . ',' . $thenumberformated);
$url = $run_param['URL_address'] . '/cgi-bin/message?message=' . $cliddreambox;
$this->DebugPrint("Send to dreambox: " . $run_param['URL_address']);
$value = get_url_contents($url);
return($thenumber);
}
}
}