git.cweiske.de
/
auerswald-callnotifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
try to handle nightly debug port resets
[auerswald-callnotifier.git]
/
src
/
callnotifier
/
Logger
/
CallEcho.php
diff --git
a/src/callnotifier/Logger/CallEcho.php
b/src/callnotifier/Logger/CallEcho.php
index fe8b9b48af258c8ab21a6fc79431a276bcf85eb8..70fad4a4d99c7c788ee25045b7b92c336a179289 100644
(file)
--- a/
src/callnotifier/Logger/CallEcho.php
+++ b/
src/callnotifier/Logger/CallEcho.php
@@
-1,33
+1,54
@@
<?php
namespace callnotifier;
<?php
namespace callnotifier;
-class Logger_CallEcho
implements Logger
+class Logger_CallEcho
extends Logger_CallBase
{
public function log($type, $arData)
{
switch ($type) {
{
public function log($type, $arData)
{
switch ($type) {
- case '
incom
ingCall':
- $
this->displayIncoming($arData['call'])
;
+ case '
start
ingCall':
+ $
displayMethod = 'displayStart'
;
break;
case 'finishedCall':
break;
case 'finishedCall':
- $
this->displayFinished($arData['call'])
;
+ $
displayMethod = 'displayFinished'
;
break;
break;
+ default:
+ return;
}
}
+
+ $call = $arData['call'];
+ if (!$this->hasValidType($call)) {
+ return;
+ }
+ if (!$this->hasValidMsn($call)) {
+ return;
+ }
+ $this->$displayMethod($arData['call']);
}
}
- protected function display
Incoming
(CallMonitor_Call $call)
+ protected function display
Start
(CallMonitor_Call $call)
{
{
- echo 'Incoming call from ' . $call->from
- . ' to ' . $call->to . "\n";
+ $this->addUnsetVars($call);
+ echo 'Starting ' . $this->getTypeName($call)
+ . ' call from ' . trim($this->getNumberString($call, 'from'))
+ . ' to ' . trim($this->getNumberString($call, 'to')) . "\n";
}
protected function displayFinished(CallMonitor_Call $call)
{
}
protected function displayFinished(CallMonitor_Call $call)
{
- echo 'Finished call from ' . $call->from
- . ' to ' . $call->to
+ $this->addUnsetVars($call);
+ echo 'Finished ' . $this->getTypeName($call)
+ . ' call from ' . trim($this->getNumberString($call, 'from'))
+ . ' to ' . trim($this->getNumberString($call, 'to'))
. ', length ' . date('H:i:s', $call->end - $call->start - 3600)
. "\n";
}
. ', length ' . date('H:i:s', $call->end - $call->start - 3600)
. "\n";
}
+
+ protected function getTypeName($call)
+ {
+ return $call->type == CallMonitor_Call::INCOMING
+ ? 'incoming' : 'outgoing';
+ }
}
?>
}
?>