TR-064 Thing Action phonebookLookup not working

Hi altogether,

I have migrated to OH3 recently. As the FritzBox TR-064 binding has been discontinued in OH3, I had to switch to a combination of FritzBox AVM binding (gets the phone calls) and the new TR-064 binding (should look up the name in the phonebook).

I therefore have to use the action phonebookLookup. And I cannot get it running. This is my (simplified) rule:

rule "Eingehendes Telefongespräch"
    Item telefonStatus changed to "RINGING" or
    Item telefonStatus changed to "DIALING"  

	var tr064Actions = getActions("tr064","tr064:fritzbox:0d0a940e63")
	var String anruferNummer =  String::format("%1$s",telefonGespraech_eingehend.state)
	var String angerufeneNummer = String::format("%1$s",telefonGespraech_ausgehend.state)
	var String anrufer = tr064Actions.phonebookLookup(anruferNummer)
	var String angerufener = tr064Actions.phonebookLookup(angerufeneNummer)
	logInfo("Anruf", "letzter Anrufer: " + anrufer)
	logInfo("Anruf", "letzter Angerufene: " + angerufener)

The error message in the log is:

[ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'praesenz-4' failed: 'phonebookLookup' is not a member of 'org.openhab.core.thing.binding.ThingActions'; line 43, column 23, length 43 in praesenz

Is there anyone who has an idea what is going on?

Thank you so much!

I have exactly the same error.
Could you fix it?

Hi guys,

I had te same problem and I have updated the tr064 binding to the latest snapshot version yesterday in the karaf console:

update org.openhab.binding.tr064

I have this version now:      │ openHAB Add-ons :: Bundles :: TR-064 Binding

Now it is working without problems.


Despite the current version, the Ruhle does not work as it should.
In the string anruferNummer or angerufeneNummer there is not only one phone number but both separated by commas. So they cannot be resolved by the phone belly.
How can you split the string into two separate phone number strings?


I do it like this:

	var String ownNumber = ""
	var String extPartyNumber = ""

	logInfo("CALL:", "Incoming call: Getting caller name and number...")
	ownNumber = (fboxIncomingCall.state as StringListType).getValue(0) // get own number called
	extPartyNumber = (fboxIncomingCall.state as StringListType).getValue(1) // get caller number

Then you can use the extPartyNumber to resolve the Name.

var String callerName = tr064Actions.phonebookLookup(extPartyNumber, 8) // if no matching entry is found, number is returned
1 Like

Thanks for the solution, it works.

Hi, could you please also post the items?

Thanks :slight_smile:

Call fboxActiveCall “Acive call: [%1$s]” { channel=“avmfritz:fritzbox:UID:active_call” }
Call fboxIncomingCall “Incoming call: [%2$s to %1$s]” { channel=“avmfritz:fritzbox:UID:incoming_call” }
Call fboxOutgoingCall “Outgoing call: [%2$s to %1$s]” { channel=“avmfritz:fritzbox:UID:outgoing_call” }


Beside the lookupPhonebook actions the TR-064 binding provides a profile which does the math for you. See my example


Hi Christoph,

even easier, thanks for sharing :slight_smile:


You are welcome.

That is what profiles are made for: reducing the number of rules and the effort to get them running.

1 Like

Thanks guys.
Yes, I still had to decompose the string generated from the incoming_call CALL item. In the meanwhile, I have done that.
But, besides from being new to JSR223, I am not sure whether I understood Christphs example correctly. I see the TR064 actions also there, so what is the profile for?

This is how I have done it:

Thing channel: avmfritz:fritzbox:192_168_0_1:incoming_call
Linked item: FRITZBox7560IncomingCall_Resolved
Profile: Phonebook

Then new settings show up: “Profile Configuration”
Here I can select the “Phone Number Index” = 1 (0 = my number, 1 = caller-number)

My rule (script-part):

val telegramAction = getActions("telegram","telegram:telegramBot:xxx")
logInfo("Fritzbox", "Incoming Call: " +FRITZBox7560IncomingCall_Resolved.state)
telegramAction.sendTelegram("☎️ Incoming Call @home: %s",FRITZBox7560IncomingCall_Resolved.state)

Not sure if this is the correct way, but it works :slight_smile:

1 Like

sometimes it is too easy. works perfect with me as well-. No rules needed for phonebook lookup beside that I rule the last caller into an item so that it is saved until the next call comes. Thanks Christian.

OK, this nearly works for me.

I define the item via UI, String item, phonebook profile, I can select the phonebook. Now there is one remaining problem: It resolves correctly the name, but tells in the log:

Exception while formatting value 'Philipp' of item FRITZBox_AusgehenderAnruf with format '%1$s to %2$s': Format specifier '%2$s'

I have not defined this format specifier, somehow it seems to have been predefined.

(If I define a Call item from the same channel, without phonebook profile, it correctly shows “phonenumber1 to phonenumber2”.)

I am using OH 3.0 Stable. Should I update to 3.1 Snapshot?

I updated the binding to 3.1.0, ( deleted the binding from OH3 and placed the snapshot 3.1.0 jar file to addons )

can you double check that your item is really a string? I struggled with that as well and I created a call item by mistake first.
i have added meta data to my string item, state description pattern %s . Not sure if this solves the issue

The meta data state description %s did the trick! Is working now, still with avmfritz 3.0.0.
Thank you!

I might have discovered a bug. I tried the following item definition

Call Fritz_Incoming_Call “Anrufende Nummer [$1$s an %2$s]” { channel=“avmfritz:fritzbox:192_168_178_1:incoming_call” [profile=“transform:PHONEBOOK”, phonebook=“dca2683d47:Google”, phoneNumberIndex=1]}

This gives following error:

Cannot initialize PHONEBOOK transformation profile: UID must have at least 3 segments… Profile will be inactive.

Setting the item definition to

Call Fritz_Incoming_Call “Anrufende Nummer [$1$s an %2$s]” { channel=“avmfritz:fritzbox:192_168_178_1:incoming_call” [profile=“transform:PHONEBOOK”, phonebook=“tr064:fritzbox:dca2683d47:Google”, phoneNumberIndex=1]}

Cannot initialize PHONEBOOK transformation profile: Cannot split ‘phonebook’ parameter. Profile will be inactive.

I think the problem is in If I understood correctly it tries to parse the thing UID from the phonebook param. But it splits the param by : Since the thinguid itself contains : this won’t work.

Here’s how I finally got it to work: when looking at the “comprehensive example”, don’t get distracted by the <PHONEBOOK_NAME> voodoo.

When your name for the Thing (Bridge) is


then your PHONEBOOK profile in your item must be exactly the same name, just with the colons URL-encoded (3A), so it should say

[profile="transform:PHONEBOOK", phonebook="tr064_3Afritzbox_3A1"]

So, full example would be:


Bridge tr064:fritzbox:1 "FRITZ!Box 7590" [


// Call Monitor Equipment

Group gCALLMONITOR "Call Monitor" ["Equipment"]

Call fritzIncomingCall "Incoming Call [from %2$s to %1$s]" (gCALLMONITOR) ["Status"] { channel="avmfritz:fritzbox:1:incoming_call" }

Call fritzActiveCall "Active Call [from %1$s]" (gCALLMONITOR) ["Status"] { channel="avmfritz:fritzbox:1:active_call" }

Call fritzOutgoingCall "Outgoing Call [from %2$s to %1$s]" (gCALLMONITOR) ["Status"] { channel="avmfritz:fritzbox:1:outgoing_call" }

String fritzCallRinging "Status [%s]" (gCALLMONITOR) ["Status"] { channel="avmfritz:fritzbox:1:call_state" }

// resolved numbers (only if TR-064 binding is installed)

String fritzIncomingCallCallee "Incoming Call - Callee [%s]" (gCALLMONITOR) ["Status"] { channel="avmfritz:fritzbox:1:incoming_call" [profile="transform:PHONEBOOK", phonebook="tr064_3Afritzbox_3A1"] }

String fritzIncomingCallCaller "Incoming Call - Caller [%s]" (gCALLMONITOR) ["Status"] { channel="avmfritz:fritzbox:1:incoming_call" [profile="transform:PHONEBOOK", phonebook="tr064_3Afritzbox_3A1", phoneNumberIndex=1, matchcount="8"] }

String fritzActiveCallCaller "Active Call - Caller [%s]" (gCALLMONITOR) ["Status"] { channel="avmfritz:fritzbox:1:active_call" [profile="transform:PHONEBOOK", phonebook="tr064_3Afritzbox_3A1"] }

String fritzOutgoingCallCallee "Outgoing Call - Callee [%s]" (gCALLMONITOR) ["Status"] { channel="avmfritz:fritzbox:1:outgoing_call" [profile="transform:PHONEBOOK", phonebook="tr064_3Afritzbox_3A1"] }

String fritzOutgoingCallCaller "Outgoing Call - Caller [%s]" (gCALLMONITOR) ["Status"] { channel="avmfritz:fritzbox:1:outgoing_call" [profile="transform:PHONEBOOK", phonebook="tr064_3Afritzbox_3A1", phoneNumberIndex=1, matchcount="8"] }

I appreciate the work put in this, but the existing documentation for caller number lookup is a complete guessing game.

And the description in the binding is misleading. In the Bridge definition the term


is used, and in the Item definition the example provided is


With rootuid and fritzboxTR064, this will not work.


Hi Alexander,

Thanks for finding this out as well as describing it so detailed. With having this change applied, I also don´t get any failure message anymore and the items are responding well. But it always shows me the telephone number, not a name.

Did you test it with the standard binding of openHAB 3.0 or a 3.1 snapshot?

And is it OK to have a space in the phonebook name or might this limit the binding to look into it? As I understood with the code you stated it should look in all ponebooks, or?