How to write Stasis application in Java

Hi everybody,

I am new to Asterisk,ARI and Freepbx. I writing a solution for call center, where I developed a Restful webservice in Java using ari4java, the solution basically does the following

  1. On one hand Dialer talks to CRM exposing some of its, Dialer, restful service
  2. On the other hand Dialer as a ARI client talks to Asterisk using ARI. I have the followed standard rules to become a ARI client as given in wiki and examples

Can I do the above mentioned activities ? Is it normal ?

Now I want to snoop a channel, for that I have to write a Stasis application, right ? If yes, then

Can I write this Stasis application in Java ? Can you provide me some sample java source code for a Stasis application ? I am getting a lot of examples in Python and PHP but nothing in Java.

Thanks in advance.

Utpal Banerjee

You may want to look at https://github.com/l3nz/ari4java for native Java bindings and a couple of examples.

I had downloaded the source and jars few months ago. But I could not understand which sample should I take to make my Stasis application. I have seen lots of documents in python and php or node js but in java can you please share me some documentation of how to write Stasis application in Java.

Unfortunately I got this email after 4 months, I hope I will get a response quickly this time. I am heavily in the programming of Asterisk using Java which I have explained in previous mail.

Thanks
Utpal

I imagine you will have to work it out from first principles, as a far smaller number of people use Java with Asterisk than use PHP.

Thanks for the quick reply. But it did not solve my problem. I am little bit oldish guy, working in software industry for last 29 years. Moreover I am programmer. I still believe that if you want to do serious programming do it in a language and not in script (I may be wrong), but that’s my belief. So I am writing my services in Java using Asterisk web services(Java version). If anyone from that smaller section can help me, that will be a great thing.

Thanks in advance

Utpal

The thing is that ARI libraries are just that - bindings. How ARI works, and how to do stuff in ARI, is a totally different matter - but the good news is that your PHP example will basically work in Python, because it’s a sequence of calls you send to Asterisk, and those stay the same no matter what.
So when you get this to work: https://github.com/l3nz/ari4java/blob/master/examples/helloworld/HelloAriWorld.java most of the things are just ARI, not the library anymore.

Thanks again for the quick reply. So I will take it as an Stasis application, which when called will display the all the channels which are currently active. right.

Thanks
Utpal