fix utf8 chars in sms and add tool to quota to check if a text is gsm0338 compatible

This commit is contained in:
osaajani 2021-11-05 23:59:38 +01:00
parent a39c9577b1
commit d826762e9d
2 changed files with 32 additions and 7 deletions

View file

@ -11,6 +11,7 @@
namespace adapters;
use controllers\internals\Quota;
use controllers\internals\Tool;
use descartes\Router;
@ -25,6 +26,10 @@ class KannelAdapter implements AdapterInterface
const KANNEL_SENDSMS_HTTP_CODE_ACCEPTED = 202;
const KANNEL_SENDSMS_HTTP_CODE_QUEUED = 202;
const KANNEL_CODING_7_BITS = 0;
const KANNEL_CODING_8_BITS = 1;
const KANNEL_CODING_UCS_2 = 2;
/**
* DLR mask to transmit to kannel
*
@ -285,6 +290,13 @@ class KannelAdapter implements AdapterInterface
'dlr-url' => $forged_dlr_url,
];
//If necessary, use utf8 sms to represent special chars
$use_utf8_sms = !Quota::is_gsm0338($text);
if ($use_utf8_sms)
{
$data['coding'] = self::KANNEL_CODING_8_BITS;
}
if ($this->smsc)
{
$data['smsc'] = $this->smsc;