Exemple #1
0
function loadUssdSender($sessionId, $responseMessage)
{
    $password = "******";
    $destinationAddress = "tel:94771122336";
    if ($responseMessage == "000") {
        $ussdOperation = "mt-fin";
    } else {
        $ussdOperation = "mt-cont";
    }
    $chargingAmount = "5";
    $applicationId = "APP_000001";
    $encoding = "440";
    $version = "1.0";
    try {
        // Create the sender object server url
        //        $sender = new MtUssdSender("http://localhost:7000/ussd/send/");   // Application ussd-mt sending http url
        $sender = new MtUssdSender("https://localhost:7443/ussd/send/");
        // Application ussd-mt sending https url
        $response = $sender->ussd($applicationId, $password, $version, $responseMessage, $sessionId, $ussdOperation, $destinationAddress, $encoding, $chargingAmount);
        return $response;
    } catch (UssdException $ex) {
        //throws when failed sending or receiving the ussd
        error_log("USSD ERROR: {$ex->getStatusCode()} | {$ex->getStatusMessage()}");
        return null;
    }
}
Exemple #2
0
function showView($sessionID, $viewMessage, $info)
{
    $password = $info["password"];
    $destinationAddress = $info["destinationAddress"];
    $chargingAmount = $info["chargingAmount"];
    $applicationId = $info["applicationId"];
    $encoding = $info["encoding"];
    $version = $info["version"];
    if ($viewMessage == "000") {
        $ussdOperation = "mt-fin";
    } else {
        $ussdOperation = "mt-cont";
    }
    try {
        $sender = new MtUssdSender($info["mt-url"]);
        // Application ussd-mt sending https url
        $response = $sender->ussd($applicationId, $password, $version, $viewMessage, $sessionID, $ussdOperation, $destinationAddress, $encoding, $chargingAmount);
        return $response;
    } catch (UssdException $ex) {
        //throws when failed sending or receiving the ussd
        error_log("USSD ERROR: {$ex->getStatusCode()} | {$ex->getStatusMessage()}");
        return null;
    }
}