fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [7424] sms: add pswin gateway


From: Sigurd Nes
Subject: [Fmsystem-commits] [7424] sms: add pswin gateway
Date: Thu, 23 Jun 2011 14:08:54 +0000

Revision: 7424
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7424
Author:   sigurdne
Date:     2011-06-23 14:08:54 +0000 (Thu, 23 Jun 2011)
Log Message:
-----------
sms: add pswin gateway

Added Paths:
-----------
    trunk/sms/inc/plugin/gateway/pswin/
    trunk/sms/inc/plugin/gateway/pswin/README
    trunk/sms/inc/plugin/gateway/pswin/SMSService.php
    trunk/sms/inc/plugin/gateway/pswin/get.php
    trunk/sms/inc/plugin/gateway/pswin/index.html
    trunk/sms/inc/plugin/gateway/pswin/send.php

Added: trunk/sms/inc/plugin/gateway/pswin/README
===================================================================
--- trunk/sms/inc/plugin/gateway/pswin/README                           (rev 0)
+++ trunk/sms/inc/plugin/gateway/pswin/README   2011-06-23 14:08:54 UTC (rev 
7424)
@@ -0,0 +1,17 @@
+PlaySMS gateway module for pswin
+
+Need a config-section named 'pswin' with values:
+
+array
+(
+       'wsdl'                  => 'http://sms.pswin.com/SOAP/SMS.asmx?wsdl'// 
using SOAP
+       'send_url'              => // using GET
+       'service_url'   => 'http://sms.pswin.com/SOAP/SMS.asmx'// using SOAP
+       'login'                 =>
+       'password'              =>
+       'proxy_host'    =>
+       'proxy_port'    =>
+       'originator'    =>
+       'type'                  => SOAP / GET
+);
+


Property changes on: trunk/sms/inc/plugin/gateway/pswin/README
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/sms/inc/plugin/gateway/pswin/SMSService.php
===================================================================
--- trunk/sms/inc/plugin/gateway/pswin/SMSService.php                           
(rev 0)
+++ trunk/sms/inc/plugin/gateway/pswin/SMSService.php   2011-06-23 14:08:54 UTC 
(rev 7424)
@@ -0,0 +1,479 @@
+<?php
+       /**
+       * phpGroupWare
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2011 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package phpgroupware
+       * @subpackage communication
+       * @category core
+       * @version $Id: SMSService.php 4237 2009-11-27 23:17:21Z sigurd $
+       */
+
+       /*
+          This program is free software: you can redistribute it and/or modify
+          it under the terms of the GNU General Public License as published by
+          the Free Software Foundation, either version 2 of the License, or
+          (at your option) any later version.
+
+          This program is distributed in the hope that it will be useful,
+          but WITHOUT ANY WARRANTY; without even the implied warranty of
+          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+          GNU General Public License for more details.
+
+          You should have received a copy of the GNU General Public License
+          along with this program.  If not, see <http://www.gnu.org/licenses/>.
+        */
+
+       /**
+        * soap client for pswin.com SMS service
+        * this code is generated by the 
http://code.google.com/p/wsdl2php-interpreter/ 
+        *
+        * @package phpgroupware
+        * @subpackage sms
+        */
+       
+       
+       /**
+        * SendSingleMessage
+        */
+       class SendSingleMessage
+       {
+               /**
+                * @access public
+                * @var sstring
+                */
+               public $username;
+               /**
+                * @access public
+                * @var sstring
+                */
+               public $password;
+               /**
+                * @access public
+                * @var SMSMessage
+                */
+               public $m;
+       }
+       
+       /**
+        * SMSMessage
+        */
+       class SMSMessage
+       {
+               /**
+                * @access public
+                * @var sstring
+                */
+               public $ReceiverNumber;
+               /**
+                * @access public
+                * @var sstring
+                */
+               public $SenderNumber;
+               /**
+                * @access public
+                * @var sstring
+                */
+               public $Text;
+               /**
+                * @access public
+                * @var sstring
+                */
+               public $Network;
+               /**
+                * @access public
+                * @var sstring
+                */
+               public $TypeOfMessage;
+               /**
+                * @access public
+                * @var sint
+                */
+               public $Tariff;
+               /**
+                * @access public
+                * @var sint
+                */
+               public $TimeToLive;
+               /**
+                * @access public
+                * @var sstring
+                */
+               public $CPATag;
+               /**
+                * @access public
+                * @var sboolean
+                */
+               public $RequestReceipt;
+               /**
+                * @access public
+                * @var sstring
+                */
+               public $SessionData;
+               /**
+                * @access public
+                * @var sstring
+                */
+               public $AffiliateProgram;
+               /**
+                * @access public
+                * @var sstring
+                */
+               public $DeliveryTime;
+               /**
+                * @access public
+                * @var sstring
+                */
+               public $ServiceCode;
+       }
+
+       /**
+        * SendSingleMessageResponse
+        */
+       class SendSingleMessageResponse
+       {
+               /**
+                * @access public
+                * @var ReturnValue
+                */
+               public $SendSingleMessageResult;
+       }
+
+       /**
+        * ReturnValue
+        */
+       class ReturnValue
+       {
+               /**
+                * @access public
+                * @var sint
+                */
+               public $Code;
+               /**
+                * @access public
+                * @var sstring
+                */
+               public $Description;
+               /**
+                * @access public
+                * @var sstring
+                */
+               public $Reference;
+       }
+       
+       /**
+        * SendMessages
+        */
+       class SendMessages
+       {
+               /**
+                * @access public
+                * @var sstring
+                */
+               public $username;
+               /**
+                * @access public
+                * @var sstring
+                */
+               public $password;
+               /**
+                * @access public
+                * @var ArrayOfSMSMessage
+                */
+               public $m;
+       }
+       
+       /**
+        * SendMessagesResponse
+        */
+       class SendMessagesResponse {
+               /**
+                * @access public
+                * @var ArrayOfReturnValue
+                */
+               public $SendMessagesResult;
+       }
+
+       /**
+        * SendSingleWapPush
+        */
+       class SendSingleWapPush
+       {
+               /**
+                * @access public
+                * @var sstring
+                */
+               public $username;
+               /**
+                * @access public
+                * @var sstring
+                */
+               public $password;
+               /**
+                * @access public
+                * @var WapPushMessage
+                */
+               public $m;
+       }
+
+       /**
+        * WapPushMessage
+        */
+       class WapPushMessage
+       {
+               /**
+                * @access public
+                * @var sstring
+                */
+               public $ReceiverNumber;
+               /**
+                * @access public
+                * @var sstring
+                */
+               public $SenderNumber;
+               /**
+                * @access public
+                * @var sstring
+                */
+               public $Url;
+               /**
+                * @access public
+                * @var sstring
+                */
+               public $Description;
+               /**
+                * @access public
+                * @var sstring
+                */
+               public $Network;
+               /**
+                * @access public
+                * @var sint
+                */
+               public $Tariff;
+               /**
+                * @access public
+                * @var sint
+                */
+               public $TimeToLive;
+               /**
+                * @access public
+                * @var sstring
+                */
+               public $CPATag;
+               /**
+                * @access public
+                * @var sboolean
+                */
+               public $RequestReceipt;
+               /**
+                * @access public
+                * @var sstring
+                */
+               public $SessionData;
+               /**
+                * @access public
+                * @var sstring
+                */
+               public $AffiliateProgram;
+               /**
+                * @access public
+                * @var sstring
+                */
+               public $DeliveryTime;
+       }
+
+       /**
+        * SendSingleWapPushResponse
+        */
+       class SendSingleWapPushResponse
+       {
+               /**
+                * @access public
+                * @var ReturnValue
+                */
+               public $SendSingleWapPushResult;
+       }
+
+       /**
+        * SendMultipleWapPush
+        */
+       class SendMultipleWapPush
+       {
+               /**
+                * @access public
+                * @var sstring
+                */
+               public $username;
+               /**
+                * @access public
+                * @var sstring
+                */
+               public $password;
+               /**
+                * @access public
+                * @var ArrayOfWapPushMessage
+                */
+               public $m;
+       }
+
+       /**
+        * SendMultipleWapPushResponse
+        */
+       class SendMultipleWapPushResponse {
+               /**
+                * @access public
+                * @var ArrayOfReturnValue
+                */
+               public $SendMultipleWapPushResult;
+       }
+
+       /**
+        * SMSService
+        * @author WSDLInterpreter
+        */
+       class SMSService extends SoapClient
+       {
+               /**
+                * Default class map for wsdl=>php
+                * @access private
+                * @var array
+                */
+               private static $classmap = array(
+                       "SendSingleMessage" => "SendSingleMessage",
+                       "SMSMessage" => "SMSMessage",
+                       "SendSingleMessageResponse" => 
"SendSingleMessageResponse",
+                       "ReturnValue" => "ReturnValue",
+                       "SendMessages" => "SendMessages",
+                       "SendMessagesResponse" => "SendMessagesResponse",
+                       "SendSingleWapPush" => "SendSingleWapPush",
+                       "WapPushMessage" => "WapPushMessage",
+                       "SendSingleWapPushResponse" => 
"SendSingleWapPushResponse",
+                       "SendMultipleWapPush" => "SendMultipleWapPush",
+                       "SendMultipleWapPushResponse" => 
"SendMultipleWapPushResponse",
+               );
+       
+               /**
+                * Constructor using wsdl location and options array
+                * @param string $wsdl WSDL location for this service
+                * @param array $options Options for the SoapClient
+                */
+               public function 
__construct($wsdl="http://sms.pswin.com/SOAP/SMS.asmx?wsdl";, $options=array())
+               {
+                       foreach(self::$classmap as $wsdlClassName => 
$phpClassName) {
+                           if(!isset($options['classmap'][$wsdlClassName])) {
+                               $options['classmap'][$wsdlClassName] = 
$phpClassName;
+                           }
+                       }
+                       parent::__construct($wsdl, $options);
+               }
+       
+               /**
+                * Checks if an argument list matches against a valid argument 
type list
+                * @param array $arguments The argument list to check
+                * @param array $validParameters A list of valid argument types
+                * @return boolean true if arguments match against 
validParameters
+                * @throws Exception invalid function signature message
+                */
+               public function _checkArguments($arguments, $validParameters)
+               {
+                       $variables = "";
+                       foreach ($arguments as $arg) {
+                           $type = gettype($arg);
+                           if ($type == "object") {
+                               $type = get_class($arg);
+                           }
+                           $variables .= "(".$type.")";
+                       }
+                       if (!in_array($variables, $validParameters)) {
+                           throw new Exception("Invalid parameter types: 
".str_replace(")(", ", ", $variables));
+                       }
+                       return true;
+               }
+       
+               /**
+                * Service Call: SendSingleMessage
+                * Parameter options:
+                * (SendSingleMessage) parameters
+                * (SendSingleMessage) parameters
+                * @param mixed,... See function description for parameter 
options
+                * @return SendSingleMessageResponse
+                * @throws Exception invalid function signature message
+                */
+               public function SendSingleMessage($mixed = null)
+               {
+                       $validParameters = array(
+                               "(SendSingleMessage)",
+                               "(SendSingleMessage)",
+                       );
+                       $args = func_get_args();
+                       $this->_checkArguments($args, $validParameters);
+                       return $this->__soapCall("SendSingleMessage", $args);
+               }
+       
+       
+               /**
+                * Service Call: SendMessages
+                * Parameter options:
+                * (SendMessages) parameters
+                * (SendMessages) parameters
+                * @param mixed,... See function description for parameter 
options
+                * @return SendMessagesResponse
+                * @throws Exception invalid function signature message
+                */
+               public function SendMessages($mixed = null)
+               {
+                       $validParameters = array(
+                               "(SendMessages)",
+                               "(SendMessages)",
+                       );
+                       $args = func_get_args();
+                       $this->_checkArguments($args, $validParameters);
+                       return $this->__soapCall("SendMessages", $args);
+               }
+       
+       
+               /**
+                * Service Call: SendSingleWapPush
+                * Parameter options:
+                * (SendSingleWapPush) parameters
+                * (SendSingleWapPush) parameters
+                * @param mixed,... See function description for parameter 
options
+                * @return SendSingleWapPushResponse
+                * @throws Exception invalid function signature message
+                */
+               public function SendSingleWapPush($mixed = null)
+               {
+                       $validParameters = array(
+                               "(SendSingleWapPush)",
+                               "(SendSingleWapPush)",
+                       );
+                       $args = func_get_args();
+                       $this->_checkArguments($args, $validParameters);
+                       return $this->__soapCall("SendSingleWapPush", $args);
+               }
+       
+       
+               /**
+                * Service Call: SendMultipleWapPush
+                * Parameter options:
+                * (SendMultipleWapPush) parameters
+                * (SendMultipleWapPush) parameters
+                * @param mixed,... See function description for parameter 
options
+                * @return SendMultipleWapPushResponse
+                * @throws Exception invalid function signature message
+                */
+               public function SendMultipleWapPush($mixed = null)
+               {
+                       $validParameters = array(
+                               "(SendMultipleWapPush)",
+                               "(SendMultipleWapPush)",
+                       );
+                       $args = func_get_args();
+                       $this->_checkArguments($args, $validParameters);
+                       return $this->__soapCall("SendMultipleWapPush", $args);
+               }
+       }

Added: trunk/sms/inc/plugin/gateway/pswin/get.php
===================================================================
--- trunk/sms/inc/plugin/gateway/pswin/get.php                          (rev 0)
+++ trunk/sms/inc/plugin/gateway/pswin/get.php  2011-06-23 14:08:54 UTC (rev 
7424)
@@ -0,0 +1,137 @@
+<?php
+
+       class sms_sms_ extends sms_sms__
+       {
+               function __construct()
+               {
+                       parent::__construct();
+                       $this->pswin_param = 
$GLOBALS['phpgw_info']['sms_config']['pswin'];
+               }
+
+               function gw_customcmd()
+               {
+                   // nothing
+               }
+
+               function 
gw_set_delivery_status($gp_code="",$uid="",$smslog_id="",$p_datetime="",$p_update="")
+               {
+return;
+                   // p_status :
+                   // 0 = pending
+                   // 1 = delivered
+                   // 2 = failed
+
+                       if($result['statuscode'] == 1)
+                       {
+                           $this->setsmsdeliverystatus($smslog_id,$uid,1);     
                
+                       }
+                       else if($result['statuscode'] == 5)
+                       {
+                           $this->setsmsdeliverystatus($smslog_id,$uid,2);     
                
+                       }
+
+                   return;
+               }
+
+
+               function check_for_new_mail()
+               {
+                       if(!isset($this->pswin_param['email_user']) || ! 
$this->pswin_param['email_user'])
+                       {
+                           throw new Exception('Email user not defined');      
                
+                       }
+
+                       $account_id = 
$GLOBALS['phpgw']->accounts->name2id($this->pswin_param['email_user']);
+
+                       $GLOBALS['phpgw_info']['user']['account_id'] = 
$account_id;
+                       $GLOBALS['phpgw']->preferences->account_id = 
$account_id;
+                       $pref = $GLOBALS['phpgw']->preferences->read();
+                       
$GLOBALS['phpgw_info']['user']['preferences']['felamimail'] = 
isset($pref['felamimail']) ? $pref['felamimail'] : '';
+
+                       $boPreferences  = 
CreateObject('felamimail.bopreferences');
+                       $boPreferences->setProfileActive(true,2); //2 for 
selected user
+                       $bofelamimail   = 
CreateObject('felamimail.bofelamimail');
+
+                       $connectionStatus = $bofelamimail->openConnection();
+                       $headers = $bofelamimail->getHeaders('INBOX', 1, 
$maxMessages = 15, $sort = 0, $_reverse = 1, $_filter = array('string' => '', 
'type' => 'quick', 'status' => 'unseen'));
+
+                       $sms = array();
+                       $j = 0;
+                       if (isset($headers['header']) && 
is_array($headers['header']))
+                       {
+                               foreach ($headers['header'] as $header)
+                               {
+                                       if(!$header['seen'])
+                                       {
+                                               $sms[$j]['uid'] = 
$header['uid'];
+                                               $sms[$j]['message'] = 
utf8_encode($header['subject']);
+                                               $bodyParts = 
$bofelamimail->getMessageBody($header['uid']);
+                                               $sms[$j]['message'] .= "\n";
+                                               for($i=0; $i<count($bodyParts); 
$i++ )
+                                               {
+                                                       $sms[$j]['message'] .= 
utf8_encode($bodyParts[$i]['body']) . "\n";
+                                               }
+
+                                               $sms[$j]['message'] = 
substr($sms[$j]['message'],0,160);
+                                               $j++;
+                                       }
+                               }
+                       }
+
+                       foreach($sms as $entry)
+                       {
+                               $sms_datetime   = $entry[''];
+                               $sms_sender             = $entry[''];
+                               $target_code    = $entry[''];
+                               $message                = $entry['message'];
+                               
+                               if 
(!parent::setsmsincomingaction($sms_datetime,$sms_sender,$target_code,$message))
+                               {
+                                       $bofelamimail->flagMessages($_flag = 
'unread', array($entry['uid']));
+                               }                       
+                       }
+
+                       if($connectionStatus == 'true')
+                       {
+                               $bofelamimail->closeConnection();
+                       }
+               }
+
+
+               function gw_set_incoming_action()
+               {
+                       $this->check_for_new_mail();
+                       
+return;
+                   $handle = @opendir($this->pswin_param[path] . 
"/cache/smsd");
+                   while ($sms_in_file = @readdir($handle))
+                   {
+                               if (preg_match("/^ERR.in/i",$sms_in_file) && 
!preg_match("/^[.]/",$sms_in_file))
+                               {
+                                   $fn = $this->pswin_param[path] . 
"/cache/smsd/$sms_in_file";
+                                   $tobe_deleted = $fn;
+                                   $lines = @file ($fn);
+                                   $sms_datetime = trim($lines[0]);
+                                   $sms_sender = trim($lines[1]);
+                                   $message = "";
+                                   for ($lc=2;$lc<count($lines);$lc++)
+                                   {
+                                       $message .= trim($lines[$lc]);
+                                   }
+                                   $array_target_code = explode(" ",$message);
+                                   $target_code = 
strtoupper(trim($array_target_code[0]));
+                                   $message = $array_target_code[1];
+                                   for ($i=2;$i<count($array_target_code);$i++)
+                                   {
+                                               $message .= " 
".$array_target_code[$i];
+                                   }
+                                   // collected:
+                                   // $sms_datetime, $sms_sender, 
$target_code, $message
+                                   if 
($this->setsmsincomingaction($sms_datetime,$sms_sender,$target_code,$message))
+                                   {
+                                               @unlink($tobe_deleted);
+                                   }
+                               }
+                   }
+               }
+       }


Property changes on: trunk/sms/inc/plugin/gateway/pswin/index.html
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/sms/inc/plugin/gateway/pswin/send.php
===================================================================
--- trunk/sms/inc/plugin/gateway/pswin/send.php                         (rev 0)
+++ trunk/sms/inc/plugin/gateway/pswin/send.php 2011-06-23 14:08:54 UTC (rev 
7424)
@@ -0,0 +1,170 @@
+<?php
+
+       class sms_sms extends sms_sms_
+       {
+               function __construct()
+               {
+                       parent::__construct();
+                       $this->pswin_param = 
$GLOBALS['phpgw_info']['sms_config']['pswin'];
+               }
+
+               function parse_html( $s_str )
+               {
+                       $i_left = 0;
+                       $i_right = 0;
+                       $vars = array();
+                       // Search for a tag in string
+                       while( is_int(($i_left = 
strpos($s_str,"<!--",$i_right)))) 
+                       {
+                               $i_left = $i_left + 4;
+                               $i_right = strpos($s_str,"-->", $i_left);
+                               $s_temp = substr($s_str, $i_left, 
($i_right-$i_left) );
+                               $a_tag = explode('=', $s_temp );
+                               $vars[strtolower($a_tag[0])] = $a_tag[1];
+                       }
+                       return $vars;
+               }
+
+
+               function 
gw_send_sms($mobile_sender,$sms_sender,$sms_to,$sms_msg,$gp_code="",$uid="",$smslog_id="",$flash=false)
+               {
+                       $result = array();
+//                     $sms_msg = utf8_decode($sms_msg);
+                       
+                       $sms_to = ltrim($sms_to, '+');
+                       
+                       if( strlen($sms_to) < 9)
+                       {
+                               $sms_to = "47{$sms_to}";
+                       }
+
+                       $arguments = array
+                       (
+                               'type'                          => '1', // text
+                               'serviceid'                     => 
$this->pswin_param['serviceid'], //Unique identifier for service. Provided by 
pswin.
+//                             'servicename'           => '',  //Unique 
identifier for service. Provided by pswin.
+                               'content'                       => 
utf8_decode($sms_msg),
+//                             'uri'                           =>  '',// Y if 
WAP push Used by WAP Push type, indicates the URL to be contained in wap push.
+                               'originator'            => 
$this->pswin_param['originator'],//$GLOBALS['phpgw_info']['sms_config']['common']['gateway_number'],//$sms_sender,
+                               'originatortype'        => 
$this->pswin_param['originatortype'],//$this->pswin_param['originatortype'], 
//'The originator type, e.g. alphanumeric 1 = International number (e.g. 
+4741915558) 2 = Alphanumeric (e.g. pswin) max 11 chars 3 = Network specific 
(e.g. 1960) 4 = National number (e.g. 41915558)'
+                               'recipient'                     => $sms_to,
+                               'username'                      => 
$this->pswin_param['login'],
+                               'password'                      => 
$this->pswin_param['password'],
+//                             'priority'                      => '',
+//                             'price'                         => '0',
+                               'differentiator'        => 
$this->pswin_param['differentiator'],//'Test',
+//                             'TTL'                           => ''
+
+                       );
+
+                       if($this->pswin_param['type'] == 'GET')
+                       {
+                               $query = http_build_query($arguments);
+                               $request = 
"{$this->pswin_param['send_url']}?{$query}";
+
+                               $aContext = array
+                               (
+                                       'http' => array
+                                       (
+                                               'proxy' => 
"{$this->pswin_param['proxy_host']}:{$this->pswin_param['proxy_port']}", // 
This needs to be the server and the port of the NTLM Authentication Proxy 
Server.
+                                               'request_fulluri' => True,
+                                       ),
+                               );
+
+                               $cxContext = stream_context_create($aContext);
+
+                               $response = file_get_contents($request, False, 
$cxContext);
+
+                               $result = $this->parse_html($response);
+                       }
+                       else
+                       {
+                               require_once 'SMSService.php';
+
+                               $options=array();
+                               $options['soap_version'] = SOAP_1_1;
+                               $options['location'] = 
$this->pswin_param['service_url'];
+                               $options['uri']         = 
"http://sms.pswin.com/SOAP/SMS.asmx";;
+                               $options['trace']               = 1;
+                               $options['proxy_host']  = 
$this->pswin_param['proxy_host'];
+                               $options['proxy_port']  = 
$this->pswin_param['proxy_port'];
+                               $options['encoding']    = 
'iso-8859-1';//'UTF-8';
+
+                               $service = new 
SMSService($this->pswin_param['wsdl'], $options);
+
+                               $SMSMessage = new SMSMessage();
+
+                               $SMSMessage->ReceiverNumber = 
(string)$arguments['recipient'];
+                               $SMSMessage->SenderNumber = 
(string)$this->pswin_param['originator'];
+                               $SMSMessage->Text = 
(string)$arguments['content'];
+                               $SMSMessage->Network = (string)'';
+                               $SMSMessage->TypeOfMessage = (string)'Text';
+                               $SMSMessage->Tariff = (int)0;
+                               $SMSMessage->TimeToLive = (int)0;
+                               $SMSMessage->CPATag = '';
+                               $SMSMessage->RequestReceipt = (bool)false;
+                               $SMSMessage->SessionData = (string)'';
+                               $SMSMessage->AffiliateProgram = (string)'';
+                               $SMSMessage->DeliveryTime = (string)'';
+                               $SMSMessage->ServiceCode = (string)'';
+
+                               $SendSingleMessage = new SendSingleMessage();
+                               $SendSingleMessage->username = 
$this->pswin_param['login'];
+                               $SendSingleMessage->password = 
$this->pswin_param['password'];
+                               $SendSingleMessage->m = $SMSMessage;
+
+                               
+                               $ReturnValue = 
$service->SendSingleMessage($SendSingleMessage);
+
+                               $result['statuscode'] = 
$ReturnValue->SendSingleMessageResult->Code;
+                               $result['messageid'] = 
$ReturnValue->SendSingleMessageResult->Reference;
+                               $result['description'] = 
$ReturnValue->SendSingleMessageResult->Description;
+
+                       }
+
+                   // p_status :
+                   // 0 = pending
+                   // 1 = delivered
+                   // 2 = failed
+
+                   // p_status :
+                   // 500 = pending
+                   // 200 = delivered
+                   // 100 = failed
+
+
+                       if( $result['statuscode'] == 200)
+                       {
+                           $this->setsmsdeliverystatus($smslog_id,$uid,1);
+                           $ret = true;                
+                       }
+                       else if( $result['statuscode'] == 100)
+                       {
+                           $this->setsmsdeliverystatus($smslog_id,$uid,2);     
                
+                           $ret = false;
+                               throw new Exception($result['description']);
+                       }
+
+                       return $ret;
+               }
+
+               function 
gw_set_delivery_status($gp_code="",$uid="",$smslog_id="",$p_datetime="",$p_update="")
+               {
+return;
+                   // p_status :
+                   // 0 = pending
+                   // 1 = delivered
+                   // 2 = failed
+
+                       if($result['statuscode'] == 1)
+                       {
+                           $this->setsmsdeliverystatus($smslog_id,$uid,1);     
                
+                       }
+                       else if($result['statuscode'] == 5)
+                       {
+                           $this->setsmsdeliverystatus($smslog_id,$uid,2);     
                
+                       }
+
+                   return;
+               }
+       }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]