Need to do a call via OH

Hi there,

I’m looking for a solution which I can use to do a call to a landline. Within this call I need to be able to type numbers as the receiving end is waiting for input. It should look like

  1. Call number 123456789
  2. Wait 10 seconds
  3. Input Code 1234
  4. Wait 5 seconds
  5. Input Code 5678

I don’t care if this call is done via my FritzBox 7490 or any online solution for which I had to pay for (any suggestions? If you I’d prefer a german solution as the number to call is a german one).

Do you have any suggestions of Bindings / RPi solutions?

Thanks in advance.

The old fashioned way to do it would be hardware - a modem controlled over a serial interface with AT commands.

First come to my mind, is using Asterisk (voip) which has a scripted (AGI) interface facility. Asterisk can be a client for FrizBox7490/Voip.
Are the InteractiveVoiceResponsen Codes fixed/known upfront ? In case not fixed, then a solution is a bit more difficult.

Aside one can/could have lot’s of fun in using a rPI or ESP8266 that controls a real-landline (for example a cheap/old DECT that may be misused) keyboard-phone.
Technically, though it require some soldering and interfacing, not to difficult and use MQTT for OH message transport. Not sure if you are looking for a labourdoes hardware implementation.

Hi PtrO,
yes the response codes are known upfront and are numeric.

Do you have any good tutorials, etc for the way you mentioned?

In regards to your second paragraph:
To be honest this will be too much for me as I’m not very known in this topic. I’d definitetely prefer a software solution.

I’ve done some googeling and man solutions build on SIPcall. Would this emulate a phone and use my landline or could I do these calls via paid voip?

p.S. The best thing would be a voip solution as the number I’m calling is a cellphone number and if you’re german or live in germany you probably know that calling from landline to cellphone can get quite expensive per connection / minute. As I’ll be doing this about 10 - 15 times a day this can sum up to a value I’m not willing to pay. I assume voip will be cheaper.


First thing you have to do is get Asterisk running and have it operative to your FritzBox. This is a bit outside the openHAB are(n)a.
There are tons of guides but every situation will be different from yours. So prepare for a bit of trial of error which also require some knowledge howto configure the Fritz and Asterisk.
In summary not too difficult, it consists of defining a voipphone-user (as phone-device & user on the Fritz) and a matching sip-connnection in sip.conf on Asterisk.
Though easy, I do realize it can be a steep ride but is lot’s of fun once you have your own PBX. Of course you need some landing-zone where the Asterisk is active, myself have run in the corner of my Qnap. Others may use a (or extra) Raspberry or the server where OH is.

Once this Asterisk-Fritz is operative, you can start playing around with AGI scripting: read this
I picked this one explicitly, as it contains (shell-script) snippets for your InteractiveVoiceResponse requirements.
The AGI/Asterisk-script can be initiated by openHAB via a simple Exec binding, for example.

If and in case openHAB need to respond to Asterisk status (for example lights-on if phone rings, one can use the Asterisk-binding. The binding readme contains also other options for Asterisk to control openHAB.

Thank you very much for your very good explanation. I will definitely give it a shot.

One last question:
So outgoing calls will be dialed like with my regular phones, thus the costs will be billed by my telephone provider or do I have the posibility to change these calls to some other voip service which might be cheaper?

Every call will cost me 20 cents which are about 2 - 3 € per day if the system will do this 10 - 15 times a day.

Thanks in advance!

You’re welcome. Always nice to share ideas.

For phone-providers you’ve already a number of call-route options, depending on the phone-number one can route calls on Fritz via the landline, use one of its defined Voip (see tab Phonenumbers@Fritz) and/or through carrier prefixes.

When one add Asterisk, merely your own internal Voip-PBX provider, one can add sip (“voip-line”) connections directly to a Voip provider and (in this case) use the “Fritz” as (internet traffic) connection router. The options can be a bit overwhelming as one can have different ways in doing things.

Rereading your primary concern, costs, I would first search for a provider that has cheaper costrates per call. Well-known parties will start at approx 1-2ct/minute. Others may have a monthly flat-fee subscription (going between €10-20/month) for unlimited (fair-use) calls.

Note, in all cases do NOT transfer your landline-phone number yet, which will lock you in. A physical line cannot be migrated easily. Simply take a new private (voip) phone-number which only takes minutes to get. You can always migrate landlines later, once you’re happy.

Back ontopic openHAB, Asterisk in combo of OH simply create a new world of options. For example, controlling openHAB through your tochtone (mobile)phone by dialing your “phone-number” which can easily be intercepted. For example, when my phone rings, I mute the audio-sound in the room through openHAB. When I’m away, or sleeping which is known by OH, I reroute depending on caller-id to a Asterisk voice-box. etc.etc… In addition, I can control OH as-like it was a IVR system etc.etc.

Hi Matthaeus,

I too have your necessity. I tried to use Asterisk, but maybe it wasn’t for me. In the end I installed sipcmd which I think is more similar to our purpose.

Hey i am also working on a similar thing call a number play a tts wait for DTMF then hung up. I kind of managed to get it working using a bash script that calls asterisk ami where i have custom dial plan. The problem i am facing is my trunk is a pstn gateway so it pickup the call before the actual number answers.
How did you use the sipcmd?