git.cweiske.de
/
auerswald-callnotifier.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0ecfe52
)
add incoming/outgoing type to calls
author
Christian Weiske
<cweiske@cweiske.de>
Thu, 2 Aug 2012 05:39:00 +0000
(07:39 +0200)
committer
Christian Weiske
<cweiske@cweiske.de>
Thu, 2 Aug 2012 05:39:00 +0000
(07:39 +0200)
src/callnotifier/CLI.php
patch
|
blob
|
history
src/callnotifier/CallMonitor.php
patch
|
blob
|
history
src/callnotifier/CallMonitor/Call.php
patch
|
blob
|
history
src/callnotifier/Log.php
patch
|
blob
|
history
src/callnotifier/Logger/CallEcho.php
patch
|
blob
|
history
diff --git
a/src/callnotifier/CLI.php
b/src/callnotifier/CLI.php
index 6ec9a7e40938664dbcabe6e91b738597e95dd0f0..2a6d3ca6ea4aa5d96c233ff5d2ff28ae235ef8a8 100644
(file)
--- a/
src/callnotifier/CLI.php
+++ b/
src/callnotifier/CLI.php
@@
-32,7
+32,7
@@
class CLI
}
}
$log->addLogger(
}
}
$log->addLogger(
- new Logger_CallEcho(), array('
incom
ingCall', 'finishedCall')
+ new Logger_CallEcho(), array('
start
ingCall', 'finishedCall')
);
$callMonitor = new CallMonitor($this->config, $log);
);
$callMonitor = new CallMonitor($this->config, $log);
diff --git
a/src/callnotifier/CallMonitor.php
b/src/callnotifier/CallMonitor.php
index af72e0a364fda10ffbeafa4a7e0b6da3bb263b5d..29ee5a24cdc94c2aaf894cf4042ba6d0fe9d2944 100644
(file)
--- a/
src/callnotifier/CallMonitor.php
+++ b/
src/callnotifier/CallMonitor.php
@@
-43,6
+43,12
@@
class CallMonitor
{
$call = $this->currentCalls[$callId];
$call->start = time();
{
$call = $this->currentCalls[$callId];
$call->start = time();
+ if ($msg->tei == 127) {
+ $call->type = CallMonitor_Call::INCOMING;
+ } else {
+ $call->type = CallMonitor_Call::OUTGOING;
+ }
+
$this->handleParams($call, $msg);
}
$this->handleParams($call, $msg);
}
@@
-56,7
+62,7
@@
class CallMonitor
$this->handleParams($call, $msg);
break;
case EDSS1_Message::CALL_PROCEEDING:
$this->handleParams($call, $msg);
break;
case EDSS1_Message::CALL_PROCEEDING:
- $this->log->log('
incom
ingCall', array('call' => $call));
+ $this->log->log('
start
ingCall', array('call' => $call));
break;
case EDSS1_Message::RELEASE:
break;
case EDSS1_Message::RELEASE:
diff --git
a/src/callnotifier/CallMonitor/Call.php
b/src/callnotifier/CallMonitor/Call.php
index 3ebd251a66e9cab36f3df01dd61b77d75f5cfe37..0f16ead7e3493f3b7c96b0891390bff0b9fa5e2f 100644
(file)
--- a/
src/callnotifier/CallMonitor/Call.php
+++ b/
src/callnotifier/CallMonitor/Call.php
@@
-3,6
+3,17
@@
namespace callnotifier;
class CallMonitor_Call
{
class CallMonitor_Call
{
+ const INCOMING = 'i';
+ const OUTGOING = 'o';
+
+ /**
+ * Type of call: "i"ncoming or "o"utgoing
+ *
+ * @var string
+ */
+ public $type;
+
+
/**
* Telephone number of caller
*
/**
* Telephone number of caller
*
diff --git
a/src/callnotifier/Log.php
b/src/callnotifier/Log.php
index 8a6b79a9ada81bd2c03766218c0e99243ed8dc20..d2ee0c83a42e083fd1f764294c43ea2db84c3012 100644
(file)
--- a/
src/callnotifier/Log.php
+++ b/
src/callnotifier/Log.php
@@
-13,7
+13,7
@@
class Log
protected $logger = array(
'msgData' => array(),
'edss1msg' => array(),
protected $logger = array(
'msgData' => array(),
'edss1msg' => array(),
- '
incom
ingCall' => array(),
+ '
start
ingCall' => array(),
'finishedCall' => array(),
);
'finishedCall' => array(),
);
diff --git
a/src/callnotifier/Logger/CallEcho.php
b/src/callnotifier/Logger/CallEcho.php
index fe8b9b48af258c8ab21a6fc79431a276bcf85eb8..825bc2476a1cbf6465ad52010714a5553072a2b4 100644
(file)
--- a/
src/callnotifier/Logger/CallEcho.php
+++ b/
src/callnotifier/Logger/CallEcho.php
@@
-6,8
+6,8
@@
class Logger_CallEcho implements Logger
public function log($type, $arData)
{
switch ($type) {
public function log($type, $arData)
{
switch ($type) {
- case '
incom
ingCall':
- $this->display
Incoming
($arData['call']);
+ case '
start
ingCall':
+ $this->display
Start
($arData['call']);
break;
case 'finishedCall':
$this->displayFinished($arData['call']);
break;
case 'finishedCall':
$this->displayFinished($arData['call']);
@@
-16,18
+16,26
@@
class Logger_CallEcho implements Logger
}
}
- protected function display
Incoming
(CallMonitor_Call $call)
+ protected function display
Start
(CallMonitor_Call $call)
{
{
- echo 'Incoming call from ' . $call->from
+ echo 'Starting ' . $this->getTypeName($call)
+ . ' call from ' . $call->from
. ' to ' . $call->to . "\n";
}
protected function displayFinished(CallMonitor_Call $call)
{
. ' to ' . $call->to . "\n";
}
protected function displayFinished(CallMonitor_Call $call)
{
- echo 'Finished call from ' . $call->from
+ echo 'Finished ' . $this->getTypeName($call)
+ . ' call from ' . $call->from
. ' to ' . $call->to
. ', length ' . date('H:i:s', $call->end - $call->start - 3600)
. "\n";
}
. ' to ' . $call->to
. ', length ' . date('H:i:s', $call->end - $call->start - 3600)
. "\n";
}
+
+ protected function getTypeName($call)
+ {
+ return $call->type == CallMonitor_Call::INCOMING
+ ? 'incoming' : 'outgoing';
+ }
}
?>
}
?>