# Want NR to phone you anywhere to warn you of an alarm?

**URL:** https://discourse.nodered.org/t/want-nr-to-phone-you-anywhere-to-warn-you-of-an-alarm/49166
**Category:** Share Your Projects
**Created:** [1 August 2021 15:00 UTC](https://discourse.nodered.org/t/want-nr-to-phone-you-anywhere-to-warn-you-of-an-alarm/49166 "2021-08-01T15:00:07Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Jean-Luc](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jean-luc/32/89996_2.png) [@Jean-Luc](https://discourse.nodered.org/u/Jean-Luc)
#### Post date: [1 August 2021 15:00 UTC](https://discourse.nodered.org/t/want-nr-to-phone-you-anywhere-to-warn-you-of-an-alarm/49166/1 "2021-08-01T15:00:07Z")

</div>

### Do you want NR to phone you to warn you of an alarm for example?

For those who want to be called on their cell phone by their home automation, in case of alarm for example, here is what I set up. I use for this the software from Linphone.

You can see a short visual and auditory demo [here](https://youtu.be/wQ63hNQZvwk)

It is relatively simple.

1. First of all, you have to buy 2 SIP virtual phone numbers. Your ISP can rent them to you at about 1,30€ per month.

2. Install a SIP client on your smartphone and register your first number. Make sure you are online.

3. Install the Linphone software on your home automation, for me, it is a Pi under Linux.

Follow the steps below: 👇

### Install Linphone

`sudo apt install linphone`

### Linphone configuration

`linphonec`

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/4/84d609723094dc1bc23f58bc3cf97caa3f6ae687.png)

### Starting the SIP daemon

`linphonecsh init -c ~/.linphonerc`

Look if the default port is well occupy by linphonc daemon

`sudo lsof -i -P -n | grep LISTEN`  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/6/76bf14b5293712060e723872d7ad2992df6ac66e.png)

And now make a call with a wav file registered before like:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/b/1bb7a55890f9f4eb9d2d0e11ba72838ab2e862ab.png)

And now, in order, the commands to make to call from your Pi:

# sound initialization:

`linphonecsh generic "soundcard use files"`

# Start a call to your personal phone by exemple` `:

`linphonecsh generic "call 004122nnnnnn"`

When answering, play the wav file wanted

`linphonecsh generic "play /home/pi/Documents/Sound/msg1.wav"`

And terminate the call after a delay

`linphonecsh generic "terminate"`

It remains to use a flow NR to make phone calls in case of alarm or other needs.  
Here below an example to adapt for your personal use.  
Think of changing the SIP phone number (or fixed number) by your own

Et voilà ! 😃

```auto
[{"id":"7b282b0f357e4620","type":"tab","label":"Linphone - Alarme","disabled":false,"info":""},{"id":"f32eb89aafa3a63e","type":"exec","z":"7b282b0f357e4620","command":"linphonecsh generic \"call 0041224444444\"","addpay":false,"append":"","useSpawn":"true","timer":"25","winHide":false,"oldrc":false,"name":"Call my smartphone","x":760,"y":207,"wires":[["a3724ac1b9fcccd2","1b44f7cb0ecb9bc2"],[],[]]},{"id":"97ade5cb70a21412","type":"exec","z":"7b282b0f357e4620","command":"linphonecsh generic \"terminate\"","addpay":false,"append":"","useSpawn":"true","timer":"","oldrc":false,"name":"Termine l'appel en cours","x":1015,"y":460,"wires":[[],[],["f19bd5f304608062"]]},{"id":"a3724ac1b9fcccd2","type":"debug","z":"7b282b0f357e4620","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":970,"y":140,"wires":[]},{"id":"14d8dd2f0168c881","type":"inject","z":"7b282b0f357e4620","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1000,"y":360,"wires":[["97ade5cb70a21412"]]},{"id":"846710200c9b68f2","type":"ui_button","z":"7b282b0f357e4620","name":"","group":"35f1909c.48c1a","order":1,"width":0,"height":0,"passthru":false,"label":"Alarme C.O","tooltip":"","color":"","bgcolor":"","icon":"fa-phone","payload":"","payloadType":"date","topic":"","x":190,"y":40,"wires":[["14ad467ff32f8336"]]},{"id":"fc912c40f67f37d3","type":"ui_button","z":"7b282b0f357e4620","name":"","group":"35f1909c.48c1a","order":2,"width":0,"height":0,"passthru":false,"label":"Raccrocher le téléphone","tooltip":"","color":"","bgcolor":"","icon":"fa-phone-square","payload":"","payloadType":"str","topic":"","x":1030,"y":400,"wires":[["97ade5cb70a21412"]]},{"id":"4ebc7dac40a28fc2","type":"exec","z":"7b282b0f357e4620","command":"linphonecsh generic \"soundcard use files\"","addpay":false,"append":"","useSpawn":"true","timer":"25","oldrc":false,"name":"Défini usage of waw","x":500,"y":220,"wires":[["f32eb89aafa3a63e"],[],[]]},{"id":"1761beee730a431d","type":"exec","z":"7b282b0f357e4620","command":"linphonecsh generic \"play /home/pi/Documents/Sound/msg1.wav\"","addpay":false,"append":"","useSpawn":"false","timer":"25","winHide":false,"oldrc":false,"name":"Play C.O chaudière","x":490,"y":360,"wires":[["f659ced7eb976764"],[],[]]},{"id":"f659ced7eb976764","type":"delay","z":"7b282b0f357e4620","name":"","pauseType":"delay","timeout":"25","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":800,"y":460,"wires":[["97ade5cb70a21412"]]},{"id":"d79ca253f29b8bdd","type":"link in","z":"7b282b0f357e4620","name":"Call Phone Sip","links":["30f9cb55.cc9314","29eafc3f.f4d3f4","aff086a3.04b3e8"],"x":235,"y":160,"wires":[["ef7828fd7a7f2fa5"]]},{"id":"5b9ff26b01507b79","type":"switch","z":"7b282b0f357e4620","name":"D'où vient l'alarme ?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"CO","vt":"str"},{"t":"eq","v":"Fumée","vt":"str"},{"t":"eq","v":"Fumée étage","vt":"str"},{"t":"eq","v":"Fumée chambre David","vt":"str"},{"t":"eq","v":"Pompe-panne","vt":"str"},{"t":"eq","v":"Pompe-Voltage","vt":"str"},{"t":"eq","v":"Fumée cave","vt":"str"}],"checkall":"false","repair":true,"outputs":7,"x":220,"y":320,"wires":[["1761beee730a431d"],["6107f8ae5f38ae03"],["cbec6f29411842b0"],["688af06cdd4e992d"],["06691c99a5677956"],["e91ad1513f3046de"],["202e6281af1d4c4d"]],"outputLabels":["Détection de CO chaudière","Fumée chaudière","Fumée étage","Fumée chambre David","Pompe-panne","Pompe-Voltage","Fumée cave"]},{"id":"6107f8ae5f38ae03","type":"exec","z":"7b282b0f357e4620","command":"linphonecsh generic \"play /home/pi/Documents/Sound/msg2.wav\"","addpay":false,"append":"","useSpawn":"false","timer":"25","oldrc":false,"name":"Play fumée chaudière","x":500,"y":420,"wires":[["f659ced7eb976764"],[],[]]},{"id":"0bd95f7db4a2f2a0","type":"inject","z":"7b282b0f357e4620","name":"Inject alarme CO","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":80,"wires":[["14ad467ff32f8336"]]},{"id":"14ad467ff32f8336","type":"function","z":"7b282b0f357e4620","name":"msg-out \"CO\"","func":"global.set(\"msg-out\",\"CO\");\nreturn msg;","outputs":1,"noerr":0,"x":400,"y":80,"wires":[["4ebc7dac40a28fc2"]]},{"id":"cbec6f29411842b0","type":"exec","z":"7b282b0f357e4620","command":"linphonecsh generic \"play /home/pi/Documents/Sound/msg3.wav\"","addpay":false,"append":"","useSpawn":"false","timer":"25","oldrc":false,"name":"Play Fumée mezzanine étage","x":530,"y":480,"wires":[["f659ced7eb976764"],[],[]]},{"id":"688af06cdd4e992d","type":"exec","z":"7b282b0f357e4620","command":"linphonecsh generic \"play /home/pi/Documents/Sound/msg4.wav\"","addpay":false,"append":"","useSpawn":"false","timer":"25","oldrc":false,"name":"Play Fumée ch. David","x":500,"y":540,"wires":[["f659ced7eb976764"],[],[]]},{"id":"06691c99a5677956","type":"exec","z":"7b282b0f357e4620","command":"linphonecsh generic \"play /home/pi/Documents/Sound/msg5.wav\"","addpay":false,"append":"","useSpawn":"false","timer":"25","oldrc":false,"name":"Play Pompe-panne","x":490,"y":600,"wires":[["f659ced7eb976764"],[],[]]},{"id":"e91ad1513f3046de","type":"exec","z":"7b282b0f357e4620","command":"linphonecsh generic \"play /home/pi/Documents/Sound/msg6.wav\"","addpay":false,"append":"","useSpawn":"false","timer":"25","oldrc":false,"name":"Play Pompe 0 Volt","x":490,"y":660,"wires":[["f659ced7eb976764"],[],[]]},{"id":"202e6281af1d4c4d","type":"exec","z":"7b282b0f357e4620","command":"linphonecsh generic \"play /home/pi/Documents/Sound/msg7.wav\"","addpay":false,"append":"","useSpawn":"false","timer":"25","oldrc":false,"name":"Play Fumée cave","x":490,"y":720,"wires":[["f659ced7eb976764"],[],[]]},{"id":"1b44f7cb0ecb9bc2","type":"function","z":"7b282b0f357e4620","name":"Récupère la variable msg-out","func":"var message = global.get(\"msg-out\") || 0;\nmsg.payload = message\nreturn msg;","outputs":1,"noerr":0,"x":1020,"y":194,"wires":[["9fa011ddc9ea067e"]]},{"id":"9fa011ddc9ea067e","type":"delay","z":"7b282b0f357e4620","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"x":1231,"y":194,"wires":[["5b9ff26b01507b79"]]},{"id":"ef7828fd7a7f2fa5","type":"delay","z":"7b282b0f357e4620","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":180,"y":220,"wires":[["4ebc7dac40a28fc2"]]},{"id":"f19bd5f304608062","type":"debug","z":"7b282b0f357e4620","name":"Debug Termine l'appel","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1260,"y":473,"wires":[]},{"id":"35f1909c.48c1a","type":"ui_group","name":"☎ Téléphone","tab":"8fc69317.2b6ca","order":6,"disp":true,"width":"6","collapse":false},{"id":"8fc69317.2b6ca","type":"ui_tab","name":"Maintenance","icon":"settings_applications","order":11,"disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

### Author: ![krambriw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/krambriw/32/5429_2.png) [@krambriw](https://discourse.nodered.org/u/krambriw)
#### Post date: [1 August 2021 15:09 UTC](https://discourse.nodered.org/t/want-nr-to-phone-you-anywhere-to-warn-you-of-an-alarm/49166/2 "2021-08-01T15:09:04Z")

</div>

Jean-Luc, nice possibility but tell me what advantage this non-cost free alternative would give in comparison with cost free alternatives? Like me, I'm using Telegram, it has all I can imagine. When there is an alarm in my home automation, NR calls my iPhone via Telegram and can attach both images and video to the text message. And then you can respond via Telegram since it supports two way communication. There are several other comparable free services available I know other people are using, even email to phone works for some

---

<div class="post-metadata">

### Author: ![Jean-Luc](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jean-luc/32/89996_2.png) [@Jean-Luc](https://discourse.nodered.org/u/Jean-Luc)
#### Post date: [1 August 2021 15:19 UTC](https://discourse.nodered.org/t/want-nr-to-phone-you-anywhere-to-warn-you-of-an-alarm/49166/3 "2021-08-01T15:19:23Z")

</div>

Correct. I also use Telegram and email in parallel, that said, if you want to call a landline or smartphone without the Telegram app, it's useful.  
The SIP phone is also very useful to call from anywhere to anywhere. I use it between different countries to call people who do not have these applications. A company for example.  
The call is free.  
You can also call me on this landline number for free for the caller, no matter where I am.

---

<div class="post-metadata">

### Author: ![letmedothis](https://avatars.discourse-cdn.com/v4/letter/l/46a35a/32.png) [@letmedothis](https://discourse.nodered.org/u/letmedothis)
#### Post date: [7 June 2022 13:26 UTC](https://discourse.nodered.org/t/want-nr-to-phone-you-anywhere-to-warn-you-of-an-alarm/49166/4 "2022-06-07T13:26:16Z")

</div>

can we use DTMF and somehow pass it back to node-red?

---

<div class="post-metadata">

### Author: ![Jean-Luc](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jean-luc/32/89996_2.png) [@Jean-Luc](https://discourse.nodered.org/u/Jean-Luc)
#### Post date: [7 June 2022 18:36 UTC](https://discourse.nodered.org/t/want-nr-to-phone-you-anywhere-to-warn-you-of-an-alarm/49166/5 "2022-06-07T18:36:26Z")

</div>

What do you mean by DTMF?  
And what do you want to do with it in NR ?

---

<div class="post-metadata">

### Author: ![spady7](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/spady7/32/67541_2.png) [@spady7](https://discourse.nodered.org/u/spady7)
#### Post date: [9 September 2022 07:28 UTC](https://discourse.nodered.org/t/want-nr-to-phone-you-anywhere-to-warn-you-of-an-alarm/49166/6 "2022-09-09T07:28:09Z")

</div>

Hi, nice job!!  
I'am interested too to DTMF.  
For example could be useful call someone, play a msg about alarm (as u did) but also ask to called to press, for instance, number 5, to accept alarm's call. So by passing back a DTMF input in NR u can think about doing something else. So, is possibile manage DTMF codes passed back in such a way?  
Regards

---

<div class="post-metadata">

### Author: ![Jean-Luc](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jean-luc/32/89996_2.png) [@Jean-Luc](https://discourse.nodered.org/u/Jean-Luc)
#### Post date: [9 September 2022 17:25 UTC](https://discourse.nodered.org/t/want-nr-to-phone-you-anywhere-to-warn-you-of-an-alarm/49166/7 "2022-09-09T17:25:49Z")

</div>

This is a really good idea! 👍  
I haven't dug deeper into Linphone since my last topic so I don't know how to answer. I'm using it as is. Sorry.  
I've looked a bit at what the net says about it, it seems you can use the log but I haven't found a factual explanation of how to do it either.  
I would also be interested if you could find a way to retrieve the normalized frequencies to know the response of the user via his keyboard.  
This would make it a real alarm center that could be configured.  
Of course it would need some redundancy in it.

In the meantime, here is what I could glean from it.  
For my part I lack time to dive more into the research. Good luck and I hope you will find and share with us the solution.

> <https://stackoverflow.com/questions/59428417/how-to-handle-the-dtmf-in-linphone>

> <https://raspberrypi.stackexchange.com/questions/120534/sip-client-for-raspberry-pi-receive-call-wait-for-dtmf-tones-button-presses>
