ha-plugins icon indicating copy to clipboard operation
ha-plugins copied to clipboard

Show called number ("to") in webhook

Open cg089 opened this issue 1 year ago • 3 comments

Hi, thanks for this great addon!

I don't have a Fritz!Box anymore, but I use a basic account on easybell.de for VoIP. There I configured my number as a trunk with 100 extensions. So my number would be 012-34567, but I can call 012-34567-89 as well as 012-34567-12 - and all of these calls come to the single VoIP number.

I used it in former times with a Fritz!Box for managing my smarthome depending on the selected number I dialed. I had a shortcut on my car, calling my garage door which would then open the door upon calling.

However, at this time I can't see what number was called because it is not in the webhooks. However, the called number is in the protocols.

Example:

Protocol says:

ACK sip:[email protected]:5064;ob SIP/2.0
Via: SIP/2.0/UDP 195.185.37.60;branch=xxx;rport
From: <sip:[email protected]>;tag=xxx
To: <sip:[email protected]>;tag=xxx
Call-ID: xxx
CSeq: 10 ACK
Content-Length: 0

Webhook says:

payload: object
event: "call_disconnected"
caller: "<sip:[email protected]>"
parsed_caller: "0171xxxxxxx"
sip_account: 1
_msgid: xxx

It would be really helpful to have the called number ("To") also in the webhooks!

cg089 avatar Oct 29 '24 21:10 cg089

I actually looked into this some time ago, and I wasn't able to find that number in the information provided by pjsip. If you find something I'm happy to implement this.

arnonym avatar Nov 12 '24 19:11 arnonym

Hi, I am able to find the called number in the Logs within Home Assistant. The log states (see above):

To: <sip:[email protected]>;tag=xxx

Which includes the called number.

cg089 avatar Nov 12 '24 23:11 cg089

For me the required value would be P-Called-Party-ID: <sip:**[email protected]>, which I can also see in the ha-sip logs, but this field doesn't seem to exist in the pjsua2.CallInfo.

I need this in order to ignore broadcast (Rundruf) calls from the FRITZ!Box as they are pretty useless if every call gets immediately answered by ha-sip.

Of course the better way would be to exclude the ha-sip IP phone from these broadcasts, but this isn't possible in FRITZ!Box UI.

rainerwein avatar Jul 17 '25 16:07 rainerwein