Thread: [Asterisk-java-devel] ChannelManager Sync
Brought to you by:
srt
From: Michael Y. <mic...@i9...> - 2009-07-09 16:27:16
|
Hello, We are currently running in a distributed Asterisk environment with Asterisk servers both local and remote to the application that is utilizing Asterisk-Java. We are consolidating events using AstManProxy and everything has worked quite nicely except for one small issue. There are some points when the proxy losses the connection to a remote server and in turn we miss events concerning channel hangups and creation. Basically we want to be able to run a command on our application that will re-sync the Channel Manager state utilizing a call to Status Action. Re-creating the AsteriskServer object is not an option. My plan was to modify the Asterisk-Java code to expose the channel manager and feed the StatsEvents to the Channel Manager to implement any channels that were not created due to missing the newChannel events and at the same time providing a remove channel method that will remove a channel from the channel map in the Channel Manager. My question is can my idea work properly without mucking up the ChannelManager or is there possibly a better way to re initialize the ChannelManager while keeping the existing AsteriskChannel objects in my model valid. I apologize if this is the wrong list to be asking this question. -- Mike Yara i9Technologies 505-246-4224 mic...@i9... |
From: Martin B. S. <ma...@mb...> - 2009-07-10 00:15:25
|
Michael Yara wrote: > Hello, > > We are currently running in a distributed Asterisk environment with > Asterisk servers both local and remote to the application that is > utilizing Asterisk-Java. We are consolidating events using AstManProxy > and everything has worked quite nicely except for one small issue. There > are some points when the proxy losses the connection to a remote server > and in turn we miss events concerning channel hangups and creation. > Basically we want to be able to run a command on our application that > will re-sync the Channel Manager state utilizing a call to Status > Action. Re-creating the AsteriskServer object is not an option. My plan > was to modify the Asterisk-Java code to expose the channel manager and > feed the StatsEvents to the Channel Manager to implement any channels > that were not created due to missing the newChannel events and at the > same time providing a remove channel method that will remove a channel > from the channel map in the Channel Manager. My question is can my idea > work properly without mucking up the ChannelManager or is there possibly > a better way to re initialize the ChannelManager while keeping the > existing AsteriskChannel objects in my model valid. I apologize if this > is the wrong list to be asking this question. > Hi Michael, This is probably a good venue for your question. I think Stefan and I may have even discussed the choice, at some point, of exposing the channel manager directly. However, I think that, at least in my context, I ended up not needing to expose the channel manager to solve my problem -- resyncing channels. I believe, in my case, I simply fed the state events to the asteriskServer by directly calling onNew... with my own event objects. My resync looked something like this: Collection<AsteriskChannel> channels = asteriskServer.getChannels(); for(AsteriskChannel channel : channels) { onNewAsteriskChannel(channel); if(channel.getLinkedChannel() != null) { AsteriskChannel linkedChannel = channel.getLinkedChannel(); PropertyChangeEvent propertyChangeEvent = new PropertyChangeEvent(channel, AsteriskChannel.PROPERTY_LINKED_CHANNEL, null, linkedChannel); propertyChange(propertyChangeEvent); } } Does that work for you? I want to say there's some code floating around in the implementation of the DefaultAsteriskServer that does something similar... Cheers, Martin |
From: Stefan R. <ste...@re...> - 2009-07-10 01:52:05
Attachments:
signature.asc
|
Hi Michael, Asterisk-Java is currently handling a disconnect and later reconnect by simply discarding all active channel objects and recreating them besed on the new state (basically thats what the initialize method does). This is a quite simplistic approach, it would be much better if we had a solution that compared the state before the disconnect and after the reconnect and would just update the active objects (channels, etc.). If you could come up with some clever implementation of a "reiinitialize" method we would be very glad to see it as a contribution :-) =Stefan -- reuter network consulting Neusser Str. 110 50670 Koeln Germany Telefon: +49 221 1305699-0 Telefax: +49 221 1305699-90 E-Mail: ste...@re... Jabber: ste...@re... WWW: http://www.reucon.com Steuernummern 215/5140/1791 USt-IdNr. DE220701760 |
From: Michael Y. <mic...@i9...> - 2009-07-10 15:37:00
|
Thank you guys for the quick response. The issue here is that since we are using the proxy to aggregate the events we don't get any type of notification that the proxy has lost connection with one of the servers. This results in the ChannelManager losing state in its own model which causes the return from getChannels() to be invalid. My goal here is to make a call to StatusAction and utilize the results to re-sync the ChannelManager model and at the same time keeping the still exiting AsteriskChannel objects valid. I believe my idea will work. But if you have any other ideas I'm all ears. Mike Yara i9Technologies 505-246-4224 mic...@i9... Stefan Reuter wrote: > Hi Michael, > > Asterisk-Java is currently handling a disconnect and later reconnect by > simply discarding all active channel objects and recreating them besed > on the new state (basically thats what the initialize method does). > This is a quite simplistic approach, it would be much better if we had a > solution that compared the state before the disconnect and after the > reconnect and would just update the active objects (channels, etc.). > If you could come up with some clever implementation of a > "reiinitialize" method we would be very glad to see it as a contribution :-) > > =Stefan > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > Enter the BlackBerry Developer Challenge > This is your chance to win up to $100,000 in prizes! For a limited time, > vendors submitting new applications to BlackBerry App World(TM) will have > the opportunity to enter the BlackBerry Developer Challenge. See full prize > details at: http://p.sf.net/sfu/Challenge > ------------------------------------------------------------------------ > > _______________________________________________ > Asterisk-java-devel mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-devel > |