----------------------------Client---------------------------------
Action: DBGet
Family: testfamily
Key: mykey
ActionID: 01234-astdb-43210
------------------------Server response ------------------------------
Response: Success
Message: Result will follow
ActionID: 01234-astdb-43210
----------------------server event notification--------------------------------
Event: DBGetResponse
Family: testfamily
Key: mykey
Val: 42
ActionID: 01234-astdb-43210
just one example of dialog. others...
----------------------------client--------------------
Action: GetVar
Channel: SIP/linksys2-1020e2b0
Variable: SIPUSERAGENT
ActionID: abcd1234
---------------------------server response --------------------
Response: Success
Variable: SIPUSERAGENT
Value: Linksys/SPA962-5.1.5
So, my thoughts are, i can create a regex loader to load regex from files to 1: supply the dialog for the client and use regex substitution for the variable data. 2: parse responses and events from the server.
So for example: the listing immediately above, i would load file getvar.regex for my client request, sub in Channel, Variable and ActionID then send to server. My client would always be listening for server responses and events, so for every message received, i would run against the regex parser to see how to handle the response / event.
Is this a valid use of regex within php? Will this work faster than the old strtok() while loop? It seams more flexible to me, certainly.