From: Christian Weiske Date: Thu, 2 Aug 2012 19:30:15 +0000 (+0200) Subject: filter out duplicate incoming calls X-Git-Tag: v1.0.0~57 X-Git-Url: https://git.cweiske.de/auerswald-callnotifier.git/commitdiff_plain/b1fe50cb5391273bc40902660ceee038d846ca35 filter out duplicate incoming calls --- 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; + } } } }