Installing Asterisk Binding for OH2

I have an OH2.3 installation that I’d like to add the Asterisk binding to. However, I can’t figure out how… It’s not available in PaperUI, and the only download link I’ve found was in this topic, and Cloudbees is no longer working:

Can someone point me to a new download or another way to install this binding?

Thanks,

Danny

I can’t say if this is still compatible (though it seems to have been updated December 2018 so it should be), but I see you can find a snapshot version here:
https://openhab.jfrog.io/openhab/libs-pullrequest-local/org/openhab/binding/org.openhab.binding.asterisk/1.14.0-SNAPSHOT/

You can drop the jar file in your addons directory to install the binding.

Its important to note that snapshot builds might not be bug-free. Its just the only version I could find.

I can’t say why it isn’t included in Paper UI though. Perhaps because it is originally a OH1 binding? Perhaps someone else knows why.

If this was a 1.x binding that was part of the official distribution of OH 1.x, it probably means that no one has ever filed an issue to inform the maintainers that it indeed does work on OH 2.x.They don’t get added to the list that appears in PaperUI until someone tests it out and confirms it works.

So, @shorin, if it works for you please file an issue letting the devs know it works.

It’s depending on the Asterisk version. The Binding itself is (sort of) working, but as far as i know it’s stuck on asterisk 11.

1 Like

@SkyyStorm, thanks for the link.

Whether it works, that’s a whole different story… I’m running Asterisk 13, so I worried it wouldn’t work based on Udo’s comment…

At this point, I can’t get them to connect (timeout error). I don’t know if I have something configured incorrectly (I don’t think so as I’m using the same credentials that FreePBX uses to connect to the AMI), or if this binding just doesn’t work with Asterisk 13… Here’s what I’m seeing in the log file when I start OH:

2019-02-09 22:54:49.618 [ERROR] [ng.asterisk.internal.AsteriskBinding] - Could not connect to manager interface on host 192.168.xxx.xxx: {}
java.net.ConnectException: Connection timed out (Connection timed out)
	at java.net.PlainSocketImpl.socketConnect(Native Method) ~[?:?]
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) [?:?]
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) [?:?]
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) [?:?]
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) [?:?]
	at java.net.Socket.connect(Socket.java:589) [?:?]
	at org.asteriskjava.util.internal.SocketConnectionFacadeImpl.<init>(SocketConnectionFacadeImpl.java:86) [246:org.openhab.binding.asterisk:1.14.0.201902062055]
	at org.asteriskjava.util.internal.SocketConnectionFacadeImpl.<init>(SocketConnectionFacadeImpl.java:59) [246:org.openhab.binding.asterisk:1.14.0.201902062055]
	at org.asteriskjava.manager.internal.ManagerConnectionImpl.createSocket(ManagerConnectionImpl.java:777) [246:org.openhab.binding.asterisk:1.14.0.201902062055]
	at org.asteriskjava.manager.internal.ManagerConnectionImpl.connect(ManagerConnectionImpl.java:756) [246:org.openhab.binding.asterisk:1.14.0.201902062055]
	at org.asteriskjava.manager.internal.ManagerConnectionImpl.doLogin(ManagerConnectionImpl.java:498) [246:org.openhab.binding.asterisk:1.14.0.201902062055]
	at org.asteriskjava.manager.internal.ManagerConnectionImpl.login(ManagerConnectionImpl.java:448) [246:org.openhab.binding.asterisk:1.14.0.201902062055]
	at org.asteriskjava.manager.internal.ManagerConnectionImpl.login(ManagerConnectionImpl.java:433) [246:org.openhab.binding.asterisk:1.14.0.201902062055]
	at org.asteriskjava.manager.DefaultManagerConnection.login(DefaultManagerConnection.java:294) [246:org.openhab.binding.asterisk:1.14.0.201902062055]
	at org.openhab.binding.asterisk.internal.AsteriskBinding.connect(AsteriskBinding.java:109) [246:org.openhab.binding.asterisk:1.14.0.201902062055]
	at org.openhab.binding.asterisk.internal.AsteriskBinding.updated(AsteriskBinding.java:85) [246:org.openhab.binding.asterisk:1.14.0.201902062055]
	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:189) [8:org.apache.felix.configadmin:1.8.16]
	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152) [8:org.apache.felix.configadmin:1.8.16]
	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85) [8:org.apache.felix.configadmin:1.8.16]
	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.provide(ConfigurationManager.java:1479) [8:org.apache.felix.configadmin:1.8.16]
	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.run(ConfigurationManager.java:1435) [8:org.apache.felix.configadmin:1.8.16]
	at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141) [8:org.apache.felix.configadmin:1.8.16]
	at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109) [8:org.apache.felix.configadmin:1.8.16]
	at java.lang.Thread.run(Thread.java:748) [?:?]
2019-02-09 22:54:49.671 [ERROR] [ng.asterisk.internal.AsteriskBinding] - Registering for status update threw an exception: {}
java.lang.IllegalStateException: Actions may only be sent when in state CONNECTED, but connection is in state DISCONNECTED
	at org.asteriskjava.manager.internal.ManagerConnectionImpl.sendAction(ManagerConnectionImpl.java:903) [246:org.openhab.binding.asterisk:1.14.0.201902062055]
	at org.asteriskjava.manager.internal.ManagerConnectionImpl.sendAction(ManagerConnectionImpl.java:846) [246:org.openhab.binding.asterisk:1.14.0.201902062055]
	at org.asteriskjava.manager.internal.ManagerConnectionImpl.sendAction(ManagerConnectionImpl.java:829) [246:org.openhab.binding.asterisk:1.14.0.201902062055]
	at org.asteriskjava.manager.DefaultManagerConnection.sendAction(DefaultManagerConnection.java:311) [246:org.openhab.binding.asterisk:1.14.0.201902062055]
	at org.openhab.binding.asterisk.internal.AsteriskBinding.connect(AsteriskBinding.java:119) [246:org.openhab.binding.asterisk:1.14.0.201902062055]
	at org.openhab.binding.asterisk.internal.AsteriskBinding.updated(AsteriskBinding.java:85) [246:org.openhab.binding.asterisk:1.14.0.201902062055]
	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:189) [8:org.apache.felix.configadmin:1.8.16]
	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152) [8:org.apache.felix.configadmin:1.8.16]
	at org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85) [8:org.apache.felix.configadmin:1.8.16]
	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.provide(ConfigurationManager.java:1479) [8:org.apache.felix.configadmin:1.8.16]
	at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.run(ConfigurationManager.java:1435) [8:org.apache.felix.configadmin:1.8.16]
	at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141) [8:org.apache.felix.configadmin:1.8.16]
	at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109) [8:org.apache.felix.configadmin:1.8.16]
	at java.lang.Thread.run(Thread.java:748) [?:?]

I’m going to keep playing with it and see if I can figure out my problems. If anyone has any other suggestions, I’m all ears…

Thanks,

Danny

I’m running Asterisk 13.6 here and at least I get a connection.
openHAB version is 2.5.0 Build #1502
Tried the last successful build https://ci.openhab.org/job/openHAB1-Addons/lastSuccessfulBuild/artifact/bundles/binding/org.openhab.binding.asterisk/target/

2019-02-10 10:53:28.957 [WARN ] [ng.asterisk.internal.AsteriskBinding] - Cannot connect to Asterisk manager interface because of missing parameters (host=null, username=null)
2019-02-10 10:54:17.795 [WARN ] [nager.internal.ManagerConnectionImpl] - Unsupported protocol version 'Asterisk Call Manager/2.8.0'. Use at your own risk.
2019-02-10 10:57:27.713 [WARN ] [va.manager.internal.EventBuilderImpl] - Unable to set property 'linkedid' to 'asterisk.udo.lokal-1549792647.1814' on org.asteriskjava.manager.event.NewChannelEvent: no setter. Please report at https://github.com/asterisk-java/asterisk-java/issues

First warning is because no credentials set yet.
Second warning is because of Asterisk 13.6
Third warning appears very frequently, so you will have to set loglevel for org.openhab.binding.asterisk to ERROR to prevent those warnings.

@Udo_Hartmann I used that version and installed it instead. I think they’re the same, but not sure and I wanted to use a version thats known to be working, at least in part.

I found a problem in my manager.conf file on asterisk. It had a bind address of 127.0.0.1. Changed that to 0.0.0.0 and OH2 was able to connect. And you’re right about warning messages - I got a ton. I changed the logging to Error like you suggested. For a 2 minute test, the binding appears to be working - I can see when extensions are picking up, etc. so it’s a start.

Since there have been snapshot builds recently, does this mean someone is actively maintaining this binding, or have these changes just been part of other changes to OH? Curious if there may be improvements coming in the future, like a switch to a version 2 configuration… If not, I may have to make some “free time” and do a little tinkering. I haven’t done any Java development for a few years, but it may be time to so some again…

Thanks all.

Danny

No, the binding is just rebuilt because some OH1 binding was rebuilt. I’m pretty sure that the only changes to the source code which were made where about changed licence, changed copyright or some misspelled words…

I’m not aware of an active developer for this addon, as it’s stuck on an old version of asterisk (yesterday I’ve started a new setup with asterisk 16.1.1 LTS)

Is the asterisk binding working with Asterisk 16?

Well, after struggling, I’ve done another installation with freePBX (but this has its downsides, too, so asterisk 16 is not forgotten).

Current version of freePBX is asterisk15 based (15.7.2 for now) and the binding does work (sort of…) with lots of warnings.
I managed to install asterisk2mqtt, this is far better…

Is this asterisk2mqtt only one way, asterisk sending messages to oh or is this also two way - sending commands to asterisk too?

It’s one-way, a simple agi python script to send caller information to mqtt. But the asterisk binding is also one-way. The solution to change call routing is working without any asterisk binding, it’s a http request to the openHAB REST API through an AGI script.

A new asterisk binding would be very welcome :slight_smile: but as long as there isn’t a programmer…

Hello,

i just wanted to ask, if somebody uses the asterisk binding?
I do have a FreePBX installation and OH2 running, but unfortunately OH can’t connect to the AMI (Asterisk Manager)
I have tried several hints, which i found online, but without any success.

Is there a actuall binding for the latest PBX version?
many thanks in advance
wu3mi

EDIT: the connection works for now, but i get many warnings with
“Unable to set property ‘linkedid’ to '15771142” … and so on.

If I may, some questions for you Udo…

I’m new to OH2. I had 2.4 installed on my Beagle Bone Black (Debian 9.9) and was able to upgrade to 2.5 recently. Other than some minor issues and my learning curve, that was clean. 2.5 seem to run better on the BBB which might be a bit under powered for OH2 but so far so good.

I used to see the Asterisk add-on in 2.4 but now even with legacy enabled in “Configuration > System” on PaperUI, Asterisk no longer shows up… I’ve read this and other threads and installing manually (i.e. dropping org.openhab.binding.asterisk-1.14.0-SNAPSHOT.jar in /usr/share/openhab2/addons/) does NOT work because there are dependencies missing. Doing that seems to be discouraged anyway.

The question is, should this work from PaperUI (or HABmin… it doesn’t show there either and I can see other OH1 extensions)? Do I need to do something special to force it to show up?

Another question… it seems like there are people continuing to ask about this but in addition to just saying “me too” here, I wanted to know if it was appropriate to put a bounty on this specific feature? I’m not a java programmer but it seems like this binding is mostly working and perhaps it just needs some minor work to support newer Asterisk versions (I’m actually only running 11 for my current PBX but I definitely need 15 elsewhere) and the new 2.5 build / packaging.

I would contact the developer directly to see if they would take me up on this but I don’t know who that is if it is no longer Thomas Eichstaedt-Engelen.

Any help and guidance on these issues would be most welcome.

Sorry for delay, was absent… :wink:

I’m pretty sure that asterisk did never emerge in Paper UI, as it never was marked as compatible to OH2. Please be aware that even for OH1 bindings one has to do some steps to make it available in Paper UI.
The legacy Switch does only enable OH1 bindings, which are replaced by an OH2 binding.

In fact, the Binding has to be recreated. As the original developer is no longer here, I doubt that he/she will do this job.
There is much more functionality needed than just a “display active calls” (e.g. send commands to asterisk, including a gracefull restart, but also outgoing calls with audio from openHAB) but it would be a start…

Absent… LOL, I get it, I wish I could hibernate from November 1st to January 1st!

I was pretty sure I saw asterisk in PaperUI with version 2.4. I had not been on 2.5 yet or using Habmin until 2.5. If it wasn’t there the only other place I could have seen it was in add-ons listing at some point. There is a lot to take and I am new. Wherever I say it, I remember being execited about it because one of things I need to do is be able to integrate a SIP door intercom (Akuvox R20A) into my environment. Its a moot point now and that is unfortunate. Hopefully someone will pick it up, maybe a core dev. I’d rather have a successful bounty on this rather try to hack a round it or use MQTT.

I agree, the functionality needed is that of what I saw posted. The binding needs to be able to detect DTMF tones since thta is the typical way a human interfaces with a system via phone (i.e. open a door relay or tell a smart lock to open). At this point, I think what I’m going to have to do write something that runs on the asterisk server and have that use the REST API to POST a command to OH.

It definely would be cool to have OH handle SIP calls directly (i.e. OH could be an extension) and DTMF sending/receiving. When trying to build a security solution, OpenHAB, Zoneminder and Asterisk would be the goto team.

Then take a look at asterisk2mqtt, this is a nice and slim solution.

For direct sip afaik you could use sipcmd to send (and maybe also receive? tldr; ) to do it.

My turn to apologize for the delay…

For the sake of completeness, when you refer to asterisk2mqtt do you mean this?

Not sure about that, I have to take a look when I’m back at home…

You even dont need MQTT Gateway, i use curl through dialplan.
Like:

exten => _XXX,n,system(curl -X POST --header “Content-Type: text/plain” --header “Accept: application/json” -d “RINGING” “http://192.168.0.102:8080/rest/items/CallState1”)

exten => _XXX,n,Goto(s-${DIALSTATUS},1)

exten => s-ANSWER,1,system(curl -X POST --header “Content-Type: text/plain” --header “Accept: application/json” -d “OFFHOOK” “http://192.168.0.102:8080/rest/items/CallState1”)

1 Like