Re: ARI ApplicationStarted or how to know that WebSocket connection established?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


On Wed, Sep 24, 2014 at 8:47 PM, Maxim Litnitskiy
<litnimaxster@xxxxxxxxx> wrote:
> Hi dear developers!
> I can see ApplicationReplaced event and it's working:
> client.on_event('ApplicationReplaced', application_replaced)

An ApplicationReplaced event is only fired when a different WebSocket
connection has taken control over an application's event stream.

If you're seeing this event and you aren't expecting it, you are
probably architecting something in your client application

> When I run this code  in the 2-nd thread  I get this message.
> But what is I need to know when Application is started?

The application 'starts' when your WebSocket connection is made.
Asterisk uses the presence of a WebSocket connection to know that
something is able to handle the Stasis application. Without that, it
will simply bounce channels out of your Stasis application.

Because the client initiates the application, there isn't really any
need for an event. Asterisk doesn't make the decision; you do.

> Ordinary situation.
> I have a dialer app using 2 threads:
> 1) DIaler  thread doing originate
> 2) Stasis thread handlng channel events.
> So if I start borth threads simultaneously dialer starts to originate before
> Stasis app is connected.
> Why not implement ApplicationStarted message similar to ApplicationReplaced?
> If ApplicationStarted existed I could use threading.Event() and wait from
> dialer thread for event.set() from ApplicationStarted event from stasis
> thread.

You should not have two WebSocket connections. You should only have a
single WebSocket connection per application.

If you want to multi-thread your client application, you should have a
single thread that reads events from the WebSocket and farms them out
to handlers. Your other application threads can then take whatever
actions they desire.


Matthew Jordan
Digium, Inc. | Engineering Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: &

asterisk-app-dev mailing list

[Index of Archives]     [Asterisk SS7]     [Asterisk Announcements]     [Asterisk Users]     [PJ SIP]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Linux API]

  Powered by Linux