create full number from the given national number
authorChristian Weiske <cweiske@cweiske.de>
Thu, 2 Aug 2012 16:13:55 +0000 (18:13 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Thu, 2 Aug 2012 16:13:55 +0000 (18:13 +0200)
src/callnotifier/CallMonitor.php
src/callnotifier/EDSS1/Parameter/Names.php

index 682008a..ebc9a50 100644 (file)
@@ -79,14 +79,27 @@ class CallMonitor
         foreach ($msg->parameters as $param) {
             switch ($param->type) {
             case EDSS1_Parameter::CALLING_PARTY_NUMBER:
-                $call->from = $param->number;
+                $call->from = $this->getFullNumber(
+                    $param->number, $param->numberType
+                );
                 break;
             case EDSS1_Parameter::CALLED_PARTY_NUMBER:
-                $call->to = $param->number;
+                $call->to = $this->getFullNumber(
+                    $param->number, $param->numberType
+                );
                 break;
             }
         }
     }
+
+
+    protected function getFullNumber($number, $type)
+    {
+        if ($type == EDSS1_Parameter_Names::NUMBER_NATIONAL) {
+            return '0' . $number;
+        }
+        return $number;
+    }
 }
 
 ?>
index cb6caef..f384dcf 100644 (file)
@@ -6,6 +6,13 @@ namespace callnotifier;
  */
 class EDSS1_Parameter_Names extends EDSS1_Parameter
 {
+    const NUMBER_UNKNOWN = 0;
+    const NUMBER_INTERNATIONAL = 1;
+    const NUMBER_NATIONAL = 2;
+    const NUMBER_NETWORKSPECIFIC = 3;
+    const NUMBER_SUBSCRIBER = 4;
+    const NUMBER_ABBREV = 5;
+
     static $numberTypes = array(
         0 => 'Unknown',
         1 => 'International number',