From: Christian Weiske Date: Sun, 12 Aug 2012 19:50:01 +0000 (+0200) Subject: load call details on finished calls, too X-Git-Tag: v1.0.0~22 X-Git-Url: https://git.cweiske.de/auerswald-callnotifier.git/commitdiff_plain/1b28b0289cdcb6adcbd496be07fda3a5ec705bfd load call details on finished calls, too --- diff --git a/src/callnotifier/CallMonitor.php b/src/callnotifier/CallMonitor.php index f55bfa7..4923967 100644 --- a/src/callnotifier/CallMonitor.php +++ b/src/callnotifier/CallMonitor.php @@ -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; diff --git a/src/callnotifier/CallMonitor/Detailler/CSV.php b/src/callnotifier/CallMonitor/Detailler/CSV.php index 2261169..ab881dd 100644 --- a/src/callnotifier/CallMonitor/Detailler/CSV.php +++ b/src/callnotifier/CallMonitor/Detailler/CSV.php @@ -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); + } } } diff --git a/src/callnotifier/CallMonitor/Detailler/LDAP.php b/src/callnotifier/CallMonitor/Detailler/LDAP.php index 72fe07b..26599f4 100644 --- a/src/callnotifier/CallMonitor/Detailler/LDAP.php +++ b/src/callnotifier/CallMonitor/Detailler/LDAP.php @@ -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); + } } } diff --git a/src/callnotifier/CallMonitor/Detailler/OpenGeoDb.php b/src/callnotifier/CallMonitor/Detailler/OpenGeoDb.php index 8345128..46711b0 100644 --- a/src/callnotifier/CallMonitor/Detailler/OpenGeoDb.php +++ b/src/callnotifier/CallMonitor/Detailler/OpenGeoDb.php @@ -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); + } } }