Get delivery reports kannel - php

I am using kannel sms gateway, to send sms
Sorry, if this question is asked before, but I tried to find solution, but I didn't get any, unfortunately I have to post this question.
I am sending message through php script(smpp client) to smpp server, which connects to bearer box and send message.
There are multiple issues am facing:
1. Am not able to get delivery report
2. Am getting an error in logs of smsbox : ERROR: URL <03b3423a> doesn't start with http://' norhttps://'
I tried different solutions, but none of them are working.
I am in need that if number "A" sends message to number "B", then number "A" should get acknowledgement that message had been delivered to number "B"
Here are my details of configuration files:
kannel.conf
group = core
dlr-storage=internal
admin-port = 13000
smsbox-port = 13001
admin-password = bar
log-file = "/var/log//kannel/kannel.log"
box-deny-ip = "*.*.*.*"
box-allow-ip = "127.0.0.1"
access-log = "/var/log/kannel/access.log"
#---------------------------------------------
# SMSC CONNECTIONS
group = "smsc"
smsc = "http"
smsc-id = "http"
#system-type = "generic"
system-type = "kannel"
port = 13015
log-file = /var/log/kannel/smsc.log
status-success-regex = "success"
status-permfail-regex = "failure"
status-tempfail-regex = "retry later"
generic-status-sent = 200
generic-status-error = 404
#reroute-dlr = true
#transceiver-mode = 0
receive-port=13015
send-url = "http://192.168.1.124:8090"
smsc-username = "cust2"
smsc-password = "cust#123"
connect-allow-ip = "*.*.*.*"
#dlr-url="http://192.168.1.106/dlr.php?type=%d"
#---------------------------------------------
# SMSBOX SETUP
group = smsbox
bearerbox-host = 127.0.0.1
bearerbox-port = 13001
smsbox-id = cust2
#---------------------------------------------
# SEND-SMS USERS
group = sendsms-user
username = cust2
password = cust#123
#user-deny-ip = ""
#user-allow-ip = ""
#---------------------------------------------
# SERVICES
group = sms-service
keyword = default
text = "No service specified"
group = smsbox-route
smsbox-id = cust2
smsc-id = "http"
opensmppbox.conf
group = core
dlr-storage = internal
group = opensmppbox
opensmppbox-id = OPENSMPP
opensmppbox-port = 2775
bearerbox-host = 127.0.0.1
bearerbox-port = 13001
our-system-id = outbind
smpp-logins = /usr/local/kannel/smpplogins.txt
use-systemid-as-smsboxid = true
route-to-smsc = http
log-file = /usr/local/kannel/smppbox.log
transmitter.php
<?php
//print "<pre>";
require_once "smpp.php";
$tx=new SMPP('192.168.1.81',2775);
$tx->debug=true;
$tx->system_type="http";
$tx->addr_npi=1;
$tx->sms_registered_delivery_flag=1;
$tx->sms_sm_default_msg_id=1;
//$tx->dlr_url="http://192.168.1.124/cgi-bim/drl";
//$tx->dlr_url="http://192.168.1.124:8090";
print_r($tx);
//print "open status: ".$tx->state."\n";
$tx->bindTransmitter("cust2","cust#123");
$tx->sms_source_addr_npi=1;
//$tx->sms_source_addr_ton=1;
$tx->sms_dest_addr_ton=1;
$tx->sms_dest_addr_npi=1;
$tx->sendSMS("2121","791400000","Hello world");
//$tx->sendSMS("2121","2121","Hello world!!!");
$tx->close();
unset($tx);
Please let me know, if any further information is needed
Thanks for help in advance

What is the response of the call http://192.168.1.124:8090
send-url = "http://192.168.1.124:8090"
Response must be like success, failure or retry later
status-success-regex = "success"
status-permfail-regex = "failure"
status-tempfail-regex = "retry later"
If the response is correct you will get the correct DLR

Related

How to use python to Authenticate with Google in grpc?(I have a runable PHP code)

I got some .proto files from A service provider to get stock data.They give me a php code, but I need to use python.I try to do the same thing in python but I failed and failed.The official Docs is not very clear..and my programming skill is so low..
And this is my python code(core part),when I run this code,there will be a error message:"<_Rendezvous> of RPC that terminated with (StatusCode.UNIMPLEMENTED,Method not found:xxxxxxxxxxxxxxxxx.HistoricalQuoteService/getTodayM1Quotes)".I think I didn't connect to the server.When I add the code below:
options.append(update_metadata2)
The error message will changed to:"too many values to unpack"
symbol = common_pb2.Symbol()
symbol.code = "BABA"
symbol.market = common_pb2.US
symbol.type = common_pb2.Stock
market_request = marketData_pb2.MarketDataRequest()
market_request.symbol.code = symbol.code
market_request.symbol.market = symbol.market
market_request.symbol.type = symbol.type
market_request.language = common_pb2.zhHans
print(market_request)
try:
path = os.path.abspath('.')
pemPath = path + '/open_test_cert.pem'
transport_creds = grpc.ssl_channel_credentials(open(pemPath).read())
options = []
update_metadata = {}
update_metadata2 = {}
update_metadata['UserName'] = 'xxxx'
update_metadata['Password'] = 'yyyy'
update_metadata2['grpc.ssl_target_name_override'] = 'open.test.yintongzhibo.com'
options.append(update_metadata)
# options.append(update_metadata2)
channel = grpc.secure_channel("open.test.yintongzhibo.com:9002",transport_creds,options)
# credentials , project= google_auth.default(scopes=(scope1,scope2,scope3))
# credentials , project= google_auth.default()
# http_request = google_auth_transport_requests.Request()
# metadata_plugin = AuthMetadataPlugin(credentials,http_request)
# google_auth_credentials = grpc.metadata_call_credentials(metadata_plugin)
# ssl_credentials = grpc.ssl_channel_credentials(open(pemPath).read())
# composite_credentials = grpc.composite_channel_credentials(ssl_credentials,google_auth_credentials)
# channel = grpc.secure_channel("open.test.yintongzhibo.com:9002",composite_credentials)
# channel = google_auth_transport_grpc.secure_authorized_channel(credentials,request,'open.test.yintongzhibo.com:9002')
stub = historicalQuote_pb2_grpc.HistoricalQuoteServiceStub(channel)
response = stub.getTodayM1Quotes(symbol)
# stub = marketData_pb2_grpc.MarketDataServiceStub(channel)
# response = stub.getMarketData(market_request)
print(response.message)
except Exception as e:
print (e)
So,How should I write python code to achieve the same function of the PHP code?And how can I get more error log?Thanks everyone!
the PHP code is here:
PHP code

PHP Radius client - Access-Accept response is blank

I am sending a RADIUS request from PHP, I can see in the RADIUS proxy (FreeRadius) that the response is Access-Accept but the php code does not get a response. This is the Free Radius log sending the Access-Accept to the php code:
Sending Access-Accept Id 78 from 127.0.0.1:1812 to 127.0.0.1:47830
Framed-Protocol = PPP
Service-Type = Framed-User
Class = 0xc54b0a250000013700010200c0a8325c00000000a02e06f58ef1f00101d16804df7acf010000000000000152
MS-RNAP-Not-Quarantine-Capable = SoH-Not-Sent
MS-MPPE-Recv-Key = 0x3c0b83999598f3a5e3d58b13b69520c5
MS-MPPE-Send-Key = 0x37077455d6468f9058b91cdbbb6c2115
MS-CHAP2-Success = 0x01533d37343536414541393038434244433033464630373630333039394343453334433834384138333243
MS-CHAP-Domain = '\001DOMAIN'
MS-MPPE-Encryption-Policy = Encryption-Required
MS-MPPE-Encryption-Types = 14
MS-Quarantine-State = Full-Access
MS-Extended-Quarantine-State = 0
(0) Finished request
However, the code that gets the response:
$req = radius_send_request($res);
if (!$req) {
echo 'RadiusError:' . radius_strerror($res). "\n<br>";
exit;
}
Spits out the line RadiusError:No valid RADIUS responses received
Any ideas?

ElasticSearch PHP error 503

I'm quite new to ElasticSearch and just figuring some things out for now, but here is a problem. After all the trouble of changing the server we migrated the nodes, but have some missing data in one of them. We have two nodes that have records with the same ID in both of them. In 1'st one everything is ok, but in second some records seems to be missing. For example if I send the request like this:
GET /fnh_detailbeta/main/61UkVww8QGu093RirFG84A
I will get the following error (in Marvel - Sense)
{
"error": "NoShardAvailableActionException[[fnh_detailbeta][0] null]",
"status": 503
}
So, what I'm trying to do now is compare all the records in Node 1 with records in Node 2 via ElasticSearch PHP. Here is the PHP I'm trying to run:
<?php
require '../connector/vendor/autoload.php';
$number = 1;
$params = array();
$params['hosts'] = array (
'146.185.164.121:9200', // IP + Port
);
$client = new Elasticsearch\Client($params);
$getParams = array();
$getParams['index'] = 'fnh_mainbeta';
$getParams['type'] = 'main';
//REQUEST AMOUNT
$json = '{"query": {"match_all": {}},"size": 1,"from":'.$number.'}';
$getParams['body'] = $json;
$retDoc = $client->search($getParams);
$total = $retDoc['hits']['total'];
//END OF REQUEST AMOUNT
//REQUEST ID
for ($i = 1; $i <= $total; $i++) {
$json = '{"query": {"match_all": {}},"size": 1,"from":'.$number.'}';
$getParams = array();
$getParams['index'] = 'fnh_mainbeta';
$getParams['type'] = 'main';
$getParams['body'] = $json;
$getParams['ignore'] = 503;
$getParams['ignore'] = 404;
$retDoc = $client->search($getParams);
$found_id = $retDoc['hits']['hits'][0]['_id'];
echo $found_id;
//REGUEST SECOND DB
$getParams = array();
$getParams['index'] = 'fnh_detailbeta';
$getParams['type'] = 'main';
$getParams['id'] = '61UkVww8QGu093RirFG84A';
$retDoc = $client->get($getParams);
$found_id_two = $retDoc['_id'];
echo $found_id_two;
//END OF REQUEST SECOND DB
$number++;
sleep(1);
};
//END OF REQUEST AMOUNT
It is not finished by now, but I get the fatal error that exits the script:
Fatal error: Uncaught exception 'Guzzle\Http\Exception\ServerErrorResponseException' with message 'Server error response
[status code] 503
[reason phrase] Service Unavailable
This error appears when NoShardAvailableActionException[[fnh_detailbeta][0] null]... So, the question is:
What is the best way to catch this error (something like IF error THEN echo "error") without stop of the PHP execution. In other words - I want to determine this error, delete this record and go further comparing the Nodes.
Any help will be appreciated!

php - PayPal Express Checkout Item name and number

Why isn't the item name and number not being submitted with the DoExpressCheckout?
Here is what I am sending:
// Single-item purchase
$nvps["METHOD"] = "SetExpressCheckout";
$nvps["RETURNURL"] = "http://www.domain.com/angelpaypal/test/success.php"; // server
$nvps["CANCELURL"] = "http://www.domain.com/angelpaypal/test/fail.php"; // server
$nvps["PAYMENTREQUEST_0_PAYMENTACTION"] = "Sale";
$nvps["PAYMENTREQUEST_0_NOTIFYURL"] = "http://www.domain.com/includes/ipn/paypal/config/ipn-listener.php";
$nvps["PAYMENTREQUEST_0_AMT"] = "$Price";
$nvps["PAYMENTREQUEST_0_CURRENCYCODE"] = "USD";
$nvps["PAYMENTREQUEST_0_ITEMAMT"] = "$Price";
$nvps["L_PAYMENTREQUEST_0_NAME0"] = "$Desc";
$nvps["L_PAYMENTREQUEST_0_NUMBER0"] = "$Item";
$nvps["L_PAYMENTREQUEST_0_AMT0"] = "$Price";
$nvps["L_PAYMENTREQUEST_0_QTY0"] = "1";
$nvps["L_PAYMENTREQUEST_0_ITEMCATEGORY0"] = "Digital"; // specific to Digital Goods
Below is the response:
TOKEN = EC-7RN61912TS2838617
SUCCESSPAGEREDIRECTREQUESTED = false
TIMESTAMP = 2014-03-07T19:16:39Z
CORRELATIONID = b65c4f8669542
ACK = Success
VERSION = 109.0
BUILD = 9917844
INSURANCEOPTIONSELECTED = false
SHIPPINGOPTIONISDEFAULT = false
PAYMENTINFO_0_TRANSACTIONID = 3PF8162359151561E
PAYMENTINFO_0_TRANSACTIONTYPE = expresscheckout
PAYMENTINFO_0_PAYMENTTYPE = instant
PAYMENTINFO_0_ORDERTIME = 2014-03-07T19:16:39Z
PAYMENTINFO_0_AMT = 5.00
PAYMENTINFO_0_FEEAMT = 0.45
PAYMENTINFO_0_TAXAMT = 0.00
PAYMENTINFO_0_CURRENCYCODE = USD
PAYMENTINFO_0_PAYMENTSTATUS = Completed
PAYMENTINFO_0_PENDINGREASON = None
PAYMENTINFO_0_REASONCODE = None
PAYMENTINFO_0_PROTECTIONELIGIBILITY = Ineligible
PAYMENTINFO_0_PROTECTIONELIGIBILITYTYPE = None
PAYMENTINFO_0_SECUREMERCHANTACCOUNTID = KEPBS3TF5VPSL
PAYMENTINFO_0_ERRORCODE = 0
PAYMENTINFO_0_ACK = Success
As yuo can see, I am specifying item name and number, although in the response above, I don't see these fields - I want to use them in the IPN (NOTIFYURL) I've added
What you've shown here is SetExpressCheckout. Setting the items here will only make them show up on the PayPal review page during checkout. It will not carry all the way through to the final transaction unless you include those same itemizes details in the DoExpressCheckoutPayment request.
DECP is the end all, be all. Whatever gets sent with that is what ends up in the final PayPal details.

Fatal error with NuSoap 1.94 with PHP 5.2.17 making a soap client call

I'm getting an error message when making a call to an xBase++ based web server that is acting as a web service (not using WSDL) when trying to make a soapclient call to it using NuSoap 1.94 with PHP 5.2.17. This exact same code works with NuSOAP 1.94 on PHP 4. Any ideas or help would be appreciated!
Note (I had to remove the https:// part of the addresses from the error message below - I was getting an error posting saying I needed 10 reputation to post 2 links or more)
Thanks,
Salar
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'xxx.xxx.com:55055' : failed to load external entity "xxx.xxx.com:55055" in /hsphere/local/home/xxx/xxx.com/phpinvent/inc/functions/xmsg.php:34 Stack trace: #0 /hsphere/local/home/xxx/xxx.com/phpinvent/inc/functions/xmsg.php(34): SoapClient->SoapClient('https://xxx.xxx...') #1 /hsphere/local/home/xxx/xxx.com/phpinvent/xmsgtest.php(15): XMsg('LOGIN', Array) #2 {main} thrown in /hsphere/local/home/xxx/xxx.com/phpinvent/inc/functions/xmsg.php on line 34
Here's the code of my test page, and the xmsg function:
<?php
ini_set('display_errors', 'On');
ini_set('default_socket_timeout', 300);
error_reporting(E_ERROR | E_WARNING | E_PARSE);
// include configuration
require_once('inc/config.php');
require_once('inc/nusoap/nusoap.php'); // include the NuSOAP classes
$xmsg_param[0][0] = "userid";
$xmsg_param[0][1] = "TEST";
$xmsg_param[1][0] = "password";
$xmsg_param[1][1] = "TEST";
$result = XMsg("LOGIN", $xmsg_param);
echo("<br>resulttxt: ".$result['xmsg_resulttxt']);
echo("<br>Sessionid: ".$result['sessionid']);
?>
<?php
// XMsg *************************************************************************
// This function is used to send a message through the robust, connectionless message system
function XMsg($xm_type, $xm_parameters, $xm_target = XMSG_DEFAULT_GATEWAY, $xm_mode = XMSG_DEFAULT_MODE)
{
// Parameters:
// xm_type - C - mandatory – type of message being sent
// xm_parameters - A - optional - 2 dimensional array of name/value pairs that will be sent to the target with the message
// xm_target - C - optional - target - currently supports only URLs of AutoMate agents - defaults to gateway
// xm_mode - C - optional - tokens that allow for modification of the message - currently defaults to #SOAP# to send via SOAP
// Returns:
// xm_result - A - array of name/value pairs returned from the target in same format as xm_target
$xm_SOAPagent = ''; // SOAP Envelope Object - Request
$xm_SOAPresult = ''; // SOAP Envelope Object - Response
$xm_SOAPclass = '';
$xm_retrynum = 0; // Number of retries attempted
$xm_retry = true; // Continue retrying?
$xm_result = Array(); // Array of results returned by XMsg
$xm_numparams = 0; // Number of parameters passed to XMsg
$xm_I = 0; // FOR Loop Counter
// Initialize Parameters
$xm_parameters = (gettype($xm_parameters) == "array" ? $xm_parameters : array());
// check if mandatory parameters are passed
// xm_type must be character and not empty
if (gettype($xm_type)=="string" && !empty($xm_type)) {
switch($xm_mode)
{
case "SOAP":
// open SOAP envelope and initialize
echo("calling xm_target: ".$xm_target."<br>");
$soapclient = new soapclient($xm_target);
$soapparam = array();
// create and pass xmsg structure - NOTE: this section is specialized to PHP
$soapparam['xmsg_id'] = '';
$soapparam['xmsg_source'] = '';
$soapparam['xmsg_target'] = $xm_target;
$soapparam['xmsg_session'] = $_SESSION['SESSIONID'];
$soapparam['xmsg_userid'] = $_SESSION['USERID'];
$soapparam['xmsg_websessid'] = session_id();
$soapparam['xmsg_ip'] = $_SERVER['REMOTE_ADDR'];
$soapparam['xmsg_status'] = 'SENT';
$soapparam['xmsg_type'] = $xm_type;
$soapparam['xmsg_result'] = '';
$soapparam['xmsg_resulttxt'] = '';
$soapparam['xmsg_date'] = date("m/d/y");
$soapparam['xmsg_time'] = date("H:i:s");
$soapparam['xmsg_datereceive'] = '';
$soapparam['xmsg_timereceive'] = '';
$soapparam['xmsg_dateresponse'] = '';
$soapparam['xmsg_timeresponse'] = '';
// count parameters and add to SOAP Envelope
$xm_numparams = count($xm_parameters);
for ($xm_I = 0; $xm_I < $xm_numparams; $xm_I++) {
echo("setting soapparam[".$xm_parameters[$xm_I][0]."] to :".$xm_parameters[$xm_I][1]);
$soapparam[$xm_parameters[$xm_I][0]] = $xm_parameters[$xm_I][1];
}
// SOAP retry loop start - retry until xm_retry is false - set to false when call succeeds or max # retries exceeded
do {
// run remote SOAP call for RemoteCall as specified in
$xm_result = $soapclient->call('XMsg',$soapparam);
// check for fault
echo ("Fault: ".$xm_result['FAULT']."<br>");
echo ("1 Faultcode: ".$xm_result['faultcode']."<br>");
if (empty($xm_result['faultcode'])) {
echo('<hr>'.'<pre>' . htmlspecialchars($soapclient->response, ENT_QUOTES) . '</pre>');
echo('<hr>'.'<pre>' . htmlspecialchars($soapclient->debug_str, ENT_QUOTES) . '</pre>');
$xm_retry = false;
// update status / response date / time
$xm_result['xmsg_status'] = "RECEIVED";
$xm_result['xmsg_dateresponse'] = date("m/d/y");
$xm_result['xmsg_timeresponse'] = date("H:i:s");
} else {
echo("2 faultcode: ".$xm_result['faultcode']);
}
// SOAP Call retry handling
if ($xm_retry) {
// increase the SOAP comm retry counter to count the number of retries made
$xm_retrynum++;
// check if the maximum number of retries has been reached
if ($xm_retrynum <= XMSG_NUMRETRY) {
sleep(XMSG_RETRYDELAY); // delay for set number of seconds
} else {
$xm_retry = false;
}
}
} while ($xm_retry);
break;
default:
// no other message type handling currently
}
}
}
return $xm_result;
// XMsg *************************************************************************
This is quite simple. Your web server can't see the location the WSDL is hosted at. Can you hit the location if you copy the WSDL url and paste it into your browser? You should check that the URL you are using is correct, and whether your web server can even see that location. If not you will need to remedy that before it will work.

Categories