OH3 TR-064 Configuration Channel "Call List Days"

Hello everyone,

the construction of an information page about my Fritzbox is making progress. I would also like to influence the output of the “avmfritz_CallList” item. At the moment the result looks like this:

{“localNumber”:“1234567”,“remoteNumber”:“123456789”,“date”:“2021-11-06T18:24:00+01”,“type”:3,“duration”:9},

I would like to insert “callerNumber” and “calledNumber” and format the date and time differently (date: 06.11.2021. Time: 18:05). However, at the moment I don’t know how to do that.

Does anyone have any suggestion?

Regards

Add the JavaScript Transformation to the channel and transform the value in a .js.

I’ve done a little research and think adding the JavaScript transform is done as shown. The file is then saved under …/transform. I still have a problem with formulating the .js file. There are certainly differences for date and time or “callerNumber” and “calledNumber”.

Can somebody help me with it?

Regards

1 Like

Am I in the wrong forum or is there really no suggestion for me from the experts represented here?

Suggestion for …? What is your transformation like now? What did you expect it to do? What is it doing instead?

Key point of interest. The channel state update will get passed to your JS as a string. If you want to handle it as a datetime or something, you’ll need to parse the string first.

(function(i) {
    return i.replace(/localNumber/, 'calledNumber').replace(/remoteNumber/, 'callerNumber').replace(/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):\d{2}.\d{2}/, '$3.$2.$1 $4:$5');
})(input)

First replace the names, then reformat the date. No need to use sourceFormat

Thank you very much Jan N. Klug, you have helped me a lot. I can use it to tackle other projects.

Best regards