From 072ead85ee2f9a2979ec888c5f75a0fa2e1d34f6 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Thu, 2 Aug 2012 18:18:51 +0200 Subject: [PATCH] filter out the ("duplicate") internal call on outgoing calls --- src/callnotifier/CallMonitor.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/callnotifier/CallMonitor.php b/src/callnotifier/CallMonitor.php index ebc9a50..be155e1 100644 --- a/src/callnotifier/CallMonitor.php +++ b/src/callnotifier/CallMonitor.php @@ -62,6 +62,26 @@ class CallMonitor $this->handleParams($call, $msg); break; case EDSS1_Message::ALERTING: + if ($call->type == CallMonitor_Call::OUTGOING) { + /** + * There may be two alerts: One from the telephone to the + * switchboard, and one from the switchboard to the target. + * + * The alert from the switchboard to the target call is + * sent first, so we can remove the call from the telephone + * to the switchboard. + */ + $bFound = false; + foreach ($this->currentCalls as $otherCallId => $otherCall) { + if ($otherCallId != $callId && $otherCall->to == $call->to) { + $bFound = true; + break; + } + } + if ($bFound) { + unset($this->currentCalls[$otherCallId]); + } + } $this->log->log('startingCall', array('call' => $call)); break; -- 2.30.2