Check Current SMSC Connection Status

Check Current SMSC Connection Status SearchSearch
Author Message
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 6290
Registered: 08-2008
Posted on Friday, June 04, 2021 - 08:41 pm:   

The preferred way for an external monitoring application to detect if NowSMS is experiencing connectivity errors is to use the XML-based status query.

The XML status query interface described at https://nowsms.com/xml-status-query-for-smsc-connection-status-and-statistics

One of the easiest ways to parse the XML data is with PHP. Some examples are provided at https://nowsms.com/nowsms-status-query-with-php

One of the examples at the above link shows a PHP script that specifically checks for connectivity errors.

 
<?php
$xmldata = file_get_contents
("https://127.0.0.1:8801/admin/xmlstatus?user=adminuser&password=adminpass");
$xml = simplexml_load_string($xmldata);
$allConnectionsOK = true;
foreach ($xml->SMSCStatus as $smscStatus) {
if (strcasecmp ($smscStatus->Status, "OK")) {
$allConnectionsOK = false;
echo "Connection Error: " . $smscStatus->Name . " -- " . $smscStatus->StatusDetail . "\n";
}
}
if ($allConnectionsOK) {
echo "OK\n";
}
?>


This script connects to the NowSMS web interface, and passes credentials for an admin account in the URL parameters.

Various status information and statistics are available, with more detail available at the links referenced above.

Of particular interest, status information is available for each SMSC and MMS connection.

In the XML, each SMSC connection has a separate <SMSCStatus> element, like this:

<SMSCStatus>  
<Name>SMPP – 192.168.1.200:9000</Name>
<Status>OK</Status>
<MessagesToday>44640</MessagesToday>
<MessagesLast7Days>44640</MessagesLast7Days>
<MessagesLast30Days>44640</MessagesLast30Days>
</SMSCStatus>


Or ...

<SMSCStatus>  
<Name>SMPP – 192.168.1.201:9000</Name>
<Status>ERROR</Status>
<StatusDetail>SMPP Failure -- Unable to connect to SMPP server at 192.168.1.201:9000</StatusDetail>
<MessagesToday>43369</MessagesToday>
<MessagesLast7Days>43369</MessagesLast7Days>
<MessagesLast30Days>43369</MessagesLast30Days>
</SMSCStatus>


The PHP script above looks for SMSC connections where the Status is not OK.

Add Your Message Here, or click here to start a new topic.
Post:
Bold text Italics Underline Create a hyperlink Insert a clipart image
Options: Automatically activate URLs in message
Action: