2 namespace callnotifier;
4 class Logger_CallEcho extends Logger_CallBase
6 public function log($type, $arData)
10 $displayMethod = 'displayStart';
13 $displayMethod = 'displayFinished';
19 $call = $arData['call'];
20 if (!$this->hasValidType($call)) {
23 if (!$this->hasValidMsn($call)) {
26 $this->$displayMethod($arData['call']);
30 protected function displayStart(CallMonitor_Call $call)
32 $this->addUnsetVars($call);
33 echo 'Starting ' . $this->getTypeName($call)
34 . ' call from ' . trim($this->getNumberString($call, 'from'))
35 . ' to ' . trim($this->getNumberString($call, 'to')) . "\n";
38 protected function displayFinished(CallMonitor_Call $call)
40 $this->addUnsetVars($call);
41 echo 'Finished ' . $this->getTypeName($call)
42 . ' call from ' . trim($this->getNumberString($call, 'from'))
43 . ' to ' . trim($this->getNumberString($call, 'to'))
44 . ', length ' . date('H:i:s', $call->end - $call->start - 3600)
48 protected function getTypeName($call)
50 return $call->type == CallMonitor_Call::INCOMING
51 ? 'incoming' : 'outgoing';