source-Send_to_YAC.php
| 1 | <?php
|
|---|---|
| 2 | //this file is designed to be used as an include that is part of a loop.
|
| 3 | //If a valid match is found, it should give $caller_id a value
|
| 4 | //available variables for use are: $thenumber
|
| 5 | //retreive website contents using get_url_contents($url);
|
| 6 | |
| 7 | //configuration / display parameters
|
| 8 | //The description cannot contain "a" tags, but can contain limited HTML. Some HTML (like the a tags) will break the UI.
|
| 9 | $source_desc = "This source will send the number and the Caller ID to a YAC (Yet Another Caller ID Program) service for external processing.<br>The message will be sent as a Call notification<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.";
|
| 10 | $source_param = array();
|
| 11 | $source_param['Server_address']['desc'] = 'Specify the server IP or domain name address to call after a CLID was found.'; |
| 12 | $source_param['Server_address']['type'] = 'text'; |
| 13 | $source_param['Server_address']['default'] = ''; |
| 14 | $source_param['Server_TCP_Port']['desc'] = 'Specify the TCP port to be used (default for YAC is 10629).'; |
| 15 | $source_param['Server_TCP_Port']['type'] = 'number'; |
| 16 | $source_param['Server_TCP_Port']['default'] = '10629'; |
| 17 | |
| 18 | |
| 19 | if($usage_mode == 'post processing') |
| 20 | {
|
| 21 | if (($run_param['Server_address'] !='') && ($first_caller_id != '')) |
| 22 | {
|
| 23 | $yac_text = $first_caller_id.'~'.$thenumber;
|
| 24 | shell_exec('/bin/echo -e -n "@CALL'.$yac_text.'"|nc -w 1 '.$run_param['Server_address'].' '.$run_param['Server_TCP_Port'].''); |
| 25 | |
| 26 | if($debug)
|
| 27 | {
|
| 28 | print 'Send to YAC: '.$first_caller_id.' '.$thenumber.'<br><br>'; |
| 29 | } |
| 30 | } |
| 31 | } |
| 32 | ?> |