Page 1 of 1

Please change behaviour of Fritzbox

Posted: Thursday 19 November 2015 6:35
by joshimosh
I am using the Fritzbox call monitor to signal incoming calls. This work pretty well, but ;-)

There are two Fritzbox devices which can be used together with a lua script: a text "device", which delivers the calling phone number and a switch device, which changes from "Off" to "On" when a call is picked up.

When the phone rings, I see in lua a device change of the text device, which triggers my script (and which I use to display the calling number). There is also an entry in the protocol of the device. When the call is picked up, the change from "Off" to "On" gives me another trigger - fine. When the call is finished, the switch related to Fritzbox changes from "On" to "Off" and triggers my script (where I turn off the display of the calling number). The protocol of the text "device" also shows an entry (Disconnect), but this does *not* trigger my lua script (no device_changed). It would - in my view - be an improvement, if a disconnect signal from Fritzbox would not only produce an entry in the device's protocol, but also would trigger a device_changed.
The reason for this suggestion is, that if it rings and the call is not picked up, I never get a trigger when the caller disconnects, because the switch mentioned above does not change (it changes only if the call is picked up) and the text "device" only fires on RING, but not on DISCONNECT.

So, may I suggest that the text "device" of Fritzbox also signals a change to the event system, when there is a DISCONNECT from the Fritzbox.

Thank you for considering my suggestion.

Josh

Re: Please change behaviour of Fritzbox

Posted: Thursday 19 November 2015 8:18
by gizmocuz
It should update on disconnect, if possible please check the code (not large) of FritzboxTCP.cpp

Re: Please change behaviour of Fritzbox

Posted: Thursday 19 November 2015 9:24
by joshimosh
OK, I will have a look at the source code (later today, gotta run now).
But I am sure that a disconnect does not trigger my lua script.
I'll be back to you later.
Thank you
Josh

Re: Please change behaviour of Fritzbox

Posted: Thursday 19 November 2015 17:04
by joshimosh
I had a look at the code, but since there are only very few comments, I have not really understood what is going on there.
My best guess is that the incoming messages from the Fritzbox are parsed in ParseLine(), but I have no idea where the event system gets notified. In the general logfile I have entries when Fritz sends CALL or RING and device events (deviceChanged) are triggered. In the device specific log I also see entries when Fritz sends CONNECT or DISCONNECT, but there are no entries in the general logfile (domoticz.log) and no device event occurs.
I must admit that I am not the best C++ pgrogrammer in the world and I may perhaps not have seen omething very obvious in the code. I only can again emphasize that in my environment (V2.3608) the event system does not trigger when Fritz sends DISCONNECTs, while CALL and RING work as one should expect.

Sorry, but I am afraid that I am at the end of my possibilities.

Cheers
Josh

Re: Please change behaviour of Fritzbox

Posted: Thursday 19 November 2015 19:21
by gizmocuz
As you can see in the code, the following is handled:

if (Cmd == "CALL")
else if (Cmd == "RING")
else if (Cmd == "CONNECT")
else if (Cmd == "DISCONNECT")

so that's all there can be handled

"CALL"
- text sensor change

"RING"
- text sensor change

"CONNECT"
Switch change

"DISCONNECT"
Switch change

Re: Please change behaviour of Fritzbox

Posted: Thursday 19 November 2015 21:02
by joshimosh
Thanks a lot for the explanation - I did not see that :oops:
But it confirms what I see in my logs and in my lua script. May I ask you to review this choice (RING and CALL change text sensor, CONNECT and DISCONNECT change switch sensor) ? If you use RING to inform about an incoming call and the ID of the caller, then you can only remove this information when the call is connected, because only then you will have a switch change on DISCONNECT. If there is no CONNECT change (because the call is not taken), then (quite obviously) there is no DISCONNECT change and your lua script has no chance to remove the information about the call.
A switch change on DISCONNECT would not help, since there was no CONNECT before and thus it is not a change. My suggestion would be to have a text change *and* a switch change on DISCONNECT. I have no idea of any unwanted side effects - you are in a much better position to judge it.

Again, thank you for the background information.

Cheers
Josh

Re: Please change behaviour of Fritzbox

Posted: Friday 20 November 2015 8:33
by gizmocuz
Okey, i have seen in the code that i silently updated the textbox, so you could not use this in an event

Could you try beta #3617 to see if this is working for you ?

Re: Please change behaviour of Fritzbox

Posted: Friday 20 November 2015 10:37
by joshimosh
gizmocuz wrote:Okey, i have seen in the code that i silently updated the textbox, so you could not use this in an event

Could you try beta #3617 to see if this is working for you ?
Of course ! Thank you very much !

I am currently not at home, but I hope that I can give it a try this afternoon.
I'll report back asap.

Again thank you for implementing it ob short notice.
Cheers
Josh

Re: Please change behaviour of Fritzbox

Posted: Friday 20 November 2015 16:50
by joshimosh
Sorry, it took some time because of a relatively busy afternoon, but it works now as expected. I called from my mobile, got a RING and my script was triggered. I did not pick up but cancelled the call on my mobile, got a DISCONNECT and my script was trigered again with a disconnect text message.
Thank you very much !
Have a nice evening and a wonderful weekend
Josh

Re: Please change behaviour of Fritzbox

Posted: Thursday 16 February 2017 9:25
by Bluelightcrew
joshimosh wrote:Sorry, it took some time because of a relatively busy afternoon, but it works now as expected. I called from my mobile, got a RING and my script was triggered. I did not pick up but cancelled the call on my mobile, got a DISCONNECT and my script was trigered again with a disconnect text message.
Thank you very much !
Have a nice evening and a wonderful weekend
Josh
Could you share the script, I try some similar

Re: Please change behaviour of Fritzbox

Posted: Thursday 06 April 2017 14:58
by Benneton
Hi,

Would be great indeed when you can share this.
I tried to build this with blocky but I could not get it to work.
I know that is NOT a Blocky / Domoticz problem but most likely a user error :)

Thank you,
Benneton

Re: Please change behaviour of Fritzbox

Posted: Thursday 18 January 2018 21:17
by honselbonsel
Hi,
i would also be very happy if anybody may share the code for this :-)

Thank You
br
Jens