use integer codes, not strings
[auerswald-callnotifier.git] / src / callnotifier / EDSS1 / Parser.php
index 0c9b86adfcc7a4fc90fa2833133366f65114df7f..b5a906d07408566970fb745d5bc3a60e94d5396a 100644 (file)
@@ -19,8 +19,17 @@ class EDSS1_Parser
         if ($crLen == 0xFF) {
             return $m;
         }
-        $m->callRef = ord($cCallRef);
-        //var_dump($curpos, dechex($m->callRef));
+        if ($crLen > 0) {
+            $m->callRefType = ord($cCallRef{0}) >> 7;
+            $nCallRef = ord($cCallRef{0}) & 127;
+            if ($crLen > 1) {
+                $nCallRef = ord($cCallRef{1}) + ($nCallRef << 8);
+                if ($crLen > 2) {
+                    $nCallRef = ord($cCallRef{2}) + ($nCallRef << 8);
+                }
+            }
+            $m->callRef = $nCallRef;
+        }
         $m->type = ord($bytes{++$curpos});
 
         $complete = false;