I have a PHP script which returns states for the extensions on my home's phone network. I recently moved from the exec node to the daemon node which bizarrely necessitated a couple of unwanted changes to the way my flow worked. I had to introduce two function nodes to be able to split the messages from the script in a way that hadn't been necessary before. Anyway a knock on effect that I've only just noticed is that I'm no longer getting any updates for the '4004' extension. Don't know why. I've moved the telegram node, which I'm using a debug node to the output of the script (before I had it after the second function node) and I can see they're being sent, it's just my regex matching isn't working anymore for some reason. Any help would be much appreciated! Thank you

[{"id":"3aedb22.998dc4e","type":"switch","z":"36ca7898.7bdf48","name":"","property":"payload","propertyType":"msg","rules":[{"t":"regex","v":"4001","vt":"num","case":true},{"t":"regex","v":"4003","vt":"num","case":true},{"t":"regex","v":"4004","vt":"num","case":true}],"checkall":"true","repair":false,"outputs":3,"x":510,"y":200,"wires":[["a9c44c6a.9af79"],["cb49d4e.b009928"],["59d0b5f9.e69c0c"]]},{"id":"a9c44c6a.9af79","type":"switch","z":"36ca7898.7bdf48","name":"","property":"payload","propertyType":"msg","rules":[{"t":"regex","v":"idle","vt":"str","case":true},{"t":"regex","v":"ringing","vt":"str","case":true},{"t":"regex","v":"inuse","vt":"str","case":true}],"checkall":"true","repair":false,"outputs":3,"x":650,"y":100,"wires":[["addaf9f1.d01cc8"],["70236d08.e292e4"],["5d383102.265e"]]},{"id":"cb49d4e.b009928","type":"switch","z":"36ca7898.7bdf48","name":"","property":"payload","propertyType":"msg","rules":[{"t":"regex","v":"idle","vt":"str","case":true},{"t":"regex","v":"ringing","vt":"str","case":true},{"t":"regex","v":"inuse","vt":"str","case":true}],"checkall":"true","repair":false,"outputs":3,"x":650,"y":200,"wires":[["9871d79b.d57688"],["78a437d0.dc7c88"],["519cfd63.413db4"]]},{"id":"59d0b5f9.e69c0c","type":"switch","z":"36ca7898.7bdf48","name":"","property":"payload","propertyType":"msg","rules":[{"t":"regex","v":"idle","vt":"str","case":true},{"t":"regex","v":"ringing","vt":"str","case":true},{"t":"regex","v":"inuse","vt":"str","case":true}],"checkall":"true","repair":false,"outputs":3,"x":650,"y":300,"wires":[["bc754b90.818858"],["19885700.fabc69"],["a41a4204.29fe9"]]},{"id":"addaf9f1.d01cc8","type":"change","z":"36ca7898.7bdf48","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"IDLE","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":40,"wires":[["8ff384c.bfe6778"]]},{"id":"70236d08.e292e4","type":"change","z":"36ca7898.7bdf48","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"RINGING","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":80,"wires":[["8ff384c.bfe6778"]]},{"id":"5d383102.265e","type":"change","z":"36ca7898.7bdf48","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"IN_USE","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":120,"wires":[["8ff384c.bfe6778"]]},{"id":"8ff384c.bfe6778","type":"mqtt out","z":"36ca7898.7bdf48","name":"","topic":"exten/4001","qos":"","retain":"","broker":"459c73d.68a4d8c","x":1020,"y":80,"wires":[]},{"id":"9871d79b.d57688","type":"change","z":"36ca7898.7bdf48","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"IDLE","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":160,"wires":[["25f7721a.7960ce"]]},{"id":"78a437d0.dc7c88","type":"change","z":"36ca7898.7bdf48","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"RINGING","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":200,"wires":[["25f7721a.7960ce"]]},{"id":"519cfd63.413db4","type":"change","z":"36ca7898.7bdf48","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"IN_USE","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":240,"wires":[["25f7721a.7960ce"]]},{"id":"25f7721a.7960ce","type":"mqtt out","z":"36ca7898.7bdf48","name":"","topic":"exten/4003","qos":"","retain":"","broker":"459c73d.68a4d8c","x":1020,"y":200,"wires":[]},{"id":"bc754b90.818858","type":"change","z":"36ca7898.7bdf48","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"IDLE","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":280,"wires":[["152c5552.67110b"]]},{"id":"19885700.fabc69","type":"change","z":"36ca7898.7bdf48","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"RINGING","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":320,"wires":[["152c5552.67110b"]]},{"id":"a41a4204.29fe9","type":"change","z":"36ca7898.7bdf48","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"IN_USE","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":360,"wires":[["152c5552.67110b"]]},{"id":"152c5552.67110b","type":"mqtt out","z":"36ca7898.7bdf48","name":"","topic":"exten/4004","qos":"","retain":"","broker":"459c73d.68a4d8c","x":1020,"y":320,"wires":[]},{"id":"fc3d0ba.7bad3f8","type":"daemon","z":"36ca7898.7bdf48","name":"","command":"/usr/bin/php","args":"/root/lgaetz-hinterland.php","autorun":true,"cr":false,"redo":true,"op":"string","closer":"SIGKILL","x":250,"y":100,"wires":[["d0102568.da0828","d1933095.e0025"],[],[]]},{"id":"d0102568.da0828","type":"function","z":"36ca7898.7bdf48","name":"","func":"var values = msg.payload.trim().split('\\t'); // trim off the crlf first then split into parts \nmsg.payload = values[0]; // replace payload with the reading we want\nreturn msg;","outputs":1,"noerr":0,"x":230,"y":260,"wires":[["43c98d86.65d534"]]},{"id":"43c98d86.65d534","type":"function","z":"36ca7898.7bdf48","name":"","func":"if (msg.payload.match(/\\r/g)) {\n const msgArr = msg.payload.split('\\r');\n msgArr.forEach(item => node.send({payload:item}));\n return;\n} else {\n return msg;\n}","outputs":1,"noerr":0,"x":380,"y":300,"wires":[["3aedb22.998dc4e"]]},{"id":"d1933095.e0025","type":"telegrambot-notify","z":"36ca7898.7bdf48","name":"","bot":"2fe21bf4.832cd4","chatId":"763138506","message":"","parseMode":"","x":460,"y":100,"wires":[]},{"id":"459c73d.68a4d8c","type":"mqtt-broker","z":"","name":"","broker":"192.168.0.10","port":"1883","clientid":"node-red","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"2fe21bf4.832cd4","type":"telegrambot-config","z":"","botname":"pbxbot","usernames":"","chatIds":"---","pollInterval":"300"}]`



I just went back to the
but it's a bit broken because it doesn't filter events (even though it claims it can) and Asterisk generates a LOT of events so I was worried I would be overloading my little Pi running the AMI connector rather than the simple and selective PHP script