From b1fe50cb5391273bc40902660ceee038d846ca35 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Thu, 2 Aug 2012 21:30:15 +0200 Subject: [PATCH 1/1] filter out duplicate incoming calls --- src/callnotifier/CallMonitor.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/callnotifier/CallMonitor.php b/src/callnotifier/CallMonitor.php index be155e1..b8f904d 100644 --- a/src/callnotifier/CallMonitor.php +++ b/src/callnotifier/CallMonitor.php @@ -49,7 +49,7 @@ class CallMonitor $call->type = CallMonitor_Call::OUTGOING; } - $this->handleParams($call, $msg); + $this->handleParams($msg, $call, $callId); } @@ -59,7 +59,7 @@ class CallMonitor switch ($msg->type) { case EDSS1_Message::INFORMATION: - $this->handleParams($call, $msg); + $this->handleParams($msg, $call, $callId); break; case EDSS1_Message::ALERTING: if ($call->type == CallMonitor_Call::OUTGOING) { @@ -94,7 +94,7 @@ class CallMonitor } } - protected function handleParams($call, $msg) + protected function handleParams($msg, $call, $callId) { foreach ($msg->parameters as $param) { switch ($param->type) { @@ -107,7 +107,18 @@ class CallMonitor $call->to = $this->getFullNumber( $param->number, $param->numberType ); + if ($call->type == CallMonitor_Call::INCOMING + && $param->numberType != EDSS1_Parameter_Names::NUMBER_SUBSCRIBER + ) { + //only keep incoming calls that arrive at the switchboard, + // not the ones from the switchboard to the telephones + unset($this->currentCalls[$callId]); + } break; + case EDSS1_Parameter::KEYPAD: + if ($call->to === null) { + $call->to = $param->data; + } } } } -- 2.30.2