load call details on finished calls, too
authorChristian Weiske <cweiske@cweiske.de>
Sun, 12 Aug 2012 19:50:01 +0000 (21:50 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Sun, 12 Aug 2012 19:50:01 +0000 (21:50 +0200)
src/callnotifier/CallMonitor.php
src/callnotifier/CallMonitor/Detailler/CSV.php
src/callnotifier/CallMonitor/Detailler/LDAP.php
src/callnotifier/CallMonitor/Detailler/OpenGeoDb.php

index f55bfa77dcdc12a222acf8a499bd11cca5872f86..4923967d793f767d4eac129a5b1e7b36e765e4d2 100644 (file)
@@ -101,6 +101,9 @@ class CallMonitor
         case EDSS1_Message::RELEASE:
         case EDSS1_Message::RELEASE_COMPLETE:
             $call->end = time();
+            //we need to load details here because they might not have been
+            //loaded yet, e.g. for calls to MSNs that have no phones.
+            $this->loadCallDetails($call);
             $this->log->log('finishedCall', array('call' => $call));
             unset($this->currentCalls[$callId]);
             break;
index 22611699204ddeb38da0e58ba8a1812af2008230..ab881dd2f3a88cd05c6971851a202a26b360445a 100644 (file)
@@ -66,9 +66,13 @@ class CallMonitor_Detailler_CSV implements CallMonitor_Detailler
     public function loadCallDetails(CallMonitor_Call $call)
     {
         if ($call->type == CallMonitor_Call::INCOMING) {
-            $call->fromName = $this->loadName($call->from);
+            if (!isset($call->fromName) || $call->fromName === null) {
+                $call->fromName = $this->loadName($call->from);
+            }
         } else {
-            $call->toName = $this->loadName($call->to);
+            if (!isset($call->toName) || $call->toName === null) {
+                $call->toName = $this->loadName($call->to);
+            }
         }
     }
 
index 72fe07bb160ebb0bc72b9b23aea1aced4f550eb7..26599f4694719cc0a04036053790e87eef0b7e85 100644 (file)
@@ -43,9 +43,13 @@ class CallMonitor_Detailler_LDAP implements CallMonitor_Detailler
     public function loadCallDetails(CallMonitor_Call $call)
     {
         if ($call->type == CallMonitor_Call::INCOMING) {
-            $call->fromName = $this->loadName($call->from);
+            if (!isset($call->fromName) || $call->fromName === null) {
+                $call->fromName = $this->loadName($call->from);
+            }
         } else {
-            $call->toName = $this->loadName($call->to);
+            if (!isset($call->toName) || $call->toName === null) {
+                $call->toName = $this->loadName($call->to);
+            }
         }
     }
 
index 83451283674e28c91f57364bb32c904cd8722a12..46711b08baae3dfe29a403a51d0f74581de41cdb 100644 (file)
@@ -58,9 +58,13 @@ class CallMonitor_Detailler_OpenGeoDb implements CallMonitor_Detailler
     public function loadCallDetails(CallMonitor_Call $call)
     {
         if ($call->type == CallMonitor_Call::INCOMING) {
-            $call->fromLocation = $this->loadLocation($call->from);
+            if (!isset($call->fromLocation) || $call->fromLocation === null) {
+                $call->fromLocation = $this->loadLocation($call->from);
+            }
         } else {
-            $call->toLocation = $this->loadLocation($call->to);
+            if (!isset($call->toLocation) || $call->toLocation === null) {
+                $call->toLocation = $this->loadLocation($call->to);
+            }
         }
     }