2
0
Эх сурвалжийг харах

Update Allowing Inbound SMS from Flowroute's new API format (#150)

* Update sms_email.php

Commenting out line 159 was it was causing sending emails to fail.

* Update sms_hook_flowroute.php

Update to receive SMS from Flowroute new API format.
mbarvoipdrs 4 жил өмнө
parent
commit
09eb3e1914

+ 4 - 2
sms/hook/sms_hook_flowroute.php

@@ -11,7 +11,8 @@ if (check_acl()) {
 		if ($debug) {
 			error_log('[SMS] REQUEST: ' .  print_r($data, true));
 		}
-		route_and_send_sms($data->from, $data->to, $data->body);	
+		$from = intval(preg_replace('/(^[1])/','', $data->data->attributes->from));
+		route_and_send_sms($from, $data->data->attributes->to, $data->data->attributes->body);	
 	} else {
 	  die("no");
 	}
@@ -19,4 +20,5 @@ if (check_acl()) {
 	error_log('ACCESS DENIED [SMS]: ' .  print_r($_SERVER['REMOTE_ADDR'], true));
 	die("access denied");
 }
-?>
+
+?>

+ 3 - 4
sms/sms_email.php

@@ -156,15 +156,14 @@ function send_sms_to_email($from, $to, $body, $media = null) {
 		//send email
 		$ok = send_email($email_to, $email_subject, $email_message);//, $headers);
 
-		if()
-
-		if($ok) {
+		if ($ok) {
 			error_log("[sms] Email Sent Successfully.");
 			return true;
-		}else {
+		} else {
 			error_log("[sms] Email could not be sent.");
 			return false;
 		}
 	}
 }
+
 ?>