collect parameters on information elements, too
authorChristian Weiske <cweiske@cweiske.de>
Wed, 1 Aug 2012 05:48:16 +0000 (07:48 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Wed, 1 Aug 2012 05:48:16 +0000 (07:48 +0200)
src/callnotifier/CallMonitor.php

index 9abdba8..af72e0a 100644 (file)
@@ -43,16 +43,7 @@ class CallMonitor
     {
         $call = $this->currentCalls[$callId];
         $call->start = time();
-        foreach ($msg->parameters as $param) {
-            switch ($param->type) {
-            case EDSS1_Parameter::CALLING_PARTY_NUMBER:
-                $call->from = $param->number;
-                break;
-            case EDSS1_Parameter::CALLED_PARTY_NUMBER:
-                $call->to = $param->number;
-                break;
-            }
-        }
+        $this->handleParams($call, $msg);
     }
 
 
@@ -61,6 +52,9 @@ class CallMonitor
         $call = $this->currentCalls[$callId];
 
         switch ($msg->type) {
+        case EDSS1_Message::INFORMATION:
+            $this->handleParams($call, $msg);
+            break;
         case EDSS1_Message::CALL_PROCEEDING:
             $this->log->log('incomingCall', array('call' => $call));
             break;
@@ -73,6 +67,20 @@ class CallMonitor
             break;
         }
     }
+
+    protected function handleParams($call, $msg)
+    {
+        foreach ($msg->parameters as $param) {
+            switch ($param->type) {
+            case EDSS1_Parameter::CALLING_PARTY_NUMBER:
+                $call->from = $param->number;
+                break;
+            case EDSS1_Parameter::CALLED_PARTY_NUMBER:
+                $call->to = $param->number;
+                break;
+            }
+        }
+    }
 }
 
 ?>