2 namespace callnotifier;
9 public function __construct($config)
11 $this->config = $config;
15 public function handle($msg)
17 if ($this->config->dumpFile !== null) {
20 if (substr($msg, 0, 9) != '[DKANPROT') {
21 //unknown message type
24 $regex = '#^\\[DKANPROT-([^ ]+) ([0-9]+)\\] (.*)$#';
25 if (!preg_match($regex, $msg, $matches)) {
26 //message should always be that way
29 list(, $type, $someid, $details) = $matches;
31 if ($type != 'Info') {
32 //we only want info messages
33 var_dump($type . ': ' . $details);
36 //Vegw/Ets-Cref:[0xffef]/[0x64] - VEGW_SETUP from upper layer to internal destination: CGPN[**22]->CDPN[41],
38 $regex = '#CGPN\\[([^\\]]+)\\]->CDPN\\[([^\\]]+)\\]#';
39 if (preg_match($regex, $details, $matches)) {
40 var_dump('a call!', $matches);
44 protected function prepareDump()
46 if ($this->config->dumpFile === null) {
49 $this->dumpHdl = fopen($this->config->dumpFile, 'w');
50 if (!$this->dumpHdl) {
51 throw new Exception('Cannot open replay file for reading');
55 protected function dump($msg)
57 fwrite($this->dumpHdl, $msg . "\n");