dumping network data is possible now
authorChristian Weiske <cweiske@cweiske.de>
Sat, 14 Jul 2012 20:28:47 +0000 (22:28 +0200)
committerChristian Weiske <cweiske@cweiske.de>
Sat, 14 Jul 2012 20:28:47 +0000 (22:28 +0200)
callnotifier.php [changed mode: 0644->0755]
dumps/handy-zu-41.bin [new file with mode: 0644]
dumps/intern-22-41.bin [new file with mode: 0644]
dumps/intern22-zu-handy.bin [new file with mode: 0644]
src/callnotifier/CLI.php
src/callnotifier/Config.php [new file with mode: 0644]
src/callnotifier/MessageHandler.php [new file with mode: 0644]
src/callnotifier/Source/File.php [new file with mode: 0644]
src/callnotifier/Source/Remote.php [moved from src/callnotifier/Socket.php with 58% similarity]

old mode 100644 (file)
new mode 100755 (executable)
diff --git a/dumps/handy-zu-41.bin b/dumps/handy-zu-41.bin
new file mode 100644 (file)
index 0000000..99a0e3b
--- /dev/null
@@ -0,0 +1,47 @@
+[DKANPROT-Debug 468744] T01: 00 97 01 5B FF 0A
+[DKANPROT-Debug 579046] N01: 02 97 01 83 FF 0A
+[DKANPROT-Debug 581490] N01: 00 97 01 83 FF 0A
+[DKANPROT-Debug 582023] T01: 02 97 01 5B FF 0A
+[DKANPROT-Debug 478847] T01: 00 97 01 5B FF 0A
+[DKANPROT-Debug 589141] N01: 00 97 01 83 FF 0A
+[DKANPROT-Debug 028619] N01: 02 FF FF 03 08 01 01 05 A1 04 03 80 90 A3 18 01 89 6C 0C 21 83 31 36 33 34 37 37 39 38 37 38 70 06 C1 34 30 38 33 35 7D 02 91 81 FF 0A
+[DKANPROT-Debug 139353] RXMSG KREVENT_SETUP Task 0x22 class L6MGR[0x0]
+[DKANPROT-Debug 141231] RXMSG KREVENT_ERSTAUFRUF ohne task, class KREIS[0x1]
+[DKANPROT-Info 142312] KR_TXMSG_SETUP ueber task 0x23 von tnid 0x10 (RN ) an port 0x10 (S 0 P 4)
+[DKANPROT-Info 145031] KR_TXMSG_PROCEED ueber task 0x22 von tnid 0x13 (RN ) an port 0x13 (S 2 P 0)
+[DKANPROT-Info 145457] RXMSG KREVENT_CALLPROC Slot 0x0 Port 0x4 Task 0x23 kreis 0x1 = class_inst, class_type=1
+[DKANPROT-Debug 146372] T01: 00 97 82 5A 08 01 81 02 FF 0A
+[DKANPROT-Info 250160] KR_TXMSG_SETUP ueber task 0x24 von tnid 0x1c (RN 41) an port 0xe (S 0 P 2)
+[DKANPROT-Debug 251948] N01: 00 97 01 84 FF 0A
+[DKANPROT-Info 253356] VegwCref: [0xffe6] call counter [1:6] [+]
+[DKANPROT-Info 253681] Vegw/Ets-Cref:[0xffe6]/[0x24] - VEGW_SETUP from upper layer to internal destination: CGPN[01634779878]->CDPN[41], slot[0], b_kanal[1], service_typ[0], anon[0], block[0], to[0]
+[DKANPROT-Debug 128533] RXMSG KREVENT_KRTIM2 ohne task, class KREIS[0x1]
+[DKANPROT-Debug 228712] RXMSG KREVENT_KRTIM2 ohne task, class KREIS[0x1]
+[DKANPROT-Debug 219216] RXMSG KREVENT_KRTIM2 ohne task, class KREIS[0x1]
+[DKANPROT-Debug 098646] RXMSG KREVENT_KRTIM2 ohne task, class KREIS[0x1]
+[DKANPROT-Debug 089143] RXMSG KREVENT_KRTIM2 ohne task, class KREIS[0x1]
+[DKANPROT-Info 198774] RXMSG KREVENT_ALERTING Slot 0x0 Port 0x4 Task 0x23 kreis 0x1 = class_inst, class_type=1
+[DKANPROT-Info 200969] KR_TXMSG_ALERT ueber task 0x22 von tnid 0x13 (RN ) an port 0x13 (S 2 P 0)
+[DKANPROT-Debug 203009] T01: 00 97 84 5A 08 01 81 01 FF 0A
+[DKANPROT-Debug 308709] N01: 00 97 01 86 FF 0A
+[DKANPROT-Debug 078671] N01: 02 97 5A 86 08 01 01 4D 08 02 80 90 FF 0A
+[DKANPROT-Debug 079367] T01: 02 97 01 5C FF 0A
+[DKANPROT-Debug 081087] T01: 00 97 86 5C 08 01 81 5A FF 0A
+[DKANPROT-Info 081697] RXMSG KREVENT_RELEASE Slot 0x2 Port 0x0 Task 0x22 kreis 0x1 = class_inst, class_type=1
+[DKANPROT-Info 088692] KR_TXMSG_TAPI_STATE_FORCE ueber task 0x22 von tnid 0x13 (RN ) an port 0x13 (S 2 P 0)
+[DKANPROT-Info 089559] KR_TXMSG_RELCOMP ueber task 0x22 von tnid 0x13 (RN ) an port 0x13 (S 2 P 0)
+[DKANPROT-Debug 090808] RXMSG KREVENT_ERSTAUFRUF ohne task, class KREIS[0x1]
+[DKANPROT-Info 091175] KR_TXMSG_DISC_REQ ueber task 0x23 von tnid 0x10 (RN ) an port 0x10 (S 0 P 4)
+[DKANPROT-Info 188818] KR_TXMSG_DISC_REQ ueber task 0x24 von tnid 0x1c (RN 41) an port 0xe (S 0 P 2)
+[DKANPROT-Info 191384] KR_TXMSG_TAPI_STATE_FORCE ueber task 0x24 von tnid 0x1c (RN 41) an port 0xe (S 0 P 2)
+[DKANPROT-Debug 192321] N01: 00 97 01 88 FF 0A
+[DKANPROT-Info 194404] Vegw/Ets-Cref:[0xffe6]/[0x24] - VEGW_RELEASE from ETS - cause 16
+[DKANPROT-Info 204306] Vegw/Ets-Cref:[0xffe6]/[0x24] - Sending VEGW_RELCOMP to upper layer
+[DKANPROT-Info 204679] VegwCref: [0xffe6] call counter [0] [-]
+[DKANPROT-Info 298778] KR_TXMSG_TAPI_STATE_FORCE ueber task 0x24 von tnid 0x1c (RN 41) an port 0xe (S 0 P 2)
+[DKANPROT-Info 299391] KR_TXMSG_RELEASE ueber task 0x24 von tnid 0x1c (RN 41) an port 0xe (S 0 P 2)
+[DKANPROT-Debug 301444] RXMSG KREVENT_RELEASE Task 0x23 class L6MGR[0x0]
+[DKANPROT-Info 301755] KR_TXMSG_TAPI_STATE_FORCE ueber task 0x23 von tnid 0x10 (RN ) an port 0x10 (S 0 P 4)
+[DKANPROT-Info 302374] KR_TXMSG_RELCOMP ueber task 0x23 von tnid 0x10 (RN ) an port 0x10 (S 0 P 4)
+[DKANPROT-Debug 309331] RXMSG KREVENT_RELEASE_COMP Task 0x24 class L6MGR[0x0]
+[DKANPROT-Info 309796] KR_TXMSG_TAPI_STATE_FORCE ueber task 0x24 von tnid 0x1c (RN 41) an port 0xe (S 0 P 2)
diff --git a/dumps/intern-22-41.bin b/dumps/intern-22-41.bin
new file mode 100644 (file)
index 0000000..fea8e8c
--- /dev/null
@@ -0,0 +1,79 @@
+[DKANPROT-Debug 768497] T02: 00 A3 7F FF 0A
+[DKANPROT-Debug 768986] N02: 00 A3 73 FF 0A
+[DKANPROT-Debug 878522] T02: 00 A3 00 00 08 01 01 05 04 03 80 90 A3 6C 04 01 80 32 32 7D 02 91 81 FF 0A
+[DKANPROT-Debug 879129] N02: 00 A3 01 02 FF 0A
+[DKANPROT-Debug 989239] RXMSG KREVENT_SETUP Task 0x1f class L6MGR[0x0]
+[DKANPROT-Info 990982] KR_TXMSG_SETUP_ACK ueber task 0x1f von tnid 0x19 (RN 22) an port 0x12 (S 1 P 0)
+[DKANPROT-Debug 991525] RXMSG KREVENT_ERSTAUFRUF Task 0x1f class KREIS[0x1]
+[DKANPROT-Debug 992051] RXMSG KREVENT_CDPN_WAHLZIFFER Task 0x1f class KREIS[0x1]
+[DKANPROT-Debug 993486] N02: 02 A3 00 02 08 01 81 0D 18 01 89 1E 02 81 88 FF 0A
+[DKANPROT-Debug 098709] RXMSG KREVENT_KRTIM2 ohne task, class KREIS[0x1]
+[DKANPROT-Debug 099128] T02: 02 A3 01 02 FF 0A
+[DKANPROT-Debug 318556] T02: 00 A3 02 02 08 01 01 7B 2C 04 2A 2A 34 31 FF 0A
+[DKANPROT-Debug 319205] N02: 00 A3 01 04 FF 0A
+[DKANPROT-Debug 320067] RXMSG KREVENT_CDPN_WAHLZIFFER Task 0x1f class KREIS[0x1]
+[DKANPROT-Debug 320459] RXMSG KREVENT_ZIFFER Task 0x1f class KREIS[0x1]
+[DKANPROT-Debug 320897] RXMSG KREVENT_ZIFFER Task 0x1f class KREIS[0x1]
+[DKANPROT-Debug 321349] RXMSG KREVENT_ZIFFER Task 0x1f class KREIS[0x1]
+[DKANPROT-Debug 321865] RXMSG KREVENT_ZIFFER Task 0x1f class KREIS[0x1]
+[DKANPROT-Info 322920] KR_TXMSG_ZIF_INFO ueber task 0x1f von tnid 0x19 (RN 22) an port 0x12 (S 1 P 0)
+[DKANPROT-Debug 323367] RXMSG KREVENT_ERSTAUFRUF ohne task, class KREIS[0x1]
+[DKANPROT-Info 324098] KR_TXMSG_SETUP ueber task 0x20 von tnid 0x10 (RN ) an port 0x10 (S 0 P 4)
+[DKANPROT-Info 325672] KR_TXMSG_PROCEED ueber task 0x1f von tnid 0x19 (RN 22) an port 0x12 (S 1 P 0)
+[DKANPROT-Info 326119] RXMSG KREVENT_CALLPROC Slot 0x0 Port 0x4 Task 0x20 kreis 0x1 = class_inst, class_type=1
+[DKANPROT-Debug 327039] N02: 02 A3 02 04 08 01 81 02 FF 0A
+[DKANPROT-Info 429424] KR_TXMSG_SETUP ueber task 0x21 von tnid 0x1c (RN 41) an port 0xe (S 0 P 2)
+[DKANPROT-Debug 431176] T02: 02 A3 01 04 FF 0A
+[DKANPROT-Info 434171] VegwCref: [0xffe7] call counter [1:7] [+]
+[DKANPROT-Info 434553] Vegw/Ets-Cref:[0xffe7]/[0x21] - VEGW_SETUP from upper layer to internal destination: CGPN[**22]->CDPN[41], slot[0], b_kanal[1], service_typ[0], anon[0], block[0], to[0]
+[DKANPROT-Info 451571] Vegw/Ets-Cref:[0xffe7]/[0x21] - Sending VEGW_ALERTING to upper layer
+[DKANPROT-Debug 538990] RXMSG KREVENT_ALERTING Task 0x21 class RE_Base[0x27]
+[DKANPROT-Info 539494] RXMSG KREVENT_ALERTING Slot 0x0 Port 0x4 Task 0x20 kreis 0x1 = class_inst, class_type=1
+[DKANPROT-Info 540076] KR_TXMSG_ALERT ueber task 0x1f von tnid 0x19 (RN 22) an port 0x12 (S 1 P 0)
+[DKANPROT-Debug 541897] N02: 02 A3 04 04 08 01 81 01 1C 11 91 A1 0E 02 01 10 06 06 04 00 82 67 01 01 02 01 06 1E 02 81 88 28 0D 43 43 4E 52 20 6D 6F 65 67 6C 69 63 68 FF 0A
+[DKANPROT-Debug 649029] T02: 02 A3 01 06 FF 0A
+[DKANPROT-Debug 088881] RXMSG KREVENT_KRTIM2 ohne task, class KREIS[0x1]
+[DKANPROT-Debug 188480] RXMSG KREVENT_KRTIM2 ohne task, class KREIS[0x1]
+[DKANPROT-Debug 408836] N01: 02 97 01 83 FF 0A
+[DKANPROT-Debug 409391] T01: 02 97 01 5B FF 0A
+[DKANPROT-Debug 178580] RXMSG KREVENT_KRTIM2 ohne task, class KREIS[0x1]
+[DKANPROT-Debug 168520] RXMSG KREVENT_KRTIM2 ohne task, class KREIS[0x1]
+[DKANPROT-Debug 158545] RXMSG KREVENT_KRTIM2 ohne task, class KREIS[0x1]
+[DKANPROT-Debug 148510] RXMSG KREVENT_KRTIM2 ohne task, class KREIS[0x1]
+[DKANPROT-Debug 138469] RXMSG KREVENT_KRTIM2 ohne task, class KREIS[0x1]
+[DKANPROT-Debug 128602] RXMSG KREVENT_KRTIM2 ohne task, class KREIS[0x1]
+[DKANPROT-Debug 228545] RXMSG KREVENT_KRTIM2 ohne task, class KREIS[0x1]
+[DKANPROT-Debug 108643] RXMSG KREVENT_KRTIM2 ohne task, class KREIS[0x1]
+[DKANPROT-Debug 659255] T02: 00 A3 01 07 FF 0A
+[DKANPROT-Debug 661855] N02: 02 A3 01 05 FF 0A
+[DKANPROT-Debug 662390] N02: 00 A3 01 05 FF 0A
+[DKANPROT-Debug 768736] T02: 02 A3 01 07 FF 0A
+[DKANPROT-Debug 098982] RXMSG KREVENT_KRTIM2 ohne task, class KREIS[0x1]
+[DKANPROT-Debug 198561] RXMSG KREVENT_KRTIM2 ohne task, class KREIS[0x1]
+[DKANPROT-Debug 418827] N01: 02 97 01 83 FF 0A
+[DKANPROT-Debug 421390] T01: 00 97 01 5B FF 0A
+[DKANPROT-Debug 421918] T01: 02 97 01 5B FF 0A
+[DKANPROT-Debug 528510] N01: 00 97 01 83 FF 0A
+[DKANPROT-Debug 968507] T02: 00 A3 04 06 08 01 01 45 08 02 80 90 FF 0A
+[DKANPROT-Debug 971158] N02: 00 A3 01 06 FF 0A
+[DKANPROT-Info 973345] RXMSG KREVENT_DISCONNECT Slot 0x1 Port 0x0 Task 0x1f kreis 0x1 = class_inst, class_type=1
+[DKANPROT-Info 973906] KR_TXMSG_TAPI_STATE_FORCE ueber task 0x1f von tnid 0x19 (RN 22) an port 0x12 (S 1 P 0)
+[DKANPROT-Info 974686] KR_TXMSG_RELEASE ueber task 0x1f von tnid 0x19 (RN 22) an port 0x12 (S 1 P 0)
+[DKANPROT-Debug 975863] RXMSG KREVENT_ERSTAUFRUF ohne task, class KREIS[0x1]
+[DKANPROT-Info 976191] KR_TXMSG_DISC_REQ ueber task 0x20 von tnid 0x10 (RN ) an port 0x10 (S 0 P 4)
+[DKANPROT-Info 988711] KR_TXMSG_DISC_REQ ueber task 0x21 von tnid 0x1c (RN 41) an port 0xe (S 0 P 2)
+[DKANPROT-Info 990268] Vegw/Ets-Cref:[0xffe7]/[0x21] - VEGW_RELEASE from ETS - cause 16
+[DKANPROT-Info 001847] Vegw/Ets-Cref:[0xffe7]/[0x21] - Sending VEGW_RELCOMP to upper layer
+[DKANPROT-Info 002181] VegwCref: [0xffe7] call counter [0] [-]
+[DKANPROT-Info 003890] KR_TXMSG_TAPI_STATE_FORCE ueber task 0x21 von tnid 0x1c (RN 41) an port 0xe (S 0 P 2)
+[DKANPROT-Debug 005098] N02: 02 A3 06 06 08 01 81 4D FF 0A
+[DKANPROT-Debug 079909] T02: 02 A3 01 08 FF 0A
+[DKANPROT-Debug 080195] T02: 00 A3 06 08 08 01 01 5A FF 0A
+[DKANPROT-Debug 080782] N02: 00 A3 01 08 FF 0A
+[DKANPROT-Debug 082312] RXMSG KREVENT_RELEASE_COMP Task 0x21 class RE_Base[0x27]
+[DKANPROT-Info 082944] KR_TXMSG_TAPI_STATE_FORCE ueber task 0x21 von tnid 0x1c (RN 41) an port 0xe (S 0 P 2)
+[DKANPROT-Debug 083482] RXMSG KREVENT_RELEASE_COMP Task 0x1f class L6MGR[0x0]
+[DKANPROT-Info 083797] KR_TXMSG_TAPI_STATE_FORCE ueber task 0x1f von tnid 0x19 (RN 22) an port 0x12 (S 1 P 0)
+[DKANPROT-Debug 189586] RXMSG KREVENT_RELEASE Task 0x20 class L6MGR[0x0]
+[DKANPROT-Info 189942] KR_TXMSG_TAPI_STATE_FORCE ueber task 0x20 von tnid 0x10 (RN ) an port 0x10 (S 0 P 4)
+[DKANPROT-Info 190494] KR_TXMSG_RELCOMP ueber task 0x20 von tnid 0x10 (RN ) an port 0x10 (S 0 P 4)
diff --git a/dumps/intern22-zu-handy.bin b/dumps/intern22-zu-handy.bin
new file mode 100644 (file)
index 0000000..264b5fc
--- /dev/null
@@ -0,0 +1,74 @@
+[DKANPROT-Debug 248858] N01: 02 97 01 89 FF 0A
+[DKANPROT-Debug 251462] T01: 00 97 01 5D FF 0A
+[DKANPROT-Debug 251989] T01: 02 97 01 5D FF 0A
+[DKANPROT-Debug 358766] N01: 00 97 01 89 FF 0A
+[DKANPROT-Debug 868873] T02: 00 A3 7F FF 0A
+[DKANPROT-Debug 869388] N02: 00 A3 73 FF 0A
+[DKANPROT-Debug 978485] T02: 00 A3 00 00 08 01 01 05 04 03 80 90 A3 6C 04 01 80 32 32 7D 02 91 81 FF 0A
+[DKANPROT-Debug 979400] N02: 00 A3 01 02 FF 0A
+[DKANPROT-Debug 089476] RXMSG KREVENT_SETUP Task 0x25 class L6MGR[0x0]
+[DKANPROT-Info 091238] KR_TXMSG_SETUP_ACK ueber task 0x25 von tnid 0x19 (RN 22) an port 0x12 (S 1 P 0)
+[DKANPROT-Debug 091778] RXMSG KREVENT_ERSTAUFRUF Task 0x25 class KREIS[0x1]
+[DKANPROT-Debug 092304] RXMSG KREVENT_CDPN_WAHLZIFFER Task 0x25 class KREIS[0x1]
+[DKANPROT-Debug 093398] N02: 02 A3 00 02 08 01 81 0D 18 01 89 1E 02 81 88 FF 0A
+[DKANPROT-Debug 094191] RXMSG KREVENT_KRTIM2 ohne task, class KREIS[0x1]
+[DKANPROT-Debug 198855] T02: 02 A3 01 02 FF 0A
+[DKANPROT-Debug 528501] T02: 00 A3 02 02 08 01 01 7B 70 0C 81 30 31 36 33 34 37 37 39 38 37 38 FF 0A
+[DKANPROT-Debug 529573] N02: 00 A3 01 04 FF 0A
+[DKANPROT-Debug 530414] RXMSG KREVENT_CDPN_WAHLZIFFER Task 0x25 class KREIS[0x1]
+[DKANPROT-Debug 530889] RXMSG KREVENT_ZIFFER Task 0x25 class KREIS[0x1]
+[DKANPROT-Debug 531409] RXMSG KREVENT_ERSTAUFRUF Task 0x25 class KREIS[0x1]
+[DKANPROT-Debug 532124] RXMSG KREVENT_ZIFFER Task 0x25 class KREIS[0x1]
+[DKANPROT-Debug 532558] RXMSG KREVENT_ZIFFER Task 0x25 class KREIS[0x1]
+[DKANPROT-Debug 532916] RXMSG KREVENT_ZIFFER Task 0x25 class KREIS[0x1]
+[DKANPROT-Debug 533271] RXMSG KREVENT_ZIFFER Task 0x25 class KREIS[0x1]
+[DKANPROT-Debug 534015] RXMSG KREVENT_ZIFFER Task 0x25 class KREIS[0x1]
+[DKANPROT-Debug 534493] RXMSG KREVENT_ZIFFER Task 0x25 class KREIS[0x1]
+[DKANPROT-Debug 534913] RXMSG KREVENT_ZIFFER Task 0x25 class KREIS[0x1]
+[DKANPROT-Debug 535282] RXMSG KREVENT_ZIFFER Task 0x25 class KREIS[0x1]
+[DKANPROT-Debug 535693] RXMSG KREVENT_ZIFFER Task 0x25 class KREIS[0x1]
+[DKANPROT-Debug 536067] RXMSG KREVENT_ZIFFER Task 0x25 class KREIS[0x1]
+[DKANPROT-Info 537817] KR_TXMSG_SETUP ueber task 0x26 von tnid 0x13 (RN ) an port 0x13 (S 2 P 0)
+[DKANPROT-Debug 539583] RXMSG KREVENT_ERSTAUFRUF ohne task, class KREIS[0x1]
+[DKANPROT-Info 539923] KR_TXMSG_ZIF_INFO ueber task 0x25 von tnid 0x19 (RN 22) an port 0x12 (S 1 P 0)
+[DKANPROT-Debug 540910] T01: 00 97 88 5C 08 01 1B 05 04 03 90 90 A3 18 01 83 6C 07 01 80 34 30 38 36 32 FF 0A
+[DKANPROT-Debug 639591] N01: 00 97 01 8A FF 0A
+[DKANPROT-Debug 859130] N01: 02 97 5C 8A 08 01 9B 0D 18 01 89 1E 02 82 88 FF 0A
+[DKANPROT-Debug 859765] T01: 02 97 01 5E FF 0A
+[DKANPROT-Debug 861001] T01: 00 97 8A 5E 08 01 1B 7B 70 0C 81 30 31 36 33 34 37 37 39 38 37 38 FF 0A
+[DKANPROT-Debug 968491] N01: 00 97 01 8C FF 0A
+[DKANPROT-Debug 368865] RXMSG KREVENT_KRTIM2 ohne task, class KREIS[0x1]
+[DKANPROT-Debug 478551] N01: 02 97 5E 8C 08 01 9B 02 1E 02 82 88 FF 0A
+[DKANPROT-Debug 479457] T01: 02 97 01 60 FF 0A
+[DKANPROT-Info 480449] RXMSG KREVENT_CALLPROC Slot 0x2 Port 0x0 Task 0x26 kreis 0x1 = class_inst, class_type=1
+[DKANPROT-Info 480896] KR_TXMSG_PROCEED ueber task 0x25 von tnid 0x19 (RN 22) an port 0x12 (S 1 P 0)
+[DKANPROT-Debug 482114] N02: 02 A3 02 04 08 01 81 02 FF 0A
+[DKANPROT-Debug 589285] T02: 02 A3 01 04 FF 0A
+[DKANPROT-Debug 589643] N01: 02 97 60 8C 08 01 9B 01 FF 0A
+[DKANPROT-Debug 590117] T01: 02 97 01 62 FF 0A
+[DKANPROT-Info 591210] RXMSG KREVENT_ALERTING Slot 0x2 Port 0x0 Task 0x26 kreis 0x1 = class_inst, class_type=1
+[DKANPROT-Info 591796] KR_TXMSG_ALERT ueber task 0x25 von tnid 0x19 (RN 22) an port 0x12 (S 1 P 0)
+[DKANPROT-Debug 593464] N02: 02 A3 04 04 08 01 81 01 1E 02 81 88 FF 0A
+[DKANPROT-Debug 698517] T02: 02 A3 01 06 FF 0A
+[DKANPROT-Debug 108889] T02: 00 A3 04 06 08 01 01 45 08 02 80 90 FF 0A
+[DKANPROT-Debug 109511] N02: 00 A3 01 06 FF 0A
+[DKANPROT-Info 111254] RXMSG KREVENT_DISCONNECT Slot 0x1 Port 0x0 Task 0x25 kreis 0x1 = class_inst, class_type=1
+[DKANPROT-Info 111748] KR_TXMSG_TAPI_STATE_FORCE ueber task 0x25 von tnid 0x19 (RN 22) an port 0x12 (S 1 P 0)
+[DKANPROT-Info 112488] KR_TXMSG_RELEASE ueber task 0x25 von tnid 0x19 (RN 22) an port 0x12 (S 1 P 0)
+[DKANPROT-Info 114039] KR_TXMSG_DISC_REQ ueber task 0x26 von tnid 0x13 (RN ) an port 0x13 (S 2 P 0)
+[DKANPROT-Debug 115151] RXMSG KREVENT_ERSTAUFRUF ohne task, class KREIS[0x1]
+[DKANPROT-Debug 116755] T01: 00 97 8C 62 08 01 1B 45 08 02 80 90 FF 0A
+[DKANPROT-Debug 117486] N02: 02 A3 06 06 08 01 81 4D FF 0A
+[DKANPROT-Debug 218511] T02: 02 A3 01 08 FF 0A
+[DKANPROT-Debug 219119] T02: 00 A3 06 08 08 01 01 5A FF 0A
+[DKANPROT-Debug 219361] N01: 00 97 01 8E FF 0A
+[DKANPROT-Debug 220056] N02: 00 A3 01 08 FF 0A
+[DKANPROT-Debug 221667] RXMSG KREVENT_RELEASE_COMP Task 0x25 class L6MGR[0x0]
+[DKANPROT-Info 221974] KR_TXMSG_TAPI_STATE_FORCE ueber task 0x25 von tnid 0x19 (RN 22) an port 0x12 (S 1 P 0)
+[DKANPROT-Debug 328545] N01: 02 97 62 8E 08 01 9B 4D FF 0A
+[DKANPROT-Debug 329440] T01: 02 97 01 64 FF 0A
+[DKANPROT-Debug 331248] T01: 00 97 8E 64 08 01 1B 5A 08 02 80 9F FF 0A
+[DKANPROT-Debug 331816] RXMSG KREVENT_RELEASE Task 0x26 class L6MGR[0x0]
+[DKANPROT-Info 332522] KR_TXMSG_TAPI_STATE_FORCE ueber task 0x26 von tnid 0x13 (RN ) an port 0x13 (S 2 P 0)
+[DKANPROT-Info 333126] KR_TXMSG_RELCOMP ueber task 0x26 von tnid 0x13 (RN ) an port 0x13 (S 2 P 0)
+[DKANPROT-Debug 439148] N01: 00 97 01 90 FF 0A
index 4bc0e6055f211683f3bffa92421df308532252fb..928e4ce929cac281f34ac9118a2efd87609f6ed1 100644 (file)
@@ -4,10 +4,79 @@ namespace callnotifier;
 
 class CLI
 {
+    protected $cliParser;
+    protected $config;
+
+    public function __construct()
+    {
+        $this->setupCli();
+    }
+
     public function run()
     {
-        $s = new Socket('192.168.3.95');
-        $s->run();
+        $this->config = new Config();
+        try {
+            $result = $this->cliParser->parse();
+        } catch (\Exception $exc) {
+            $this->cliParser->displayError($exc->getMessage());
+        }
+
+        $this->fillConfig($this->config, $result);
+
+        $handler = new MessageHandler($this->config);
+        if ($this->config->replayFile !== null) {
+            $sourceClass = 'callnotifier\Source_File';
+        } else {
+            $sourceClass = 'callnotifier\Source_Remote';
+        }
+        $source = new $sourceClass($this->config, $handler);
+        $source->run();
+    }
+
+    public function setupCli()
+    {
+        $p = new \Console_CommandLine();
+        $p->description = 'Notifies about incoming calls on an Auerswald COMpact 3000';
+        $p->version = '0.0.1';
+
+        $p->addOption(
+            'host',
+            array(
+                'short_name'  => '-h',
+                'long_name'   => '--host',
+                'description' => 'IP of COMpact 3000',
+                'help_name'   => 'IP',
+                'action'      => 'StoreString'
+            )
+        );
+
+        $p->addOption(
+            'dumpFile',
+            array(
+                'long_name'   => '--dump',
+                'description' => 'dump messages into file for later replay',
+                'help_name'   => 'FILE',
+                'action'      => 'StoreString'
+            )
+        );
+        $p->addOption(
+            'replayFile',
+            array(
+                'long_name'   => '--replay',
+                'description' => "Replay messages from file instead from network",
+                'help_name'   => 'FILE',
+                'action'      => 'StoreString'
+            )
+        );
+
+        $this->cliParser = $p;
+    }
+
+    protected function fillConfig($config, $result)
+    {
+        $config->setIfNotEmpty('host', $result->options['host']);
+        $config->setIfNotEmpty('dumpFile', $result->options['dumpFile']);
+        $config->setIfNotEmpty('replayFile', $result->options['replayFile']);
     }
 }
 
diff --git a/src/callnotifier/Config.php b/src/callnotifier/Config.php
new file mode 100644 (file)
index 0000000..5eecc9e
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+namespace callnotifier;
+
+class Config
+{
+    /**
+     * COMpact 3000 IP address
+     */
+    public $host;
+
+    /**
+     * COMpact 3000 debug port
+     */
+    public $port = 42225;
+
+    /**
+     * File to dump network data into, for later replay
+     */
+    public $dumpFile;
+
+    /**
+     * File to read + replay network data from
+     */
+    public $replayFile;
+
+
+    public function setIfNotEmpty($var, $value)
+    {
+        if ($value != '') {
+            $this->$var = $value;
+        }
+    }
+}
+
+?>
diff --git a/src/callnotifier/MessageHandler.php b/src/callnotifier/MessageHandler.php
new file mode 100644 (file)
index 0000000..b4ed645
--- /dev/null
@@ -0,0 +1,61 @@
+<?php
+namespace callnotifier;
+
+class MessageHandler
+{
+    protected $dumpHdl;
+
+
+    public function __construct($config)
+    {
+        $this->config = $config;
+        $this->prepareDump();
+    }
+
+    public function handle($msg)
+    {
+        if ($this->config->dumpFile !== null) {
+            $this->dump($msg);
+        }
+        if (substr($msg, 0, 9) != '[DKANPROT') {
+            //unknown message type
+            return;
+        }
+        $regex = '#^\\[DKANPROT-([^ ]+) ([0-9]+)\\] (.*)$#';
+        if (!preg_match($regex, $msg, $matches)) {
+            //message should always be that way
+            return false;
+        }
+        list(, $type, $someid, $details) = $matches;
+
+        if ($type != 'Info') {
+            //we only want info messages
+            var_dump($type . ': ' . $details);
+            return;
+        }
+        //Vegw/Ets-Cref:[0xffef]/[0x64] - VEGW_SETUP from upper layer to internal destination: CGPN[**22]->CDPN[41], 
+        var_dump($details);
+        $regex = '#CGPN\\[([^\\]]+)\\]->CDPN\\[([^\\]]+)\\]#';
+        if (preg_match($regex, $details, $matches)) {
+            var_dump('a call!', $matches);
+        }
+    }
+
+    protected function prepareDump()
+    {
+        if ($this->config->dumpFile === null) {
+            return;
+        }
+        $this->dumpHdl = fopen($this->config->dumpFile, 'w');
+        if (!$this->dumpHdl) {
+            throw new Exception('Cannot open replay file for reading');
+        }
+    }
+
+    protected function dump($msg)
+    {
+        fwrite($this->dumpHdl, $msg . "\n");
+    }
+}
+
+?>
diff --git a/src/callnotifier/Source/File.php b/src/callnotifier/Source/File.php
new file mode 100644 (file)
index 0000000..c358397
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+namespace callnotifier;
+
+class Source_File
+{
+    public function __construct($config, $handler)
+    {
+        $this->config  = $config;
+        $this->handler = $handler;
+    }
+
+    public function run()
+    {
+        $file = $this->config->replayFile;
+        if (!file_exists($file)) {
+            throw new Exception('Replay file does not exist');
+        }
+
+        $handle = fopen($file, 'r');
+        if (!$handle) {
+            throw new Exception('Cannot open replay file for reading');
+        }
+
+        while (($line = fgets($handle, 4096)) !== false) {
+            $this->handler->handle($line);
+        }
+        if (!feof($handle)) {
+            throw new Exception('unexpected fgets() fail');
+        }
+        fclose($handle);
+    }
+}
+
+?>
similarity index 58%
rename from src/callnotifier/Socket.php
rename to src/callnotifier/Source/Remote.php
index 1130bd8ea799edcb2e705e4eeb8f18be51ad0aa6..36e468dc1b5b98b0d698ba688d0e3c187647d9ea 100644 (file)
@@ -1,20 +1,19 @@
 <?php
 namespace callnotifier;
 
-class Socket
+class Source_Remote
 {
     protected $socket;
-    public $ip = null;
-    public $port = 42225;
 
-    public function __construct($ip)
+    public function __construct($config, $handler)
     {
-        $this->ip = $ip;
+        $this->config  = $config;
+        $this->handler = $handler;
     }
 
     public function run()
     {
-        $this->connect($this->ip, $this->port);
+        $this->connect($this->config->host, $this->config->port);
         $this->init();
         $this->loop();
         $this->disconnect();
@@ -54,9 +53,10 @@ class Socket
         while (true) {
             $dbgmsg = $this->read_response();
             //echo $dbgmsg . "\n";
-            $this->handle_msg($dbgmsg);
+            $this->handler->handle($dbgmsg);
         }
     }
+
     function read_response()
     {
         $res = socket_read($this->socket, 2048, PHP_NORMAL_READ);
@@ -69,33 +69,6 @@ class Socket
         socket_close($this->socket);
     }
 
-    function handle_msg($msg)
-    {
-        if (substr($msg, 0, 9) != '[DKANPROT') {
-            //unknown message type
-            return;
-        }
-        $regex = '#^\\[DKANPROT-([^ ]+) ([0-9]+)\\] (.*)$#';
-        if (!preg_match($regex, $msg, $matches)) {
-            //message should always be that way
-            return false;
-        }
-        list(, $type, $someid, $details) = $matches;
-
-        if ($type != 'Info') {
-            //we only want info messages
-            var_dump($type . ': ' . $details);
-            return;
-        }
-        //Vegw/Ets-Cref:[0xffef]/[0x64] - VEGW_SETUP from upper layer to internal destination: CGPN[**22]->CDPN[41], 
-        var_dump($details);
-        $regex = '#CGPN\\[([^\\]]+)\\]->CDPN\\[([^\\]]+)\\]#';
-        if (preg_match($regex, $details, $matches)) {
-            var_dump('a call!', $matches);
-        }
-    }
-
-
 }
 
 ?>