{
protected $currentCalls = array();
+ /**
+ * Array of objects that are able to load details for a call
+ *
+ * @var array
+ */
+ protected $detaillers = array();
+
public function __construct($config, $log)
{
$this->config = $config;
$this->log = $log;
}
+ public function addDetailler(CallMonitor_Detailler $detailler)
+ {
+ $this->detaillers[] = $detailler;
+ }
+
public function handle(EDSS1_Message $msg)
{
$callId = $msg->callRef;
unset($this->currentCalls[$otherCallId]);
}
}
+ $this->loadCallDetails($call);
$this->log->log('startingCall', array('call' => $call));
break;
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;
{
if ($type == EDSS1_Parameter_Names::NUMBER_NATIONAL) {
return '0' . $number;
+ } else if ($type == EDSS1_Parameter_Names::NUMBER_INTERNATIONAL) {
+ return '+' . $number;
}
return $number;
}
+
+ /**
+ * Load details for a call, e.g. the name of the calling person
+ * or the area
+ *
+ * @return void
+ */
+ protected function loadCallDetails($call)
+ {
+ foreach ($this->detaillers as $detailler) {
+ $detailler->loadCallDetails($call);
+ }
+ }
}
?>