• 10 dec 2017: forum version update. In case of issues use this topic.
  • 30 nov 2017: pilight moved servers. In case of issues use this topic.
Hello There, Guest! Login Register


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Event action sipcal to make a voip phonecall
#1
Can't hear your doorbell in the garden or on upper floors?
I decided to use our existing dect/voip phones, connected to a Fritz!box, as remote doorbells, using pilight.
Therefore I created a new event action 'sipcall'. This makes it possible to use rules like:
Code:
"rules": {
    "deurbel1": {
      "rule": "IF deurbel.state IS on THEN switch DEVICE deurbel TO off AND sipcall PHONENUMBER **620 TTS \"Aan de voordeur wordt gebeld\"",
      "active": 1
    },
    "deurbel2": {
      "rule": "IF deurbel.state IS on THEN switch DEVICE deurbel TO off AND sipcall PHONENUMBER **620 TTSFILE deurbel.wav",
      "active": 1
    },

Source code and documentation is in https://github.com/pdreef/pilight (branche sipcall).

I have an working setup now (not yet with a real doorbell but with a generic_switch).

All code is in
libs/pilight/events/actions/sipcall.c
libs/pilight/events/actions/sipcall.h
libs/pilight/config/settings.c

For the sipcall settings I had to make additions to the global settings.c-file. Is there a better way, to make it more modular?
 
Reply
#2
Nice idea Smile What i'm wondering if we can't make a direct socket library for SIP.
 
Reply
#3
Thanks :-).
Possibly. All required functionality is in the PJSUA lbrary which can be linked in any program.
I choose (for this first try) to use a separate program for the actual call handling code (sipcall.c) and keep the pilight code as simple as possible (most of it is based on the sendmail action). By launching sipcall as a separate process with a set of parameters there is less risk on locking pilights event processing. I'm not a real c programmer (more PHP, C#/.Net and Javascript) and not yet deep enough in pilight internal working to oversee all consequences. But will be happy to contribute to this.
 
Reply
#4
Can you link to the libraries used and the sipcall.c?
 
Reply
#5
* PJSUA API: (http://www.pjsip.org)
* https://github.com/pdreef/sipcall This is a modified version of https://github.com/binerry/RaspberryPi/t.../sip-tools

Maybe I introduced some confusion, but there are 2 sipcall.c files:
one is for the pilight action, the other (in the seperate repo) is for the actual sipcall program
 
Reply
#6
I really love the idea. I have a SIP phone myself. But i really want as much as possible in plain C as possible without making external program calls. If there is a lightweight library that can work with SIP it's fine as well.
 
Reply
#7
I don't think it will work 'all in c'. There is not only the dependence of PJSUA but sipcall/sipcall.c also makes a wget call to Google Translate (and then needs sox to convert the resulting mp3 to wav) or it uses eSpeak. All these have to be installed on the system. I realize that I have to add these to the dependency list in my repo Wink.
 
Reply
#8
Hey

I am really interested in this idea.
We live in a apartment and i want the intercom also in the basement (where i also have a sip phone)

i have no idea how much work it is but it would be nice if there is a possibility to:
- use the microphone and speaker
- set a relay to open (for X seconds) with a key press of the sip phone

but even without this function
Great stuff and i will add this to my todo list Smile
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  _VARSTORE_ set action fourty2 1 1,205 05-19-2019, 09:07 PM
Last Post: curlymo
  skipping overridden action switch do1eh 2 858 01-19-2019, 05:25 PM
Last Post: do1eh
  http action Niek 21 5,764 08-12-2018, 11:44 AM
Last Post: rorie
  action: Pushbullet bazb 24 13,614 01-04-2018, 08:38 PM
Last Post: curlymo
  action: pushover Niek 36 20,327 12-03-2017, 11:13 AM
Last Post: Alex
  Always trigger event on any device state Phil 8 2,895 03-22-2017, 07:30 PM
Last Post: Phil
  datetime event again wupperpi 5 2,868 02-26-2017, 10:11 PM
Last Post: wo_rasp
  Calling URL on event couchninja 5 2,949 06-29-2016, 08:43 PM
Last Post: Niek
  action: file Niek 14 5,035 06-23-2016, 04:02 PM
Last Post: Niek
  event at randomized time after another event Emiks5 3 1,807 05-07-2016, 09:10 AM
Last Post: Thunder84

Forum Jump:


Browsing: 1 Guest(s)