SIP Client

Did anybody wrote a script/rule to dial out via SIP protocol which could be published here?
Use case is quite easy: In case of fire alarm I want openHAB to connect via SIP to my Fritzbox and dial a mobile phone number.
No text-to-speech and no playing of wav/mp3 files required. Just dialing out.

I remember once being successful with linphone. But this was years ago and I do not have the code anymore.
Look for the linphone-deamon, it is a CLI you could call with the exec-binding.

Another option would be Jami, here you find some details on how to get it up and running on a Raspberry Pi.
Good luck

thanks thomas. will give it a try. however, if anybody is out there who wrote a python script please let me know

Have a look at Call phone with Fritzbox binding and fritzconnection if that helps.

Rule:

rule "VoIP Call on Klingel"
when
  Item Klingel changed from OFF to ON
then
  executeCommandLine("/opt/sipcmd/sipcmd -P sip -u voip-user -c 1234 -a Klingel -w 10.10.80.9 -x 'c**610;h'")
end

thanks, but I’d prefer to set it up as a SIP connection rather than a proprietary interface

yeah, I saw that, too. But I found out that this tool is not supported anymore and does not run on latest unix versions

I try it in Docker with Ubuntu 18.4 and FritzOS 7.25 and it works.

Perhaps this is an Alternative.

Which SIP client do you suggest under openhabian? I guess it should be possible to trigger the calls without much hassle …

I was also looking for a simple solution to send simple messages from OpenHab to my internal phones (using SIP). I stumbled across the simple Python script FemtoSIP (GitHub - astoeckel/femtosip: Minimal Python SIP implementation ringing phones as a door bell replacement).

This can be used easily with the exec-binding:

~/openhab/python $ ./femtosip.py --user MYSIPUSER --password "MYSIPPASSWD"  --gateway 192.168.178.1 --call '**614' --display hello
...
2023-09-26 11:06:15,358 request: INVITE sip:**614@192.168.178.1
2023-09-26 11:06:15,876 response: SIP/2.0 100 Trying
2023-09-26 11:06:15,879 response: SIP/2.0 183 Session Progress
2023-09-26 11:06:30,879 request: CANCEL sip:**614@192.168.178.1
2023-09-26 11:06:31,741 response: SIP/2.0 487 Request Cancelled

It works like a charm!

BTW: Offcourse after configuring the user MYSIPUSER in my VoIP configuration (FritzBox).
sip

1 Like

Interesting. Do you know if this script can ring an external device (by dialing out instead of calling internal function **9)?

Interesting. Do you know if this script can ring an external device (by dialing out instead of calling internal function **9)?

Yes, it works for any number that the SIP user is allowed to dial.

1 Like