added workaround for Sipgate's SMS API
This commit is contained in:
parent
eff09da1d1
commit
f6224bac7b
2 changed files with 2 additions and 40 deletions
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
|
||||
require_once 'config.php';
|
||||
require_once 'xmlrpc/xmlrpc.inc';
|
||||
require_once 'sipgateAPI.php';
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
$headers = getallheaders();
|
||||
$body = file_get_contents('php://input');
|
||||
$json = json_decode($body, true);
|
||||
|
||||
switch ($headers['x-amz-sns-message-type']) {
|
||||
case 'SubscriptionConfirmation':
|
||||
fopen($json['SubscribeURL'], 'r');
|
||||
break;
|
||||
|
||||
case 'Notification':
|
||||
$sipgate = new sipgateAPI($config['username'], $config['password']);
|
||||
$balance = $sipgate->getBalance();
|
||||
$message = preg_replace('/\r?\n/m', '\n', trim($json['Message']));
|
||||
|
||||
if ($balance < $config['reserve']) {
|
||||
header("HTTP/1.0 402 Payment Required");
|
||||
}
|
||||
else {
|
||||
$sipgate->sendSMS($config['recipient'], $message, NULL, $config['recipient']);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
header("HTTP/1.1 501 Not Implemented");
|
||||
}
|
||||
}
|
||||
else {
|
||||
header("HTTP/1.1 405 Method Not Allowed");
|
||||
}
|
||||
|
||||
?>
|
|
@ -820,7 +820,7 @@
|
|||
var $key='';
|
||||
var $keypass='';
|
||||
var $verifypeer=true;
|
||||
var $verifyhost=1;
|
||||
var $verifyhost=2;
|
||||
var $no_multicall=false;
|
||||
var $proxy='';
|
||||
var $proxyport=0;
|
||||
|
@ -3773,4 +3773,4 @@ xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $cha
|
|||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
Loading…
Add table
Reference in a new issue