Last calls from KPN Experiabox V8 (Arcadyan VGV7519)

In this subforum you can show projects you have made, or you are busy with. Please create your own topic.

Moderator: leecollings

Post Reply
User avatar
FireWizard
Posts: 1907
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Last calls from KPN Experiabox V8 (Arcadyan VGV7519)

Post by FireWizard »

Dear interested reader,

My internet service provider has supplied a KPN router of the type Experiabox V8 (Arcadyan VGV 7519) in order to connect to the internet.
This router has also the possibility to serve as a wireless access point. Because of the poor quality of that functionality I don't use it, as such.

Experiabox_V8_Arcadyan_VGV7519.jpeg
Experiabox_V8_Arcadyan_VGV7519.jpeg (15.3 KiB) Viewed 795 times

I decided to look, if there is interesting information available in that Experiabox.
In my opinion not much of interest. However I found that it would be nice, if the last incoming and outgoing calls could be presented in Domoticz as a "text sensor". As I have some other applications presented in Domoticz using Node RED and MQTT, I decided to create a flow, connecting the Caller history of that Experiabox to Domoticz. A similar approach should be possible for other versions or brands, such as V9 or V10.

Node Red Experiabox_flow.png
Node Red Experiabox_flow.png (41.85 KiB) Viewed 795 times

1. The first node is a simple inject node, configured as a 5 minute pulse in order to poll the URL of the Experabox every 5 minutes.
Feel free to change it to any value you like.

2. The second node is a http request node to poll the Experiabox URL.
The "Method" is: GET and the URL is: http://192.168.2.254/voip_status.stm (Default KPN IP address).
Tick "Use authentication" (basic authentication), No Username and as Password the one you have configured in your Experiabox to access the
web page. This will result in a stream of data, to much for the debug pane. I routed it to a file.

3. The third node is a split node in order to get multiple messages, so that it can be filtered in:

4. The fourth node is a filter node, in order to split between Incoming an Outgoing calls and to get rid of unneeded messages.

5. The fifth node is a function node to prepare it for Domoticz.

Code: Select all

//This function node takes the last incoming call number, date and time, and call duration.
//For each telephone number the following information is available:
//
//voip_i_Phone[45] = '0612345678';
//voip_i_Date[45] = '10.10.2019/18:24:42';
//voip_i_Keep[45] = '00:24:17';
//voip_i_AC[45] = 1;
//voip_i_AC_Phone[45] = '+31202456789';
//voip_i_Port[45] = '1';
//voip_i_Send[45] = '2163794544';
//voip_i_Receive[45] = '2151110216';
//voip_i_Lost[45] = '8';
//voip_i_Jitter[45] = '2153693772';
//var i_count= 46;
//
//The items to extract are the incomming callnumber (voip_i_Phone[45]), the date and time, and the duration(Keep)
//The other items are technical information and errorinformation


msg.topic = "Incoming_Calls";

if (msg.payload.substr(0,13) == "var i_count= ") {
    flow.set("last_call_idx",((parseInt(msg.payload.substr(13)))-1).toString());
//    msg.payload = (flow.get("last_call_idx"));
//    return msg;
}

if (msg.payload.substr(0,19) == "voip_i_Phone[" + (flow.get("last_call_idx")) + "] = ") {
    flow.set("last_Phone_RX",(msg.payload.substr(20,10))); 
//    msg.payload = (flow.get("last_Phone_RX"));
//    return msg;
}

if (msg.payload.substr(0,18) == "voip_i_Date[" + (flow.get("last_call_idx")) + "] = ") {
    flow.set("last_DateTime_RX",(msg.payload.substr(19,19)));
//    msg.payload = (flow.get("last_DateTime_RX"));
//    return msg;
}

if (msg.payload.substr(0,18) == "voip_i_Keep[" + (flow.get("last_call_idx")) + "] = ") {
    flow.set("last_Duration_RX",(msg.payload.substr(19,8)));    
//    msg.payload = (flow.get("last_Duration_RX"));
//    return msg;
}

var last_call_in = ("Datum/Tijd: " + flow.get("last_DateTime_RX")) + "\n" + "Tijdsduur: " + (flow.get("last_Duration_RX")) + "\n" + "Nummer: " + (flow.get("last_Phone_RX"));
msg.payload = {"command":"udevice","idx":314,"nvalue":0,"svalue":last_call_in};

return msg;
and

Code: Select all

//This function node takes the last outgoing call number, date and time, and call duration.
//For each telephone number the following information is available:
//
//voip_o_Phone[27] = '0612345678';
//voip_o_Date[27 = '07.10.2019/13:03:58';
//voip_o_Keep[27] = '00:41:58';
//voip_o_AC[27 = 1;
//voip_o_AC_Phone[27] = '+31202456789';
//voip_o_Port[27] = '1';
//voip_o_Send[27] = '2163794544';
//voip_o_Receive[27] = '2151110216';
//voip_o_Lost[27] = '8';
//voip_o_Jitter[27] = '2153693772';
//var o_count= 28;
//
//The items to extract are the outgoing callnumber (voip_o_Phone[27]), the date and time, and the duration(Keep)
//The other items are technical information and error information


msg.topic = "Outgoing_Calls";

if (msg.payload.substr(0,13) == "var o_count= ") {
    flow.set("last_call_idx_o",((parseInt(msg.payload.substr(13)))-1).toString());
//    msg.payload = (flow.get("last_call_idx_o"));
//    return msg;
}

if (msg.payload.substr(0,19) == "voip_o_Phone[" + (flow.get("last_call_idx_o")) + "] = ") {
    flow.set("last_Phone_TX",(msg.payload.substr(20,10))); 
//    msg.payload = (flow.get("last_Phone_TX"));
//    return msg;
}

if (msg.payload.substr(0,18) == "voip_o_Date[" + (flow.get("last_call_idx_o")) + "] = ") {
    flow.set("last_DateTime_TX",(msg.payload.substr(19,19)));
//    msg.payload = (flow.get("last_DateTime_TX"));
//    return msg;
}

if (msg.payload.substr(0,18) == "voip_o_Keep[" + (flow.get("last_call_idx_o")) + "] = ") {
    flow.set("last_Duration_TX",(msg.payload.substr(19,8)));    
//    msg.payload = (flow.get("last_Duration_TX"));
//    return msg;
}

var last_call_out = ("Datum/Tijd: " + flow.get("last_DateTime_TX")) + "\n" + "Tijdsduur: " + (flow.get("last_Duration_TX")) + "\n" + "Nummer: " + (flow.get("last_Phone_TX"));
msg.payload = {"command":"udevice","idx":315,"nvalue":0,"svalue":last_call_out};

return msg;
6. The sixth node is a standard RBE node, in order to avoid that the message will be been sent every 5 minutes and that it will fill the Domoticz log very quickly.

7. The last node is the MQTT Input node to Domoticz.

The complete flow has been published below:

Code: Select all

[{"id":"473789d5.8c7e","type":"tab","label":"KPN ExperiaBox V8","disabled":false,"info":""},{"id":"42fcd3ea.fa58ec","type":"inject","z":"473789d5.8c7e","name":"5 MinuteTick","topic":"","payload":"","payloadType":"date","repeat":"300","crontab":"","once":true,"onceDelay":0.1,"x":120,"y":180,"wires":[["bf0fe6d.3498c98"]]},{"id":"bf0fe6d.3498c98","type":"http request","z":"473789d5.8c7e","name":"Request Experia Box","method":"GET","ret":"txt","paytoqs":false,"url":"http://192.168.2.254/voip_status.stm","tls":"","proxy":"","authType":"basic","x":340,"y":180,"wires":[["93511680.50399"]]},{"id":"e950aceb.5634e8","type":"filter","z":"473789d5.8c7e","name":"Filter Input/Output","property":"payload","propertyType":"msg","asArray":false,"itemProperty":"","itemPropertyType":"item","rules":[{"t":"cont","v":"var i_count","vt":"str","output":1},{"t":"cont","v":"voip_i_Phone","vt":"str","output":1},{"t":"cont","v":"voip_i_Date","vt":"str","output":1},{"t":"cont","v":"voip_i_Keep","vt":"str","output":1},{"t":"cont","v":"var o_count","vt":"str","output":2},{"t":"cont","v":"voip_o_Phone","vt":"str","output":2},{"t":"cont","v":"voip_o_Date","vt":"str","output":2},{"t":"cont","v":"voip_o_Keep","vt":"str","output":2}],"checkall":"true","outputs":2,"x":750,"y":180,"wires":[["d81a1f53.51a48","84ddd115.9698d8"],["b4d68c5b.17b5e8","5e92f79d.305308"]]},{"id":"d81a1f53.51a48","type":"debug","z":"473789d5.8c7e","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":970,"y":80,"wires":[]},{"id":"93511680.50399","type":"split","z":"473789d5.8c7e","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":550,"y":180,"wires":[["e950aceb.5634e8"]]},{"id":"b4d68c5b.17b5e8","type":"debug","z":"473789d5.8c7e","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":970,"y":280,"wires":[]},{"id":"84ddd115.9698d8","type":"function","z":"473789d5.8c7e","name":"Incoming Calls","func":"//This function node takes the last incoming call number, date and time, and call duration.\n//For each telephone number the following information is available:\n//\n//voip_i_Phone[45] = '0612345678';\n//voip_i_Date[45] = '10.10.2019/18:24:42';\n//voip_i_Keep[45] = '00:24:17';\n//voip_i_AC[45] = 1;\n//voip_i_AC_Phone[45] = '+31202456789';\n//voip_i_Port[45] = '1';\n//voip_i_Send[45] = '2163794544';\n//voip_i_Receive[45] = '2151110216';\n//voip_i_Lost[45] = '8';\n//voip_i_Jitter[45] = '2153693772';\n//var i_count= 46;\n//\n//The items to extract are the incomming callnumber (voip_i_Phone[45]), the date and time, and the duration(Keep)\n//The other items are technical information and errorinformation\n\n\nmsg.topic = \"Incoming_Calls\";\n\nif (msg.payload.substr(0,13) == \"var i_count= \") {\n    flow.set(\"last_call_idx\",((parseInt(msg.payload.substr(13)))-1).toString());\n//    msg.payload = (flow.get(\"last_call_idx\"));\n//    return msg;\n}\n\nif (msg.payload.substr(0,19) == \"voip_i_Phone[\" + (flow.get(\"last_call_idx\")) + \"] = \") {\n    flow.set(\"last_Phone_RX\",(msg.payload.substr(20,10))); \n//    msg.payload = (flow.get(\"last_Phone_RX\"));\n//    return msg;\n}\n\nif (msg.payload.substr(0,18) == \"voip_i_Date[\" + (flow.get(\"last_call_idx\")) + \"] = \") {\n    flow.set(\"last_DateTime_RX\",(msg.payload.substr(19,19)));\n//    msg.payload = (flow.get(\"last_DateTime_RX\"));\n//    return msg;\n}\n\nif (msg.payload.substr(0,18) == \"voip_i_Keep[\" + (flow.get(\"last_call_idx\")) + \"] = \") {\n    flow.set(\"last_Duration_RX\",(msg.payload.substr(19,8)));    \n//    msg.payload = (flow.get(\"last_Duration_RX\"));\n//    return msg;\n}\n\nvar last_call_in = (\"Datum/Tijd: \" + flow.get(\"last_DateTime_RX\")) + \"\\n\" + \"Tijdsduur: \" + (flow.get(\"last_Duration_RX\")) + \"\\n\" + \"Nummer: \" + (flow.get(\"last_Phone_RX\"));\nmsg.payload = {\"command\":\"udevice\",\"idx\":314,\"nvalue\":0,\"svalue\":last_call_in};\n\nreturn msg;","outputs":1,"noerr":0,"x":980,"y":140,"wires":[["3f25b90e.74b78e"]]},{"id":"5e92f79d.305308","type":"function","z":"473789d5.8c7e","name":"Outgoing Calls","func":"//This function node takes the last outgoing call number, date and time, and call duration.\n//For each telephone number the following information is available:\n//\n//voip_o_Phone[27] = '0612345678';\n//voip_o_Date[27 = '07.10.2019/13:03:58';\n//voip_o_Keep[27] = '00:41:58';\n//voip_o_AC[27 = 1;\n//voip_o_AC_Phone[27] = '+31202456789';\n//voip_o_Port[27] = '1';\n//voip_o_Send[27] = '2163794544';\n//voip_o_Receive[27] = '2151110216';\n//voip_o_Lost[27] = '8';\n//voip_o_Jitter[27] = '2153693772';\n//var o_count= 28;\n//\n//The items to extract are the outgoing callnumber (voip_o_Phone[27]), the date and time, and the duration(Keep)\n//The other items are technical information and error information\n\n\nmsg.topic = \"Outgoing_Calls\";\n\nif (msg.payload.substr(0,13) == \"var o_count= \") {\n    flow.set(\"last_call_idx_o\",((parseInt(msg.payload.substr(13)))-1).toString());\n//    msg.payload = (flow.get(\"last_call_idx_o\"));\n//    return msg;\n}\n\nif (msg.payload.substr(0,19) == \"voip_o_Phone[\" + (flow.get(\"last_call_idx_o\")) + \"] = \") {\n    flow.set(\"last_Phone_TX\",(msg.payload.substr(20,10))); \n//    msg.payload = (flow.get(\"last_Phone_TX\"));\n//    return msg;\n}\n\nif (msg.payload.substr(0,18) == \"voip_o_Date[\" + (flow.get(\"last_call_idx_o\")) + \"] = \") {\n    flow.set(\"last_DateTime_TX\",(msg.payload.substr(19,19)));\n//    msg.payload = (flow.get(\"last_DateTime_TX\"));\n//    return msg;\n}\n\nif (msg.payload.substr(0,18) == \"voip_o_Keep[\" + (flow.get(\"last_call_idx_o\")) + \"] = \") {\n    flow.set(\"last_Duration_TX\",(msg.payload.substr(19,8)));    \n//    msg.payload = (flow.get(\"last_Duration_TX\"));\n//    return msg;\n}\n\nvar last_call_out = (\"Datum/Tijd: \" + flow.get(\"last_DateTime_TX\")) + \"\\n\" + \"Tijdsduur: \" + (flow.get(\"last_Duration_TX\")) + \"\\n\" + \"Nummer: \" + (flow.get(\"last_Phone_TX\"));\nmsg.payload = {\"command\":\"udevice\",\"idx\":315,\"nvalue\":0,\"svalue\":last_call_out};\n\nreturn msg;","outputs":1,"noerr":0,"x":980,"y":220,"wires":[["ff4993cf.0b9088"]]},{"id":"f58b5c52.bc6508","type":"debug","z":"473789d5.8c7e","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1410,"y":80,"wires":[]},{"id":"fe60a9aa.2a5538","type":"debug","z":"473789d5.8c7e","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1410,"y":280,"wires":[]},{"id":"3f25b90e.74b78e","type":"rbe","z":"473789d5.8c7e","name":"Send Once","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":1190,"y":140,"wires":[["f58b5c52.bc6508","aa2e1fba.12cdb"]]},{"id":"ff4993cf.0b9088","type":"rbe","z":"473789d5.8c7e","name":"Send Once","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":1190,"y":220,"wires":[["fe60a9aa.2a5538","aa2e1fba.12cdb"]]},{"id":"aa2e1fba.12cdb","type":"mqtt out","z":"473789d5.8c7e","name":"Domoticz In","topic":"domoticz/in","qos":"2","retain":"false","broker":"f9f13036.e28b58","x":1410,"y":180,"wires":[]},{"id":"f9f13036.e28b58","type":"mqtt-broker","z":"","name":"RPI1_ MQTT_Broker","broker":"192.168.10.51","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
In order to use this flow for your application you have to create 2 virtual "Text sensors" for Incoming calls and Outgoing calls.
Do not forget to replace the IDX numbers for the IDX numbers of your newly created virtual sensors.

Screenshot_Experiabo_Latest-calls.png
Screenshot_Experiabo_Latest-calls.png (104.14 KiB) Viewed 795 times
For privacy reasons the telephone numbers has been removed.

Known issues:

1.
The caller history is updated after the call has been terminated. So it is not possible to see the current call.
Due to the polling frequency of 5 minutes the sensor is updated some 5 minutes after the call has been terminated.

2.
It appears, that the flow updates the sensor in three steps.
First the phone number is updated, then the call Date/Time and finally the call Duration.
That results in three entries in the log. I have to look to that.

I'm open for comments, suggestions, improvements, etc.

Best regards.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest