Whole House Intercom/Audio System

1,710 views
Skip to first unread message

Brian Crosby

unread,
Jan 26, 2014, 8:11:19 AM1/26/14
to ope...@googlegroups.com

Hey OpenHAB enthusiasts!!!

I am wondering if anyone has thought of a means to have whole house audio in addition to a intercom system.

We can almost do whole house intercom today. Use Sonos binding. But then there is the issue of microphones for audio back to OH.

There are IP enabled ceiling mount speakers that have 2 way audio. But then that duplicates the Sonos setup.

Another option is tablets mounted in each room. Then a combo of Sonos + Astriks/FreeSwitch. And some mod to the bindings and OH.

Thoughts????

Dan

unread,
Jan 26, 2014, 9:20:21 AM1/26/14
to ope...@googlegroups.com
Freeswitch has webrtc support built in, if you are using android you could have a webview with their simple webrtc phone app in it and tie it to a "intercom"  conference room or something like that.  You might use this in combination with real sip clients on the other devices who could auto answer when their extension is rang (maybe by the conference room).  I have a few Nexus 7 tablets that I was thinking about doing something like this with video.   I'm sure asterisk could be used as well, but I have not used it in many years. 

Dan

unread,
Jan 26, 2014, 9:27:18 AM1/26/14
to ope...@googlegroups.com
Well I just assumed android has webrtc support, it does not.  

Ok new plan ;-)

Use real sip clients on all devices, each device is an extension.  Using the freeswitch binding that I'm currently writing, you could have a button ("Page House") which would send a api command to freeswitch to trigger the intercom dialplan which would dial all extensions into a conference room.   I'm sure there are some other pitfalls, but this is where I might start. You might use this in conjunction with your sonus system, you page over the sonus and someone responds and continues the conversation on a sip client on a device. 

Karel Goderis

unread,
Jan 26, 2014, 10:54:29 AM1/26/14
to ope...@googlegroups.com
Dan

since you are an expert on PBX's, what would you recommend : freeswitch or one of the Asterisk distro's (if the latter, which distro?)?

Karel

--
You received this message because you are subscribed to the Google Groups "openhab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openhab+u...@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
Visit this group at http://groups.google.com/group/openhab.
For more options, visit https://groups.google.com/groups/opt_out.

Dan

unread,
Jan 26, 2014, 11:27:23 AM1/26/14
to ope...@googlegroups.com
I don't want to knock Asterisk, for some people its the right choice.  I think Freeswitch is the most extensible voip switch out there, I run it at home and use it in many commercial applications.  The dial plan matching is awesome, it speaks everything, its backed by Nokia's sip stack (Sofia), it supports embedded applications using lua or javascript and, well I just added API support in the openhab freeswitch binding about 5 mins ago, so now you can do just about anything in it from openhab  ;-)

I run everything on Debian, but thats just me.  Freeswitch runs on just about everything, I'm in the process of moving my home instance to a Raspberry Pi running Raspian.  A lot of people on their mailing list run CentOS and I believe there is a PBX distro based on CentOS and Freeswitch. 

Karel Goderis

unread,
Jan 27, 2014, 9:31:10 AM1/27/14
to ope...@googlegroups.com
Dan

Just had a look at it, and it looks great. For me the +1 is the fact that it runs on Mac OS X without too many/any changes. That means that I do not need to pump one or the other distro in a virtual machine on my Mac Mini, and will allow to do funky applications (e.g. routing a voice call originated by the front door video tel onto the Sonos infra etc. ). And of course, the fact that you wrote a binding for OH ;-)

K

Timoh

unread,
Jan 27, 2014, 3:38:01 PM1/27/14
to ope...@googlegroups.com
I actually have a plan around this, yet to be implemented though.

I have a clearone AP800 Conferencing System.  They are cheap...  Got mine off kijiji for $60 or something like that.  The AP800 has 8 mic/line inputs,  4 line inputs, 12 line outputs, 32 IO pins and is serial controlled.  This makes it very interesting for a couple of home applications.  For whole house audio you get a 6x6 (stereo) matrix with full control of routing, volume, tone, etc.  I haven't yet written the binding for OpenHAB, but it is my intention to do so in the next 6-12 months.

What is very interesting about the AP8000, or probably any other similar system, is that it has all sorts of features for microphone management.  Mic can detect ambient noise and will only turn on when it rises above a certain level.  Very good if the TV is on for example, you need to speak louder than the TV than the TV to get heard.  Mixing... The AP800 has mixing so if you are between two mics, or can setup an array of mics, it will combine all the audio for stronger signal.  The AP800 knows how much sound is being played through it's outputs and uses that to help determine microphone input.

I've some posts on other HA forums where people are using AP800& similar for voice control.  They have an array of mics around their house all fed into the the voice recognition software.  Apparently it works well.

Tim

Karel Goderis

unread,
Apr 4, 2014, 10:56:06 AM4/4/14
to ope...@googlegroups.com
Dan,

ever tried the mod_portaudio module ? (https://wiki.freeswitch.org/wiki/Mod_portaudio)

With respect to building a PA with OH and Sonos, one would have to write a dial-plan whereby the poraudio output-port on the OH host is connected to a Sonos AMP. in OH you would define a Swich Item that is triggered by an active call (filtered) to the portaudio extension, that triggers a rule whereby the Sonos is set to play the URI of the line-in of the Sonos device that is connected to the out-port of the OH host soundcard. 

K

On 26 Jan 2014, at 15:20, Dan <d...@digitaldan.com> wrote:

Will Stewart

unread,
Apr 5, 2014, 11:32:41 AM4/5/14
to ope...@googlegroups.com
This overlaps feature sets I have on my list, which include;

 - Using CMU PocketSphinx to accept voice commands from multiple rooms, providing voice feedback with MaryTTS when appropriate. In this case, the voice commands could be "Intercom Kitchen" and so forth.
 - Be able to talk to someone at the front door (discovered and possibly ID'd with video analytics) if indisposed or away from home via smartphone.
 - Play music in various rooms via mpd binding

Freeswitch and the AP800 look interesting, so I'm going to have to assemble a number of architectural alternatives to evaluate.

One approach I'm thinking about is having RPis (or ODroid) in each of these rooms with the RPi camera, a USB mike, and small amplifier and ceiling/wall mount speaker, so that I can
  a. Know when someone is in the room and who they are (presence)
  b. Handle all aspects of the audio input, output, and whatever local routing is required, from the voice commands and responses to the intercom and music playlist features.


Dan Cunningham

unread,
Apr 5, 2014, 2:08:57 PM4/5/14
to ope...@googlegroups.com
I have only played with pa briefly as an experiment using free switch as a soft phone, definitely worth looking at again since this was 2 years ago.   Everything u mentioned is defiantly possible, the freeswitch binding can issue any command , but I really should refactor it to be both a binding and a action , much like the  xmpp package.

Sent from my iPhone
You received this message because you are subscribed to a topic in the Google Groups "openhab" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openhab/Ivl-P4DDfsc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openhab+u...@googlegroups.com.

To post to this group, send email to ope...@googlegroups.com.
Visit this group at http://groups.google.com/group/openhab.
For more options, visit https://groups.google.com/d/optout.

Karel Goderis

unread,
Apr 6, 2014, 5:20:21 AM4/6/14
to ope...@googlegroups.com
Dan

Is there a way to capture in-call dtmf codes in openhab using the freeswitch binding? Use case is to remotely open a door or gate using dtmf when a front door call is routed to a mobile phone

Karel

Sent from my iPhone
For more options, visit https://groups.google.com/d/optout.

Dan Cunningham

unread,
Apr 7, 2014, 2:17:14 PM4/7/14
to ope...@googlegroups.com
Actually, I would not use the binding for this.  Instead I would use a simple freeswitch dial plan app .  In the dialplan for the intercom number you would add the bind_meta_app application
<action application="bind_meta_app" data="KEY LISTEN_TO FLAGS APPLICATION[::PARAMETERS]"/>
This would allow you to react to a single digit pressed on one or both sides (one side in this case).   This would launch a javascript application (FS  uses V8 now for its JS engine).  In this app you could listen for more digits (or not) and then make a http call to the openHAB rest api to control an item.  All in all there would be very little code in freeswitch to get this done.  

From: "Karel Goderis" <karel....@me.com>
To: ope...@googlegroups.com
Sent: Sunday, April 6, 2014 3:20:21 AM
Subject: Re: [openhab] Whole House Intercom/Audio System



Ben Jones

unread,
Apr 7, 2014, 4:05:41 PM4/7/14
to ope...@googlegroups.com
Hi Dan - slightly off topic but I was wondering if it is possible to get openHAB to initiate a call to an external number as a result of some event. I am a complete noob when it comes to PBX software, and have only done some initial reading on Freeswitch, but I am very interested. I have just switched over to a VOIP homeline and want to initiate a call to my mobile (and the wifes) when the alarm is triggered. Is this possible? I am guessing yes...

Dan Cunningham

unread,
Apr 7, 2014, 5:37:08 PM4/7/14
to ope...@googlegroups.com
The freeswitch binding in openHAB master  (for 1.5 release) will allow you to do this.  I need to refactor this part of the binding into a action, but in the mean time take a look at  https://github.com/openhab/openhab/blob/master/bundles/binding/org.openhab.binding.freeswitch/README.md ,

so in your items list you might have a item like 

String FS_API "FS API [%s]" (phone) {freeswitch="api"}

in a rule you could send the FS_API item a command to make a phone call like this:

sendCommand(FS_API,"conference test-conf dial sofia/gateway/myvoipprovider/5555551212 5551212 5551212")

As soon as I finish my other binding, I may get around making this nicer.  Freeswitch also has a xmlrpc/http endpoint, if you would prefer to make http calls, either would work.

Dan-


From: "Ben Jones" <ben.j...@gmail.com>
To: ope...@googlegroups.com
Sent: Monday, April 7, 2014 2:05:41 PM

Subject: Re: [openhab] Whole House Intercom/Audio System

Hi Dan - slightly off topic but I was wondering if it is possible to get openHAB to initiate a call to an external number as a result of some event. I am a complete noob when it comes to PBX software, and have only done some initial reading on Freeswitch, but I am very interested. I have just switched over to a VOIP homeline and want to initiate a call to my mobile (and the wifes) when the alarm is triggered. Is this possible? I am guessing yes...





Ben Jones

unread,
Apr 7, 2014, 5:53:51 PM4/7/14
to ope...@googlegroups.com
Great - good to know - thanks Dan. I might have to do some more research and start having a play around with Freeswitch.

Karel Goderis

unread,
Apr 8, 2014, 3:02:21 AM4/8/14
to ope...@googlegroups.com
Dan

I have now FS running, integrated with OH and you can really do some funky stuff ;-) . However, what I would add to the binding  is support for CHANNEL_APPLICATION events so that it is possible to feedback data from FS to OH. For example, when capturing DTMF codes in FS, if would be really helpful to be able to pass the DTMF digits to OH so that the system can react upon them ("Pressing * to open a door" for example)

Karel

Ben Jones

unread,
Apr 8, 2014, 3:14:47 AM4/8/14
to ope...@googlegroups.com

What are the chances of you guys sharing your config for how you are integrating FS and OH? Would be very interested to see these 'funky' rules...

You received this message because you are subscribed to a topic in the Google Groups "openhab" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openhab/Ivl-P4DDfsc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openhab+u...@googlegroups.com.

Karel Goderis

unread,
Apr 8, 2014, 3:53:43 AM4/8/14
to ope...@googlegroups.com
I'am really at the beginning of it all, my stuff is quite basic right now, ;-) but I have implemented an overpriced doorbell using OH, FS, 2n VoIP Videophones and Sonos equipment. What I have "discovered" so far is that basically *anything* can be achieved with FS, and the difficulty is not the implementation but knowing what you want.....

Some excerpts:

in .items:

String diningURI "URI is %s" (Sonos) {sonos="[RINCON_000E58D6F1A60ABCD:playline]"
String kitchenURI "URI is %s" (Sonos) {sonos="[RINCON_000E58D6F1620ABCD:playline]"}
Switch someswitch (stateSwitches) {sonos="[ON:RINCON_000E58D6F1A60ABCD:save],[OFF:RINCON_000E58D6F1A60ABCD:restore]"}
Switch someswitch2 (stateSwitches) {sonos="[ON:RINCON_000E58D6F1620ABCD:save],[OFF:RINCON_000E58D6F1620ABCD:restore]"}
Number diningVolume (volumes) {sonos="[RINCON_000E58D6F1A60ABCD:volume]"
Number kitchenVolume (volumes) {sonos="[RINCON_000E58D6F1620ABCD:volume]"
Group stateSwitches (All)
Group volumes (All)

Switch Doorbell "Door Bell" (Phone) {freeswitch="active:Call-Direction:inbound,Caller-Destination-Number:1023"}

in .rules:

rule DoorbellRule
when
Item Doorbell changed to ON
then
stateSwitches.sendCommand(ON)
Thread::sleep(1000)
diningURI.sendCommand("RINCON_000E58D840560ABCD")
kitchenURI.sendCommand("RINCON_000E58D840560ABCD")
volumes.sendCommand(50)
playSound("doorbell.mp3")
stateSwitches.sendCommand(OFF)
end

in FS dialplan.xml

<extension name="Door_Bell">
    <condition field="destination_number" expression="^1023$">
        <action application="export" data="dialed_extension=$1"/>
        <action application="set" data="hold_music=silence"/>
        <!-- bind_meta_app can have these args <key> [a|b|ab] [a|b|o|s] <app> -->
        <action application="bind_meta_app" data="1 b s execute_extension::dx XML features"/>
        <action application="bind_meta_app" data="2 b s record_session::$${recordings_dir}/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
        <action application="bind_meta_app" data="3 b s execute_extension::cf XML features"/>
        <action application="bind_meta_app" data="4 b s execute_extension::att_xfer XML features"/>
        <action application="set" data="ringback=${us-ring}"/>
        <action application="set" data="transfer_ringback=silence"/>
        <action application="set" data="call_timeout=30"/>
        <!-- <action application="set" data="sip_exclude_contact=${network_addr}"/> -->
        <action application="set" data="hangup_after_bridge=true"/>
        <!--<action application="set" data="continue_on_fail=NORMAL_TEMPORARY_FAILURE,USER_BUSY,NO_ANSWER,TIMEOUT,NO_ROUTE_DESTINATION"/> -->
        <action application="set" data="continue_on_fail=true"/>
        <action application="hash" data="insert/${domain_name}-call_return/${dialed_extension}/${caller_id_number}"/>
        <action application="hash" data="insert/${domain_name}-last_dial_ext/${dialed_extension}/${uuid}"/>
        <action application="set" data="called_party_callgroup=${user_data(${dialed_extension}@${domain_name} var callgroup)}"/>
        <action application="hash" data="insert/${domain_name}-last_dial_ext/${called_party_callgroup}/${uuid}"/>
        <action application="hash" data="insert/${domain_name}-last_dial_ext/global/${uuid}"/>
        <!--<action application="export" data="nolocal:rtp_secure_media=${user_data(${dialed_extension}@${domain_name} var rtp_secure_media)}"/>-->
        <action application="hash" data="insert/${domain_name}-last_dial/${called_party_callgroup}/${uuid}"/>
        <action application="answer"/>
        <action application="sleep" data="1000"/>
    </conditi

K

Ben Jones

unread,
Apr 8, 2014, 5:11:07 AM4/8/14
to ope...@googlegroups.com
Thanks Karel! Much appreciated. I am going to have to buy an ATA (I don't have any IP phones) but then I intend to install FS and begin playing around. Glad to hear it is not all that difficult to get up and running.

Karel Goderis

unread,
Apr 8, 2014, 5:24:16 AM4/8/14
to ope...@googlegroups.com
I will also get an ATA as my local telco does not provide ordinary SIP trunks (even as their core switching network is VoIP!). Do you have a specific model in mind to combine with FS?

On 08 Apr 2014, at 11:11, Ben Jones <ben.j...@gmail.com> wrote:

Thanks Karel! Much appreciated. I am going to have to buy an ATA (I don't have any IP phones) but then I intend to install FS and begin playing around. Glad to hear it is not all that difficult to get up and running.

Ben Jones

unread,
Apr 8, 2014, 5:29:13 AM4/8/14
to ope...@googlegroups.com
I was looking at the Cisco SPA122. But to be honest I am completely new to this stuff so I am not sure what I need! I have a VOIP account with my ISP which I currently access via a FritzBox. That has an ATA built in so my old analogue phone is plugged directly into the Fritz.

I am thinking I replace the Fritz with a separate VDSL model/router + a SPA122 to handle the VOIP side of things. Then I can run FS on my home server to act as a VOIP server and allow me to integrate with openHAB. I presume the SPA122 will just become an endpoint for the FS PBX?

Then I should also be able to have SIP clients on my PCs and mobiles which will enable me to route incoming calls to my mobile if I am home for example? 

Hopefully I am on the right track here!

Karel Goderis

unread,
Apr 8, 2014, 9:14:42 AM4/8/14
to ope...@googlegroups.com
Ben

From what I have been reading the Linksys SPA3102 seems to be a safer choice, e.g. at least its configuration is documented in several places.

Regards
K

Dan

unread,
Apr 8, 2014, 10:44:54 AM4/8/14
to ope...@googlegroups.com
That can be done, would you purpose that we update an item with the State attribute?  I would also purpose we match the subclass attribute as part of an item configuration, so something like:

String FrontDoorPhoneInput  {freeswitch="channel_application:subclass:my_custom_message"}

This should not be to hard. Let me know what you think.

Karel Goderis

unread,
Apr 8, 2014, 10:57:55 AM4/8/14
to ope...@googlegroups.com
Dan

From the FS wiki I see that one can add stuff like

<action application='event' data='Event-Subclass=channel_state_change,State=checking_voicemail'/>

in the dialplan, and that the corresponding event looks like

ontent-Length: 1586
 Content-Type: text/event-plain
 
 Event-Subclass: channel_state_change
 Event-Name: CHANNEL_APPLICATION
 Core-UUID: d5cdc6a2-ec00-46fe-97b0-8bbb734bb1fa
 FreeSWITCH-Hostname: centos53_02005
 FreeSWITCH-IPv4: 192.168.2.5
 FreeSWITCH-IPv6: ::1
 Event-Date-Local: 2010-02-23 00:15:37
 Event-Date-GMT: Mon, 22 Feb 2010 15:15:37 GMT
 Event-Date-Timestamp: 1266851737846113
 Event-Calling-File: mod_dptools.c
 Event-Calling-Function: event_function
 Event-Calling-Line-Number: 981
 State: checking_voicemail.
 Channel-State: CS_EXECUTE

So, in theory, if the message itself is captured in the String Item, then  {freeswitch="channel_application:subclass"} should be enough, although for the beauty of it I would rather use  {freeswitch="event:subclass"} in the item definitions

K

Dan

unread,
Apr 8, 2014, 10:59:36 AM4/8/14
to ope...@googlegroups.com
If you have general FS questions I would be happy to help.

 In my house I have FS connected to 2 Cisco PAP2T boxes which provide a total of 4 analog lines, the first is connected to our house phones, the second for the fax, the third for the alarm system and the last is unused right now.  I also Have a couple voip phones.  I ditched my pots provider and went with a cheap voip provided that I could port my phone number to and also provides 911 service ( I'm in the US).  My dial plan does basic stuff, rings all phones, voicemail ect.  With the FS binding I get notified via openHAB anytime there is a incoming phone call or voice mail which is cool.  The only interesting part of my setup is if I call in via my cell phone I get a menu where I can choose to ring a particular extension, all extensions, listen to voice-mail.  I used to also control my lights and such with a voice menu, but I never really used it ( a smartphone is way more convenient).

Dan-

Karel Goderis

unread,
Apr 8, 2014, 11:14:40 AM4/8/14
to ope...@googlegroups.com
Dan

my telco is not really offering VoIP to their residential customers, as an endpoint. They actually provide you with an FXO port on what is essentially an ATA, but not a SIP subscription, which is a pitty, but that is their marketing decision. I have SIP with alternative providers obviously, but the telco is offering free national calls etc, which is not the case with the alternative SIP providers (an in order to benefit from that I had to port in my phone number with the telco). So, I intend to hookup a Linksys SPA3102 to the POTS and use that as a trunk in FS. The obvious drawback is of course that the POTS = 1 outbound connection only, so I am not sure how to tackle that in the FS dialplan, e.g. if the outbound line is busy, then FS should fall-back to the alternative SIP trunk for further outbound calls.

Did you ever experiment with the DTMF stuff?

My base case scenario would be that we get called either on in-house VoIP phone or cell phone whenever someones rings at the door, that FS sets up a videostream if possible, and that we can control access to the door by DTMF (my wife has a practice in the house so we have a lot of patient in/out all the time)

K

Dan Cunningham

unread,
Apr 8, 2014, 2:31:21 PM4/8/14
to ope...@googlegroups.com
You could handle this in a couple of ways.  I think the easiest would be to have multiple sip gateways, one would be your FXO and one being a real sip provider.  In your dialplan you could route all outbound traffic out of one (say the sip provider), or you could be selective and route calls from your house phones out the FXO port, and all others out the sip provider (like your front door, or other voip phones).  A more advanced dial plan would have both outbound providers in it, if one fails (busy) then it will continue to the next one (continue_on_fail) . 

The DTMF detection can be done in this case without any coding if desired.  Using the bind_digit_action you can tell the dialplan to listen just on the b-leg (your house or cell)  for a dtmf string (say *1) which would then execute either the event application (event,EventSubclass=my-front-door-state,State=open) or you could use curl to toggle something (curl,http://openhab/rest/items/something).


From: "Karel Goderis" <karel....@me.com>
To: ope...@googlegroups.com
Sent: Tuesday, April 8, 2014 9:14:40 AM

Subject: Re: [openhab] Whole House Intercom/Audio System




Ben Jones

unread,
Apr 8, 2014, 5:26:15 PM4/8/14
to ope...@googlegroups.com
Hey Karel,

It looks like the SPA3102 is end-of-line?

I have done a bit of research and it seems a lot of people recommend the Cisco SPA122, especially down here in NZ.

I am a little nervous about the switch over. Just with configuration of the VOIP side of things. I guess I will just have to buy the ATA and try it out.

Presumably I can run VOIP directly over the SPA122? I.e. configure my VOIP settings in the SPA122 and plug in an analog phone. This would be the first step...

Then once I install FS how does that fit in the picture? Does the config on the SPA122 change? How do the calls get routed thru FS rather than going directly to the SPA122?

Sorry for the newbie questions!

Karel Goderis

unread,
Apr 9, 2014, 2:27:07 AM4/9/14
to ope...@googlegroups.com
Ben

I saw a bunch of sites that still sell the SPA3102, and I just got me one. Here (http://wiki.freeswitch.org/wiki/SPA3102_FreeSwitch_HowTo) is the link on how that is set up afterwards

K

Ben Jones

unread,
Apr 9, 2014, 6:47:36 AM4/9/14
to ope...@googlegroups.com
Well I have just installed freeswitch on my Ubuntu server and have just made my first call - from my laptop to my mobile (running SipDroid)!

Now for the fun to begin!! Although to be honest I am not sure where to start...

I have ordered the SPA122 so hopefully it will arrive in the next day or so. I will have a go at configuring that and then seeing if I can actually make some real calls to the outside world. I realise this is not really OH related, but as soon as it is all up and running I will begin integrating with OH using Dan's binding.

Will Stewart

unread,
Apr 9, 2014, 9:57:31 AM4/9/14
to ope...@googlegroups.com
In terms of call content, what would be passed by voice to your mobile - a MaryTTS message about the specifics of the event?


--
You received this message because you are subscribed to a topic in the Google Groups "openhab" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openhab/Ivl-P4DDfsc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openhab+u...@googlegroups.com.

Ben Jones

unread,
Apr 9, 2014, 3:41:13 PM4/9/14
to ope...@googlegroups.com
Yep - that is the plan. I will probably use Google Translate as I am using that currently for my Squeezebox announcements. Perhaps MaryTTS would be better tho?

Ben Jones

unread,
Apr 11, 2014, 5:13:40 AM4/11/14
to ope...@googlegroups.com
Hi Dan,

Sorry but I am going to have to take you up on your offer of help with FS!

I am very new to this whole area but have been doing a lot of reading. I have successfully installed FS on my home server (Ubuntu) and can make internal calls between softphones installed on my laptop and Android phone.

I have just purchased a Cisco SPA122 and am in the process of signing up to a VOIP provider after moving to naked VDSL. 

So my question is this; once I sign up for my VOIP provider do I create a gateway in FS with all the login details etc. Then my SPA122 simply registers with FS rather than with my VOIP provider? This is instead of having the SPA122 register directly with the VOIP provider which I would need to do if I wasn't running FS?

So it sort of looks like;

     [VOIP Provider]  ----- internet ------ [VDSL Modem] --- [Router] ------------ [Server running FS]
                                                                                                    |
                                                                                                    |----- [SPA122] ----- [Analog phone]
                                                                                                    |
                                                                                                    |----- [Softphone]

The SPA122 is just providing me a way to get analog phones connected to FS. After that FS treats it like any other extension and I should be able to route all incoming calls to it and send any outgoing calls to the outside world via my VOIP provider?

Let me know if I am on the right track!

Many thanks for your help with this,
Ben

Dan Cunningham

unread,
Apr 11, 2014, 9:37:03 AM4/11/14
to ope...@googlegroups.com
Hey Ben, happy to help

The SPA122 will register to your Freeswitch box on the internal sip profile (this usally runs on port 5060).  In the conf/directory/default dir there will be a bunch of sample extensions, you may create a new one for the SPA122, or like most people use 1000.xml and change the password/pin.  Once your SPA registers, any thing you dial on you analog phones will be matched in the conf/dialplan/default folder.  This is where you will put your internal call routing.

Yes, you will configure a sip gateway in the external profiles directory (/conf/sip_profiles/external/my_provider.xml).  The external profile usually runs on port 5080 and is where calls from the outside come in.  When a call comes in it will be matched in the conf/dialplan/public folder.  This is where you would have freeswitch ring a phone, all phones, etc.... 

My setup is like the following (with names and credentials changed of course) :

/usr/local/freeswitch/conf/sip_profiles/external/provider.xml

<include>
<gateway name="provider-5555551212">
          <param name="username" value="5555551212"/>
          <param name="auth-username" value="5555551212"/>
          <param name="password" value="ASFJKL"/>
          <param name="from-user" value="5555551212"/>
          <param name="extension" value="5555551212"/>
          <param name="proxy" value="1.1.1.1"/>
          <param name="expire-seconds" value="3600"/>
          <param name="register" value="true"/>
          <param name="retry-seconds" value="3600"/>
        </gateway>
    </include>

/usr/local/freeswitch/conf/dialplan/default/00_outbound_provider.xml 

 This matches any internal call to a 7 digit, 11 digit or 911 to my sip provider

<include>
    <extension name="outbound">
     <condition field="destination_number" expression="^(\d{7,11}|911)$">
       <action application="set" data="effective_caller_id_number=${outbound_caller_id_number}"/>
       <action application="set" data="effective_caller_id_name=${outbound_caller_id_name}"/>
       <action application="bridge" data="sofia/gateway/provider-5555551212/$1"/>
     </condition>
   </extension>
</include>

/usr/local/freeswitch/conf/dialplan/public/00_inbound.xml

This matches any call coming into freeswitch from the outside that is dialing my external phone number
It dials the group "home" in the default xml dialplan (which rings 1000,1001 and 1002), if no one picks up it goes to voice mail (user 1000). 
<include>
  <extension name="public_did">
  <condition field="${sip_h_x-caller-dnis}" expression="^(5555551212)$">
<action application="set" data="continue_on_fail=true"/>
<action application="set" data="call_timeout=5"/>
<action application="transfer" data="home XML default"/>
<action application="answer"/>
<action application="sleep" data="1000"/>
<action application="voicemail" data="default $${domain} 1000"/>
    </condition>
  </extension>
</include>

I have a bunch of other rules to do silly things depending on the caller id and such.  Let me know how it goes!

Dan-




Sent: Friday, April 11, 2014 3:13:40 AM

Subject: Re: [openhab] Whole House Intercom/Audio System




Ben Jones

unread,
Apr 11, 2014, 9:32:24 PM4/11/14
to ope...@googlegroups.com
Brilliant - thanks Dan. I have got it all working now, even tweaked my dialplans to control which phones have the ability to dial local/national/mobile or internation numbers. Very cool!

Just building your Freeswitch binding now and will begin integrating with openHAB.

As I mentioned earlier, one the reasons for doing all this is so I can get openHAB (or perhaps mqttwarn) to dial a list of numbers when certain events happen in the house, and play a TTS message.

That should test my new-found Freeswitch skills!

Ben Jones

unread,
Apr 11, 2014, 10:05:13 PM4/11/14
to ope...@googlegroups.com
Hey Dan,

Having a problem with the 'message_waiting' item binding. I ring and leave a message and this is what I get in my binding log;

2014-04-12 13:53:57 DEBUG o.o.b.f.i.FreeswitchBinding[:166]- Recieved ESLEvent MESSAGE_WAITING
2014-04-12 13:53:57 DEBUG o.o.b.f.i.FreeswitchBinding[:462]- MWI event\n EslEvent: name=[MESSAGE_WAITING] headers=2, eventHeaders=18, eventBody=0 lines.
2014-04-12 13:53:57 DEBUG o.o.b.f.i.FreeswitchBinding[:465]- MWI Message header  :
2014-04-12 13:53:57 DEBUG o.o.b.f.i.FreeswitchBinding[:465]- MWI Message header Event-Sequence : 1546
2014-04-12 13:53:57 DEBUG o.o.b.f.i.FreeswitchBinding[:465]- MWI Message header Event-Name : MESSAGE_WAITING
2014-04-12 13:53:57 DEBUG o.o.b.f.i.FreeswitchBinding[:465]- MWI Message header MWI-Message-Account : 1000@weka
2014-04-12 13:53:57 DEBUG o.o.b.f.i.FreeswitchBinding[:465]- MWI Message header Event-Calling-Function : update_mwi
2014-04-12 13:53:57 DEBUG o.o.b.f.i.FreeswitchBinding[:465]- MWI Message header Event-Date-GMT : Sat, 12 Apr 2014 01:53:57 GMT
2014-04-12 13:53:57 DEBUG o.o.b.f.i.FreeswitchBinding[:465]- MWI Message header Core-UUID : c3193934-7633-4aec-b594-f9e817b5607c
2014-04-12 13:53:57 DEBUG o.o.b.f.i.FreeswitchBinding[:465]- MWI Message header Update-Reason : NEW
2014-04-12 13:53:57 DEBUG o.o.b.f.i.FreeswitchBinding[:465]- MWI Message header FreeSWITCH-IPv4 : 192.168.1.21
2014-04-12 13:53:57 DEBUG o.o.b.f.i.FreeswitchBinding[:465]- MWI Message header Event-Date-Local : 2014-04-12 13:53:57
2014-04-12 13:53:57 DEBUG o.o.b.f.i.FreeswitchBinding[:465]- MWI Message header FreeSWITCH-IPv6 : ::1
2014-04-12 13:53:57 DEBUG o.o.b.f.i.FreeswitchBinding[:465]- MWI Message header Event-Calling-File : mod_voicemail.c
2014-04-12 13:53:57 DEBUG o.o.b.f.i.FreeswitchBinding[:465]- MWI Message header Event-Date-Timestamp : 1397267637564040
2014-04-12 13:53:57 DEBUG o.o.b.f.i.FreeswitchBinding[:465]- MWI Message header FreeSWITCH-Switchname : weka
2014-04-12 13:53:57 DEBUG o.o.b.f.i.FreeswitchBinding[:465]- MWI Message header MWI-Voice-Message : 1/0
2014-04-12 13:53:57 DEBUG o.o.b.f.i.FreeswitchBinding[:465]- MWI Message header FreeSWITCH-Hostname : weka
2014-04-12 13:53:57 DEBUG o.o.b.f.i.FreeswitchBinding[:465]- MWI Message header Event-Calling-Line-Number : 1928
2014-04-12 13:53:57 DEBUG o.o.b.f.i.FreeswitchBinding[:465]- MWI Message header MWI-Messages-Waiting : yes
2014-04-12 13:53:57 DEBUG o.o.b.f.i.FreeswitchBinding[:482]- Message header: 1/0
2014-04-12 13:53:57 DEBUG o.o.b.f.i.FreeswitchBinding[:504]- Updating MWI to 0 VMs

I think the problem is in the message count parsing, i.e. line 489 of FreeswitchBinding.java;

Pattern pattern = Pattern.compile("([0-9]+)/([0-9]+)\\s\\([0-9]+\\/[0-9]+\\)");

As you can see I am only getting 1/0 back in the MWI-Voice-Message header. But your regex is trying to match something else after the counts.

Any ideas what I might have configured incorrectly?

My full Freeswitch version string is;

        FreeSWITCH Version 1.5.12b+git~20140409T044809Z~2d811e0ba0~64bit (git 2d811e0 2014-04-09 04:48:09Z 64bit)

I am running the latest code from Git master.

Cheers,
Ben

Dan Cunningham

unread,
Apr 12, 2014, 4:49:05 PM4/12/14
to ope...@googlegroups.com
That seems to be the issue, the FS docs describe the format of the line as:

total_new_messages / total_saved_messages (total_new_urgent_messages / total_saved_urgent_messages)

Which is what happens on my box as well as Patrik's, but obviously not yours ;-(  Since I'm not doing anything with the urgent count, I will remove that and just look for the first group.  I'll post something soon.  Thanks!




Sent: Friday, April 11, 2014 8:05:13 PM

Subject: Re: [openhab] Whole House Intercom/Audio System

--
You received this message because you are subscribed to a topic in the Google Groups "openhab" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openhab/Ivl-P4DDfsc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openhab+u...@googlegroups.com.

Ben Jones

unread,
Apr 12, 2014, 6:08:21 PM4/12/14
to ope...@googlegroups.com
Sounds good - cheers!

digit...@gmail.com

unread,
Apr 12, 2014, 10:15:53 PM4/12/14
to ope...@googlegroups.com
Give the attached jar a try (delete the orig one first of course), I'm now matching just number / number 

Pattern.compile("([0-9]+)/([0-9]+).*");


On Saturday, April 12, 2014 4:08:21 PM UTC-6, Ben Jones wrote:
Sounds good - cheers!
org.openhab.binding.freeswitch.jar

Dan Cunningham

unread,
Apr 12, 2014, 10:18:50 PM4/12/14
to ope...@googlegroups.com
FYI this post is going to show up twice, I sent the first one as the wrong google user and it got stuck for review... in any case

Try the attached jar (make sure to delete the old one first).  I'm now just matching number / number  like so:

Pattern.compile("([0-9]+)/([0-9]+).*");

Dan-



Sent: Saturday, April 12, 2014 4:08:21 PM

Subject: Re: [openhab] Whole House Intercom/Audio System

Sounds good - cheers!
org.openhab.binding.freeswitch.jar

Ben Jones

unread,
Apr 12, 2014, 10:34:11 PM4/12/14
to ope...@googlegroups.com
Nice one Dan - that seems to be working now - thanks!

Ben Jones

unread,
Apr 16, 2014, 1:18:01 AM4/16/14
to ope...@googlegroups.com
Dan (and anyone else using the Freeswitch binding), 

Thought this might be of interest. I have just implemented some rules to silence my home phones from ringing when no one is home;

OPENHAB RULE

rule "House occupancy"
when
    Item Presence changed
then
    if (Presence.state == OFF) {
        // update freeswitch (so we can silence phone ringing etc)
        Freeswitch_API.postUpdate("global_setvar openhab_presence=false")
    } else {
        // update freeswitch (so we can enable ringing etc)
        Freeswitch_API.postUpdate("global_setvar openhab_presence=true")
    }
end

FREESWITCH CONFIG

* Add the following to vars.xml

  <!-- openHAB Global Variables -->
  <X-PRE-PROCESS cmd="set" data="openhab_presence=true"/>

* Update public/incoming dialplan...

<include>

  <extension name="public_did">

    <!-- only interested in calls to our number from the outside world -->
    <condition field="destination_number" expression="^(xxxyyyzzz)$"/>

    <!-- if someone is home then ring all phones and divert to voicemail if
         no one answers -->
    <condition field="${openhab_presence}" expression="true" break="on-true">
      <action application="set" data="domain_name=$${domain}"/>
      <action application="set" data="hangup_after_bridge=true"/>
      <action application="set" data="continue_on_fail=true"/>
      <action application="set" data="call_timeout=20"/>
      <action application="bridge" data="group/home@$${domain}"/>
      <action application="answer"/>
      <action application="sleep" data="1000"/>
      <action application="voicemail" data="default $${domain} 1000"/>
    </condition>

    <!-- if noone is home then simulate ringing for 15s and then divert
         to voicemail -->
    <condition field="${openhab_presence}" expression="false" break="on-true">
      <action application="set" data="domain_name=$${domain}"/>
      <action application="set" data="domain_name=$${domain}"/>
      <action application="ring_ready"/>
      <action application="sleep" data="15000"/>

dan cunningham

unread,
Apr 16, 2014, 2:49:23 PM4/16/14
to ope...@googlegroups.com
That's awesome.  I could see using something like that to route calls to your home, work or cell phone depending on where you are.


--
You received this message because you are subscribed to the Google Groups "openhab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openhab+u...@googlegroups.com.

Ben Jones

unread,
Apr 16, 2014, 4:15:45 PM4/16/14
to ope...@googlegroups.com
Yep - all sorts of things are running through my head - silencing certain extensions when someone is in bed, ringing longer if presence detected at one end of the house far from a phone, the possibilities are endless!

Karel Goderis

unread,
Apr 17, 2014, 3:54:01 AM4/17/14
to ope...@googlegroups.com
You  would be able to even more funky stuff if we can pass on data from FS to OH. For that to happen we need to adjust the binding to track the APPLICATION event (see my other post) ;-)

K

Ben Jones

unread,
May 27, 2014, 6:27:11 AM5/27/14
to ope...@googlegroups.com
A bit off-topic, but does anyone know how to get the 'blacklist' mod working in Freeswitch?

I can't find it in my install and I keep getting pesky 'Windows Help Desk' calls from the same number.

I could just add it into my dialplan, but I would rather a config based approach so I can add/remove numbers nice and easily.

Any ideas?

dan cunningham

unread,
May 27, 2014, 11:36:49 AM5/27/14
to ope...@googlegroups.com
I have not used it before, if you don't see it in your modules you may need to recompile the tree with that module un-commented out of modules.conf. 


--

LeX Luther

unread,
Jun 18, 2015, 8:50:41 AM6/18/15
to ope...@googlegroups.com
Timoh: Have you done anything more for the AP800 I have one as well I'd like to integrate.

On Sunday, January 26, 2014 at 7:11:19 AM UTC-6, Brian Crosby wrote:

Hey OpenHAB enthusiasts!!!

I am wondering if anyone has thought of a means to have whole house audio in addition to a intercom system.

We can almost do whole house intercom today. Use Sonos binding. But then there is the issue of microphones for audio back to OH.

There are IP enabled ceiling mount speakers that have 2 way audio. But then that duplicates the Sonos setup.

Another option is tablets mounted in each room. Then a combo of Sonos + Astriks/FreeSwitch. And some mod to the bindings and OH.

Thoughts????

Reply all
Reply to author
Forward
0 new messages