$applicationId = $receiver->getApplicationId(); // get application ID $encoding = $receiver->getEncoding(); // get the encoding value $version = $receiver->getVersion(); // get the version $sessionId = $receiver->getSessionId(); // get the session ID; $ussdOperation = $receiver->getUssdOperation(); // get the ussd operation $responseMsg = array("main" => "Welcome To Arduino Demo\n\n1. On\n2. Off \n\n99. Exit"); if ($ussdOperation == "mo-init") { try { $sessionArrary = array("sessionsid" => $sessionId, "tel" => $address, "menu" => "main", "pg" => "", "others" => ""); $operations->setSessions($sessionArrary); $sender->ussd($sessionId, $responseMsg["main"], $address); } catch (Exception $e) { $sender->ussd($sessionId, 'Please try again', $address); } } else { $flag = 0; $sessiondetails = $operations->getSession($sessionId); $cuch_menu = $sessiondetails['menu']; $operations->session_id = $sessiondetails['sessionsid']; switch ($cuch_menu) { case "main": // Following is the main menu switch ($receiver->getMessage()) { case "1": $operations->session_menu = "On"; $response = $smssender->sms('on', $address);
$applicationId = $receiver->getApplicationId(); // get application ID $encoding = $receiver->getEncoding(); // get the encoding value $version = $receiver->getVersion(); // get the version $sessionId = $receiver->getSessionId(); // get the session ID; $ussdOperation = $receiver->getUssdOperation(); // get the ussd operation $responseMsg = array("main" => "Keth-Net\n1. Sinhala\n2. English\n\n99. Exit", "Sinhala" => "Keth-Net\n1. Ganudenu Karuweku sandaha visthara laba ganima\n2. Wagahimiyeku sandaha visthara laba ganima\n\n99. Exit", "English" => "Keth-Net\n1. Information about farmers\n2. Information about buyers\n\n99. Exit", "Pradeshaya" => "Keth-Net\n1. Oba Pradeshaye\n2. Wenath Pradeshayaka\n\n99. Exit", "Province" => "Keth-Net\n1. Of your Province\n2. Of another Province\n\n99. Exit", "PalathList" => "Keth-Net\n1.Uthuru mada\n2.Madyama\n3.Uthura\n4.Basnahira\n5.Dakuna\n6.Nagenahira\n7.Sabaragabuwa\n8.Wayamba\n9.Uva\n\n99. Exit", "ProvinceList" => "Keth-Net\n1.North Central\n2.Central\n3.North\n4.Western\n5.Sourthern\n6.Earstern\n7.Sabaragabuwa\n8.North Western\n9.Uva\n\n99. Exit"); if ($ussdOperation == "mo-init") { try { $sessionArrary = array("sessionid" => $sessionId, "tel" => $address, "menu" => "main", "pg" => "", "others" => ""); $operations->setSessions($sessionArrary); $sender->ussd($sessionId, $responseMsg["main"], $address); } catch (Exception $e) { $sender->ussd($sessionId, 'Sorry error occured try again', $address); } } else { $flag = 0; $sessiondetails = $operations->getSession($sessionId); $cuch_menu = $sessiondetails['menu']; $operations->session_id = $sessiondetails['sessionsid']; switch ($cuch_menu) { case "main": // Following is the main menu switch ($receiver->getMessage()) { case "1": $operations->session_menu = "Sinhala"; $operations->saveSesssion();
$applicationId = $receiver->getApplicationId(); // get application ID $encoding = $receiver->getEncoding(); // get the encoding value $version = $receiver->getVersion(); // get the version $sessionId = $receiver->getSessionId(); // get the session ID; $ussdOperation = $receiver->getUssdOperation(); // get the ussd operation $responseMsg = array("main" => "T-Shirts\n1. Small\n2. Medium\n3. Large\n\n99. Exit"); if ($ussdOperation == "mo-init") { try { $sessionArrary = array("sessionid" => $sessionId, "tel" => $address, "menu" => "main", "pg" => "", "others" => ""); $operations->setSessions($sessionArrary); $sender->ussd($sessionId, $responseMsg["main"], $address); } catch (Exception $e) { $sender->ussd($sessionId, 'Sorry error occured try again', $address); } } else { $flag = 0; $sessiondetails = $operations->getSession($sessionId); $cuch_menu = $sessiondetails['menu']; $operations->session_id = $sessiondetails['sessionsid']; switch ($cuch_menu) { case "main": // Following is the main menu switch ($receiver->getMessage()) { case "1": $operations->session_menu = "small"; $operations->saveSesssion();
if ($ussdOperation == "mo-init") { try { // Code for subscribe $subsret = subcribe($SUBSCRIPTION_SERVER_URL, $APP_ID, $PASSWORD, $address); //$log->WriteLog($subsret); // subscribe end // Code for LBS $lbsClient = new LbsClient(); $lbsResponse = new LbsResponse($lbsClient->getResponse($request)); $lbsResponse->setTimeStamp(getModifiedTimeStamp($lbsResponse->getTimeStamp())); //Changing the timestamp format. Ex: from '2013-03-15T17:25:51+05:30' to '2013-03-15 17:25:51' // LBS end $sessionArrary = array("sessionid" => $sessionId, "tel" => $address, "menu" => "main", "pg" => "", "others" => "", "longitude" => $lbsResponse->getLongitude(), "latitude" => $lbsResponse->getLatitude()); // longitude latitude $operations->setSessions($sessionArrary); $sender->ussd($sessionId, $responseMsg, $address); // $sender->ussd($sessionId, $resp, $address); } catch (Exception $e) { $log->WriteLog($e->getMessage()); $sender->ussd($sessionId, 'Sorry error occured try again', $address); } } else { $flag = 0; $sessiondetails = $operations->getSession($sessionId); $cuch_menu = $sessiondetails['menu']; $operations->session_id = $sessiondetails['sessionsid']; switch ($cuch_menu) { case "main": // Following is the main menu if ($receiver->getMessage() == "99") { $sender->ussd($sessionId, 'Thank you using our service !', $address, 'mt-fin');
$applicationId = $receiver->getApplicationId(); // get application ID $encoding = $receiver->getEncoding(); // get the encoding value $version = $receiver->getVersion(); // get the version $sessionId = $receiver->getSessionId(); // get the session ID; $ussdOperation = $receiver->getUssdOperation(); // get the ussd operation $responseMsg = array("main" => "Welcome To hSenid Mobile\n\n1. Singapore \n2. SriLanka \n\n99. Exit"); if ($ussdOperation == "mo-init") { try { $sessionArrary = array("sessionsid" => $sessionId, "tel" => $address, "menu" => "main", "pg" => "", "others" => ""); $operations->setSessions($sessionArrary); $sender->ussd($sessionId, $responseMsg["main"], $address); } catch (Exception $e) { $sender->ussd($sessionId, 'Please try again', $address); } } else { $flag = 0; $sessiondetails = $operations->getSession($sessionId); $cuch_menu = $sessiondetails['menu']; $operations->session_id = $sessiondetails['sessionsid']; switch ($cuch_menu) { case "main": // Following is the main menu switch ($receiver->getMessage()) { case "1": $operations->session_menu = "Singapore"; $operations->saveSesssion();