d46ac961 by G Manojkumar

new SmsTemplate and sms to send DB

1 parent 5a3827d2
1 <?php 1 <?php
2 define('SMS_NOTCONTACTED',1); 2 define('SMS_NOTCONTACTED',1);
3 define('SMS_THANKYOU',2); 3 define('SMS_THANKYOU',2);
4 $smsContactedSubdispositionsArr = array ('Contacted'); 4 $smsContactedSubdispositionsArr = array ('Contacted','Feedback');
5 $smsNotContactedSubdispositionsArr = array ( 5 $smsNotContactedSubdispositionsArr = array (
6 'NC - Customer Traveling / Abroad', 6 'NC - Customer Traveling / Abroad',
7 'NC - Customer in Meeting', 7 'NC - Customer in Meeting',
...@@ -12,8 +12,16 @@ ...@@ -12,8 +12,16 @@
12 ); 12 );
13 $smsTemplatesArr = array( 13 $smsTemplatesArr = array(
14 //SMS_NOTCONTACTED => "Dear Customer,Your Virtual Relationship Manager #name# from HDFC Bank tried reaching you. Kindly call #number# for all your banking and financial needs", 14 //SMS_NOTCONTACTED => "Dear Customer,Your Virtual Relationship Manager #name# from HDFC Bank tried reaching you. Kindly call #number# for all your banking and financial needs",
15 SMS_NOTCONTACTED =>"Dear Customer, Your Virtual RM #name# from HDFC Bank tried reaching you. Kindly call 022#number# for all your banking and financial needs.", 15 //SMS_NOTCONTACTED =>"Dear Customer, Your Virtual RM #name# from HDFC Bank tried reaching you. Kindly call #number# for all your banking and financial needs.",
16 SMS_NOTCONTACTED =>"Your RM is unable to contact you!
17 Call #name# @ #number# for any banking need.
18 Check & invest in our FD/RD @best rate.
19 Click here: bit.ly/2TqCdKA",
16 //SMS_THANKYOU =>"Thank you for speaking to your VirtualRM on #date# . Now also access your account 24/7 via NetBanking/MobileBanking. Download MobileBanking App: bit.ly/2ajTksK" 20 //SMS_THANKYOU =>"Thank you for speaking to your VirtualRM on #date# . Now also access your account 24/7 via NetBanking/MobileBanking. Download MobileBanking App: bit.ly/2ajTksK"
17 SMS_THANKYOU =>"Thank you for speaking to your Virtual RM on #date#. Now also access your account 24/7 via Net / Mobile Banking. Download Mobile App: bit.ly/2ajTksK" 21 //SMS_THANKYOU =>"Thank you for speaking to your Virtual RM on #date#. Now also access your account 24/7 via Net / Mobile Banking. Download Mobile App: bit.ly/2ajTksK"
22 SMS_THANKYOU =>"Your opinion matters!
23 Thanks for talking & sharing your feedback on #number# with RM #name#
24 Check & invest in our FD/RD @best rate
25 Click: bit.ly/2TqCdKA"
18 ); 26 );
19 ?> 27 ?>
......
...@@ -4,23 +4,31 @@ use Illuminate\Http\Request; ...@@ -4,23 +4,31 @@ use Illuminate\Http\Request;
4 use App\Http\Requests; 4 use App\Http\Requests;
5 use Auth; 5 use Auth;
6 use Log; 6 use Log;
7 use DB;
7 class SmsController extends Controller 8 class SmsController extends Controller
8 { 9 {
9 public $smsUrl = 'https://10.2.55.165:443/servlet/com.aclwireless.pushconnectivity.listeners.TextListener?'; 10 public $smsUrl = 'https://10.2.55.165:443/servlet/com.aclwireless.pushconnectivity.listeners.TextListener?';
11 //public $userarray = array("A21568","admin");
10 public function sendSmsBasedOnSubDisposition($kstychCall) 12 public function sendSmsBasedOnSubDisposition($kstychCall)
11 { 13 {
14 //public $userarray = array("A21568","admin");
15 //$users = $this->userarray;
16 //Log::info(Auth::user()->username." ^ ".$users[0]);
17 //Log::info(in_array(Auth::user()->username , $users));
18 //if(in_array(Auth::user()->username , $users)){
12 $msgText = $this->getSmsTemplate($kstychCall); 19 $msgText = $this->getSmsTemplate($kstychCall);
13 if( !empty($msgText) ) { 20 if( !empty($msgText) ) {
14 $msgText = $this->fillValuesInTemplate($msgText); 21 $msgText = $this->fillValuesInTemplate($msgText);
15 Log::info($msgText); 22 //Log::info($msgText);
16 $this->sendSmsRequest($kstychCall, $msgText); 23 $this->sendSmsRequest($kstychCall, $msgText);
17 } 24 }
25 //}
18 return; 26 return;
19 } 27 }
20 public function sendSmsRequest($kstychCall, $msgText) 28 public function sendSmsRequest($kstychCall, $msgText)
21 { 29 {
22 $url = $this->smsUrl; 30 $url = $this->smsUrl;
23 Log::info($kstychCall['callnumber']); 31 //Log::info($kstychCall['callnumber']);
24 $inputArray = [ 32 $inputArray = [
25 'userId'=>'hdfcbalrt', 33 'userId'=>'hdfcbalrt',
26 "pass"=>'hdfcbalrt25', 34 "pass"=>'hdfcbalrt25',
...@@ -43,7 +51,15 @@ class SmsController extends Controller ...@@ -43,7 +51,15 @@ class SmsController extends Controller
43 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 51 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
44 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 52 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
45 $response = curl_exec($ch); 53 $response = curl_exec($ch);
46 Log::info($response); 54 $number=$kstychCall['callnumber'];
55 $callid=intval($kstychCall['callid'])+0;
56 $serverip=env(app_ip);
57 $rmname=Auth::user()->fullname;
58 $subdispo=$kstychCall["usersubstatus"];
59 DB::insert(DB::raw("insert into sms_log set server_ip='$serverip',call_id='$callid',rm_name='$rmname',subdispo='$subdispo',number='$number',message='$msgText',response='$response'"));
60 Log::useFiles(storage_path().'/logs/SMS_Messages_'.date("Y-m-d").'.log');
61 Log::info('|'.env(app_ip).'|'.date('Y-m-d H:i:s', strtotime('+5 hours 30 minutes')).'|'.Auth::user()->fullname.'|'.$kstychCall['callnumber'].'|"'.$msgText.'"|'.$response.'|');
62 //Log::info($response);
47 curl_close($ch); 63 curl_close($ch);
48 } catch(Exception $e) { 64 } catch(Exception $e) {
49 Log::info($e->getMessage()); 65 Log::info($e->getMessage());
...@@ -73,7 +89,7 @@ class SmsController extends Controller ...@@ -73,7 +89,7 @@ class SmsController extends Controller
73 $extenArr = explode(":", $extension); 89 $extenArr = explode(":", $extension);
74 $exten = $extenArr[0]; 90 $exten = $extenArr[0];
75 } 91 }
76 Log::info($exten); 92 //Log::info($exten);
77 93
78 $msgText = str_replace("#number#", $exten, $msgText); 94 $msgText = str_replace("#number#", $exten, $msgText);
79 $msgText = str_replace("#date#", date('d-m-Y'), $msgText); 95 $msgText = str_replace("#date#", date('d-m-Y'), $msgText);
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!