Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-27 Thread Michael Giagnocavo
users-boun...@lists.freeswitch.org] On Behalf Of Josh Rivers Sent: Sunday, September 27, 2009 9:36 PM To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] Subscribing to events in managed C# / .NET Where does 'somePtr' come from? On Sun, Sep 27, 2009 at 4:06 PM, Michael

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-27 Thread Josh Rivers
t; > > *From:* freeswitch-users-boun...@lists.freeswitch.org [mailto: > freeswitch-users-boun...@lists.freeswitch.org] *On Behalf Of *Josh Rivers > *Sent:* Saturday, September 26, 2009 11:29 PM > > *To:* freeswitch-users@lists.freeswitch.org > *Subject:* Re: [Freeswitch-users]

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-27 Thread Michael Giagnocavo
2009 11:29 PM To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] Subscribing to events in managed C# / .NET The ability to directly create swigtypes...that's huge! I'd love to see some examples of how to use that. I've update my refactoring to include the changes to

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-27 Thread Josh Rivers
t; freeswitch-users-boun...@lists.freeswitch.org] *On Behalf Of *Michael >> Jerris >> *Sent:* Thursday, September 24, 2009 10:26 PM >> >> *To:* freeswitch-users@lists.freeswitch.org >> *Subject:* Re: [Freeswitch-users] Subscribing to events in managed C# / >> .

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-26 Thread Josh Rivers
h.org [mailto: > freeswitch-users-boun...@lists.freeswitch.org] *On Behalf Of *Michael > Jerris > *Sent:* Thursday, September 24, 2009 10:26 PM > > *To:* freeswitch-users@lists.freeswitch.org > *Subject:* Re: [Freeswitch-users] Subscribing to events in managed C# / > .NET &g

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-26 Thread Josh Rivers
eswitch.org] *On Behalf Of *Josh Rivers > *Sent:* Thursday, September 24, 2009 12:32 AM > *To:* freeswitch-users@lists.freeswitch.org > *Subject:* Re: [Freeswitch-users] Subscribing to events in managed C# / > .NET > > > > On Wed, Sep 23, 2009 at 7:31 PM, Michael Giagnocavo > wrote:

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-26 Thread Josh Rivers
Sorry for fading off for a few days. Having too much fun doing stuff! A few responses: On Thu, Sep 24, 2009 at 1:01 AM, Michael Giagnocavo wrote: > A few questions I have: > > Testability – is this even remotely practical? > I've seen three areas of testability: 1) Interop 2) Module Extensibilit

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-25 Thread Michael Giagnocavo
half Of Michael Jerris Sent: Thursday, September 24, 2009 10:26 PM To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] Subscribing to events in managed C# / .NET There are a few other things I can think would be nice additions to mod_managed. Maybe an event handler that doe

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-24 Thread Michael Jerris
! -Michael From: freeswitch-users-boun...@lists.freeswitch.org [mailto:freeswitch-users-boun...@lists.freeswitch.org] On Behalf Of Josh Rivers Sent: Thursday, September 24, 2009 12:32 AM To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] Subscribing to events in managed C

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-24 Thread Michael Giagnocavo
lto:freeswitch-users-boun...@lists.freeswitch.org] On Behalf Of Josh Rivers Sent: Thursday, September 24, 2009 12:32 AM To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] Subscribing to events in managed C# / .NET On Wed, Sep 23, 2009 at 7:31 PM, Michael Giagnocavo m

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-23 Thread Josh Rivers
On Wed, Sep 23, 2009 at 7:31 PM, Michael Giagnocavo wrote: > Right off the bat: there can be tons of cleanup and refactoring, no doubt > about that. Much of the current code is to satisfy my needs in production, > which it does very well. > The current base doesn't have anything wrong with it for

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-23 Thread Michael Giagnocavo
boun...@lists.freeswitch.org] On Behalf Of Josh Rivers Sent: Wednesday, September 23, 2009 5:00 PM To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] Subscribing to events in managed C# / .NET I've been having the same idea, except completely different. I'd probably start

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-23 Thread Josh Rivers
rol loading, >> we’ll probably reflect on the individual plugins looking for attributes or >> perhaps some sort of static load function. >> >> >> >> How’s that sound? >> >> >> >> >> >> *From:* freeswitch-users-boun...@lists.fr

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-11 Thread Raffaele P. Guidi
t does something important, like > billing or so on. That thread fails – do you really want it to go on? > > > > Anyways, the solution is simple enough, handle your exceptions J. Every > plugin can decide what it wants to do here. > > > > -Michael > > > > *

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-10 Thread Michael Giagnocavo
attributes or perhaps some sort of static load function. How's that sound? From: freeswitch-users-boun...@lists.freeswitch.org [mailto:freeswitch-users-boun...@lists.freeswitch.org] On Behalf Of Josh Rivers Sent: Thursday, September 10, 2009 12:48 PM To: freeswitch-users@lists.freeswitch.org

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-10 Thread Josh Rivers
e property getter and that’ll do a null check. If that > isn’t happening, that’d be an interesting optimization somewhere along the > line. > > > > -Michael > > > > > > *From:* freeswitch-users-boun...@lists.freeswitch.org [mailto: > freeswitch-users-boun...@lists

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-10 Thread Phillip Jones
Surely this is because you are calling ev.serialized_string and ev is null if there is not event waiting? i.e. con.pop(0); returns null if no event is waiting. Therefore if(ev != null) Log.WriteLine(LogLevel.Notice, "Event: " + ev.serialized_string); would work, alternatively calling

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-10 Thread Michael Giagnocavo
: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] Subscribing to events in managed C# / .NET Thanks Michael, I was seeing some strange behavior in a static compiled dll versus dynamically loaded and compiled scripts. This code when used in a dll was blowing up when a thread was

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-10 Thread Jeff Lenk
-users-boun...@lists.freeswitch.org > [mailto:freeswitch-users-boun...@lists.freeswitch.org] On Behalf Of Jeff > Lenk > Sent: Wednesday, September 09, 2009 1:57 PM > To: freeswitch-users@lists.freeswitch.org > Subject: Re: [Freeswitch-users] Subscribing to events in managed C# / .NET &g

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-09 Thread Michael Giagnocavo
ers Sent: Wednesday, September 09, 2009 6:39 PM To: freeswitch-users@lists.freeswitch.org<mailto:freeswitch-users@lists.freeswitch.org> Subject: Re: [Freeswitch-users] Subscribing to events in managed C# / .NET I have a new thought on the crashes...I'm able to crash FreeSWITCH any ti

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-09 Thread Josh Rivers
eeswitch-users-boun...@lists.freeswitch.org [mailto: > freeswitch-users-boun...@lists.freeswitch.org] *On Behalf Of *Josh Rivers > *Sent:* Wednesday, September 09, 2009 3:01 PM > > > *To:* freeswitch-users@lists.freeswitch.org > > *Subject:* Re: [Frees

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-09 Thread Michael Giagnocavo
hael From: freeswitch-users-boun...@lists.freeswitch.org [mailto:freeswitch-users-boun...@lists.freeswitch.org] On Behalf Of Josh Rivers Sent: Wednesday, September 09, 2009 6:39 PM To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] Subscribing to events in managed C# / .NET I have a n

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-09 Thread Josh Rivers
-Michael > > > > > > *From:* freeswitch-users-boun...@lists.freeswitch.org [mailto: > freeswitch-users-boun...@lists.freeswitch.org] *On Behalf Of *Josh Rivers > *Sent:* Wednesday, September 09, 2009 3:01 PM > > *To:* freeswitch-users@lists.freeswitch.org > *Subject:

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-09 Thread Michael Giagnocavo
itch-users] Subscribing to events in managed C# / .NET A new discovery: public bool Load() { ThreadPool.QueueUserWorkItem((o) => { Log.WriteLine(LogLevel.Notice, "Thread Starting. "); EventConsumer con = new EventCon

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-09 Thread Michael Giagnocavo
ginal Message- From: freeswitch-users-boun...@lists.freeswitch.org [mailto:freeswitch-users-boun...@lists.freeswitch.org] On Behalf Of Jeff Lenk Sent: Wednesday, September 09, 2009 1:57 PM To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] Subscribing to events in mana

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-09 Thread Josh Rivers
It does from a fresh start of FreeSWITCH. I've noticed, although not really confirmed, a race condition between the unload and reload of managed code. It seems that threads started in the newly submodule are terminated along with the threads for the old, unloading submodule. Is that what you are se

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-09 Thread Jeff Lenk
Yeah I noticed that but the thread was still terminating after a few seconds anyway for me. Does it stay running for you? Josh Rivers-2 wrote: > > A new discovery:public bool Load() > { > ThreadPool.QueueUserWorkItem((o) => > { > Log.Write

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-09 Thread Josh Rivers
A new discovery:public bool Load() { ThreadPool.QueueUserWorkItem((o) => { Log.WriteLine(LogLevel.Notice, "Thread Starting. "); EventConsumer con = new EventConsumer("all", ""); while (true) {

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-09 Thread Josh Rivers
gt;> >>> >>> Thanks, >>> >>> Michael >>> >>> >>> *From:* freeswitch-users-boun...@lists.freeswitch.org [mailto: >>> freeswitch-users-boun...@lists.freeswitch.org] *On Behalf Of *Josh >>> Rivers >>> *Sent:* Tues

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-09 Thread Jeff Lenk
I think the problem here is that the loader only keeps this method in scope until completion then it drops the remoted connection. Therefore you should not use threads in this method. Michael please correct me if I am wrong here. As an example of the failure simply just put a Sleep(1) call in

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-08 Thread Mathieu Rene
n pop 0 or not. From: freeswitch-users-boun...@lists.freeswitch.org [mailto:freeswitch-users-boun...@lists.freeswitch.org ] On Behalf Of Phillip Jones Sent: Tuesday, September 08, 2009 3:50 PM To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] Subscribing to events in m

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-08 Thread Josh Rivers
>> Thanks, >> >> Michael >> >> >> *From:* freeswitch-users-boun...@lists.freeswitch.org [mailto: >> freeswitch-users-boun...@lists.freeswitch.org] *On Behalf Of *Josh Rivers >> *Sent:* Tuesday, September 08, 2009 12:22 AM >> *To:* freeswitch-users@li

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-08 Thread Josh Rivers
eeswitch-users-boun...@lists.freeswitch.org [mailto: > freeswitch-users-boun...@lists.freeswitch.org] *On Behalf Of *Phillip > Jones > *Sent:* Tuesday, September 08, 2009 3:50 PM > > *To:* freeswitch-users@lists.freeswitch.org > *Subject:* Re: [Freeswitch-users] Subscribing to

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-08 Thread Josh Rivers
You are probably right, but commenting out the msleep doesn't prevent the crash. -Josh On Tue, Sep 8, 2009 at 11:12 AM, Phillip Jones wrote: > What is: > > freeswitch.msleep(100); > > Why aren't you using Thread.Sleep? > > > On Tue, Sep 8, 2009 at 2:21 AM, Josh Rivers wrote: > >> Thanks for the

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-08 Thread Mathieu Rene
-boun...@lists.freeswitch.org [mailto:freeswitch-users-boun...@lists.freeswitch.org ] On Behalf Of Josh Rivers Sent: Tuesday, September 08, 2009 12:22 AM To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] Subscribing to events in managed C# / .NET Thanks for the response! I have tried putt

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-08 Thread Josh Rivers
> > Thanks, > > Michael > > > > *From:* freeswitch-users-boun...@lists.freeswitch.org [mailto: > freeswitch-users-boun...@lists.freeswitch.org] *On Behalf Of *Josh Rivers > *Sent:* Tuesday, September 08, 2009 12:22 AM > *To:* freeswitch-users@lists.freeswitch.org > *Subject

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-08 Thread Michael Giagnocavo
esday, September 08, 2009 3:50 PM To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] Subscribing to events in managed C# / .NET I build this out. This seems to work fine: ThreadPool.QueueUserWorkItem((o) => { Log.WriteLine(LogLevel.Notice,

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-08 Thread Raffaele P. Guidi
nocavo > wrote: > > That’s what his sample does, but he says it crashes. > > > > *From:* freeswitch-users-boun...@lists.freeswitch.org [mailto: > freeswitch-users-boun...@lists.freeswitch.org] *On Behalf Of *Raffaele P. > Guidi > *Sent:* Tuesday, September 08, 2009 10:08 A

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-08 Thread Michael Giagnocavo
freeswitch.org] On Behalf Of Raffaele P. Guidi Sent: Tuesday, September 08, 2009 12:22 PM To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] Subscribing to events in managed C# / .NET Well, I can't see any delegate in josh sample, just a ThreadPool.QueueUserWorkItem. Here

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-08 Thread Raffaele P. Guidi
Yeah, probably just using con.pop(1) - that waits for an event to be caught, instead than con.pop(0), thus avoiding "sleeps" would do the trick On Tue, Sep 8, 2009 at 20:12, Phillip Jones wrote: > What is: > > freeswitch.msleep(100); > > Why aren't you using Thread.Sleep? > > > On Tue, Sep 8, 20

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-08 Thread Raffaele P. Guidi
oun...@lists.freeswitch.org [mailto: > freeswitch-users-boun...@lists.freeswitch.org] *On Behalf Of *Raffaele P. > Guidi > *Sent:* Tuesday, September 08, 2009 10:08 AM > > *To:* freeswitch-users@lists.freeswitch.org > *Subject:* Re: [Freeswitch-users] Subscribing to events in managed C#

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-08 Thread Phillip Jones
What is: freeswitch.msleep(100); Why aren't you using Thread.Sleep? On Tue, Sep 8, 2009 at 2:21 AM, Josh Rivers wrote: > Thanks for the response! > I have tried putting a long-running loop here, but then it blocks anything > else managed from happening: > >public class TestLoop : ILoadNoti

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-08 Thread Michael Giagnocavo
t: Re: [Freeswitch-users] Subscribing to events in managed C# / .NET Hi, you just have to use delegates to asynchronously call the function containing the loop and return back the control to the calling thread. Here an example (don't have my code at hand, hope it doesn't contain typos). Regar

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-08 Thread Raffaele P. Guidi
Hi, you just have to use delegates to asynchronously call the function containing the loop and return back the control to the calling thread. Here an example (don't have my code at hand, hope it doesn't contain typos). Regards, Raffaele public class TestLoop : ILoadNotificationPlugin {

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-08 Thread Michael Giagnocavo
:22 AM To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] Subscribing to events in managed C# / .NET Thanks for the response! I have tried putting a long-running loop here, but then it blocks anything else managed from happening: public class TestLoop

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-07 Thread Josh Rivers
Thanks for the response! I have tried putting a long-running loop here, but then it blocks anything else managed from happening: public class TestLoop : ILoadNotificationPlugin { public bool Load() { EventConsumer con = new EventConsumer("all", ""); w

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-07 Thread Raffaele P. Guidi
Yes! public class LoadDemo : ILoadNotificationPlugin { public bool Load() { Log.WriteLine(LogLevel.Notice, "LoadDemo running."); return true; } } this example is from Michael Giagnocavo's Demo.csx which you can find into the mod_managed svn. And let me add that works like

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-07 Thread Josh Rivers
Is there a way to start this when FreeSWITCH starts? The lua and perl modules have a 'startup-script' configuration preference. Is there something similar in mod_managed? Or is there a way to have an api command executed at a startup? Exactly what I was after - thank you! On Thu, Sep 3, 2009 at

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-03 Thread Phillip Jones
Exactly what I was after - thank you! On Thu, Sep 3, 2009 at 1:54 PM, Jeff Lenk wrote: > > try something like this > > EventConsumer con = new EventConsumer("all", ""); > Event ev = con.pop(0); > > see lua sample - > http://wiki.freeswitch.org/wiki/Lua#freeswitch.EventConsumer > > > Phillip Jone

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-03 Thread Jeff Lenk
try something like this EventConsumer con = new EventConsumer("all", ""); Event ev = con.pop(0); see lua sample - http://wiki.freeswitch.org/wiki/Lua#freeswitch.EventConsumer Phillip Jones-2 wrote: > > Hi there, > > mod_managed exposes EventReceivedFunction such that: > > Session.EventRece

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-03 Thread Phillip Jones
itch-users@lists.freeswitch.org > *Subject:* [Freeswitch-users] Subscribing to events in managed C# / .NET > > Hi there, > > mod_managed exposes EventReceivedFunction such that: > > Session.EventReceivedFunction = (e) => > { >Log.WriteLine(LogLevel.Alert, &q

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-03 Thread Mathieu Rene
Sent: Thursday, September 03, 2009 8:27 AM To: freeswitch-users@lists.freeswitch.org Subject: [Freeswitch-users] Subscribing to events in managed C# / .NET Hi there, mod_managed exposes EventReceivedFunction such that: Session.EventReceivedFunction = (e) => { Log.WriteLine(LogLevel.Al

Re: [Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-03 Thread Michael Giagnocavo
-boun...@lists.freeswitch.org [mailto:freeswitch-users-boun...@lists.freeswitch.org] On Behalf Of Phillip Jones Sent: Thursday, September 03, 2009 8:27 AM To: freeswitch-users@lists.freeswitch.org Subject: [Freeswitch-users] Subscribing to events in managed C# / .NET Hi there, mod_managed ex

[Freeswitch-users] Subscribing to events in managed C# / .NET

2009-09-03 Thread Phillip Jones
Hi there, mod_managed exposes EventReceivedFunction such that: Session.EventReceivedFunction = (e) => { Log.WriteLine(LogLevel.Alert, "Received Event {0}", e.ToString()); return ""; }; should trap all events to which i subscribe. But how do I subscribe to events? What is the .