Fritzbox Binding - Rule when someone calls me

Hi,
want to read out the given values from the fritzbox-binding, when someone calls me.

Here is the item:

Switch  Call_Incoming           "Ringing"                       (gPhone)    { fritzbox="inbound" }
Call    Call_Incoming_No        "Caller No. [%2$s to %1$s]"     (gPhone)    { fritzbox="inbound" }

Here is my rule to send the number to my android phone:

rule "send notification on incomming call"
when
    Item Call_Incoming received update
then
		if (Call_Incoming.state==ON) {
				sendNotification("name@email.com", "Phonecall Fritzbox " +Call_Incoming_No.state)
		}
end

I get a notification with the following text:

Phonecall Fritzbox 012345, 098765

012345 is the incoming number
098765 is my internal phone number

How are this numbers stored in the item? rlkoshak mentioned some time ago, i can not separate the value into two parts. But i can´t believe that, is there realy no way to separate this with a rule? I think the separator is the comma (,) between the two numbers.

How can i compare the complete value with a given number sequence? Maybe this way?

If phone rings
then
    if phone-number is 01234, 09876
    then
        send notification (doorbell rings)
    else if phone-number is 08888,09876
    then
        send notification (friend is ringing)
end

Wouldn’t you just extract the Call Item state as a string, then slice it how you want it into new variables?

I use the Freeswitch binding and have a rule which announces who is calling over my Squeezebox;

rule "Freeswitch active call"
when
    Item VT_Phone_ActiveCall received update
then
    val CallType activeCall = VT_Phone_ActiveCall.state as CallType
    var String originating = activeCall.origNum.toString
    var String destination = activeCall.destNum.toString

    if (originating != "" || destination != "") {
        if (originating != "") {
            var String command = "/opt/openhab/etc/scripts/phonebook.py '" + originating + "'"
            originating = executeCommandLine(command, 2000)
        } else {
            originating = "unknown"
        }
        if (destination != "") {
            var String command = "/opt/openhab/etc/scripts/phonebook.py '" + destination + "'"
            destination = executeCommandLine(command, 2000)
        } else {
            destination = "unknown"
        }

        // notify if we are receiving an incoming call (and we are home)
        if (destination == "Home" && GP_Presence.state == ON) {
            VT_Announce_Info.postUpdate("Incoming call from " + originating)
        }
    }
end

VT_Announce_Info causes a voice announcement over my kitchen Squeezebox. And the python script simply does a lookup to try and match the numbers to known contacts to give a name rather than a series of digits.

NOTE: the announcement is only made if it is an incoming call, and someone is home :).

1 Like

do you get a notification if someone takes a group call like **9 or internal call ? Or does this only work with dialing numbers ?
i do only ring my internal phones with shortnumbers **9 for all, and callmonitor does not recognize anything. only if I call numbers out or getting inbounds.