aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/callnotifier/EDSS1/Message.php13
-rw-r--r--src/callnotifier/EDSS1/Parser.php16
2 files changed, 26 insertions, 3 deletions
diff --git a/src/callnotifier/EDSS1/Message.php b/src/callnotifier/EDSS1/Message.php
index 08fa44f..4c3bd68 100644
--- a/src/callnotifier/EDSS1/Message.php
+++ b/src/callnotifier/EDSS1/Message.php
@@ -27,6 +27,19 @@ class EDSS1_Message
public $callRef;
/**
+ * Service AccessPoint Identifier
+ */
+ public $sapi;
+
+ /**
+ * Call/Response bit
+ *
+ * Is 1 when the message contains a command or
+ * the answer to a command.
+ */
+ public $callResponse;
+
+ /**
* Terminal Endpoint Identifier (internal Telephone ID)
*
* @var integer
diff --git a/src/callnotifier/EDSS1/Parser.php b/src/callnotifier/EDSS1/Parser.php
index 64a072e..fb70749 100644
--- a/src/callnotifier/EDSS1/Parser.php
+++ b/src/callnotifier/EDSS1/Parser.php
@@ -10,10 +10,16 @@ class EDSS1_Parser
public function parse($bytes)
{
$m = new EDSS1_Message();
- $m->tei = ord($bytes{1}) >> 1;//1st bit is always 1 and needs to be removed
+ $m->sapi = ord($bytes{0}) >> 2;
+ $m->callResponse = (int) ((ord($bytes{0}) & 2) == 2);
+ $m->tei = ord($bytes{1}) >> 1;
$curpos = 4;
- list($curpos, $m->callRef) = $this->readLengthDataInt($bytes, ++$curpos);
+ list($curpos, $cCallRef, $crLen) = $this->readLengthData($bytes, ++$curpos);
+ if ($crLen == 0xFF) {
+ return $m;
+ }
+ $m->callRef = ord($cCallRef);
//var_dump($curpos, dechex($m->callRef));
$m->type = ord($bytes{++$curpos});
@@ -50,7 +56,11 @@ class EDSS1_Parser
{
//var_dump('old' . $curpos);
$length = ord($bytes{$curpos});
- $data = substr($bytes, $curpos + 1, $length);
+ if ($length != 0xFF) {
+ $data = substr($bytes, $curpos + 1, $length);
+ } else {
+ $data = null;
+ }
return array($curpos + $length, $data, $length);
}