Hi All, I'm completely new to FreeSWITCH, but in a week I managed to achieve quite a bit. It was quite a learning curve to say the least. This is my current setup: - FreeSWITCH 1.0.7 built from tarball. - Developing on Windows XP with VS2008 in C#. - Configured extension 1024 to connect to a managed dll file, which implements IAppPlugin. - Using X-Lite softphone I can connect to FreeSWITCH as user 1001 and dial 1024 and start going through a menu that I built in C#. It successfully retrieves records from an SQL database and so forth. No problems there. My first step was to create a module that gets called whenever a user dials IN bound. They will hear the menu just described. My struggle now is relating to OUT bound calls. What I want is a module that is started as soon as FreeSWITCH is started and begins executing on an endless processing loop in the background. This will continuously monitor a database and if certain conditions occur an outbound call should be queued and then made. If multiple calls need to be made I guess they will be queued and processed one by one. I can handle the queuing part. At this stage I will be testing using extension 1001 as the receiver of the call using my softphone. Question 1: I've been trying to use a class that implements IApiPlugin, but how do I get it to start when FreeSWITCH starts? As I said it should simply be a never ending thread as long as FreeSWITCH is running. I can't find any information regarding how to "Execute" a managed module immediately when FreeSWITCH has started. Question 2: If IApiPlugin can do this, how do I get the session object? Like this? ManagedSession session = new ManagedSession(); session.Originate(???); I can't find any help at all on this. Thanks very much! Oliver Schenk NOTICE - This e-mail and any files transmitted with it are confidential and are only for the use of the person to whom they are addressed. If you are not the intended recipient then you have received this e-mail in error; please advise us immediately if this is the case. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of WestNet Rail.
The correct way to do this is to connect to FreeSWITCH using ESL<http://wiki.freeswitch.org/wiki/ESL> from your application. Have your application that polls your database run outside of freeswitch and when you need to create a new call connect to FS using ESL (there is a .NET lib in \libs\esl\managed\) and create a new call with the Originate command that bridges to an extension or application something like this "originate sofia/gateway/name/8885551234 *1024*" or "originate sofia/gateway/name/8885551234 *&managed(ClassNameToIApiPlugin)*". Yitzchok On Tue, May 3, 2011 at 12:02 AM, Schenk, Oliver <OSchenk@wnr.com.au> wrote:
Hi All,
I’m completely new to FreeSWITCH, but in a week I managed to achieve quite a bit. It was quite a learning curve to say the least. This is my current setup:
- FreeSWITCH 1.0.7 built from tarball.
- Developing on Windows XP with VS2008 in C#.
- Configured extension 1024 to connect to a managed dll file, which implements IAppPlugin.
- Using X-Lite softphone I can connect to FreeSWITCH as user 1001 and dial 1024 and start going through a menu that I built in C#. It successfully retrieves records from an SQL database and so forth. No problems there.
My first step was to create a module that gets called whenever a user dials IN bound. They will hear the menu just described.
My struggle now is relating to OUT bound calls. What I want is a module that is started as soon as FreeSWITCH is started and begins executing on an endless processing loop in the background. This will continuously monitor a database and if certain conditions occur an outbound call should be queued and then made. If multiple calls need to be made I guess they will be queued and processed one by one. I can handle the queuing part.
At this stage I will be testing using extension 1001 as the receiver of the call using my softphone.
Question 1:
I’ve been trying to use a class that implements IApiPlugin, but how do I get it to start when FreeSWITCH starts? As I said it should simply be a never ending thread as long as FreeSWITCH is running. I can’t find any information regarding how to “Execute” a managed module immediately when FreeSWITCH has started.
Question 2:
If IApiPlugin can do this, how do I get the session object? Like this?
ManagedSession session = new ManagedSession();
session.Originate(???);
I can’t find any help at all on this.
Thanks very much!
*Oliver Schenk*
NOTICE - This e-mail and any files transmitted with it are confidential and are only for the use of the person to whom they are addressed. If you are not the intended recipient then you have received this e-mail in error; please advise us immediately if this is the case. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of WestNet Rail.
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Thank you! It worked … at least in the basic sense. I just created a very quick example as follows: ESLconnection eslConnection = new ESLConnection(“127.0.0.1”, “8021”, “ClueCon”); if (eslConnection.Connected() != ESL_SUCCESS) { Console.WriteLine(“Error connecting to FreeSwitch”); return; } eslConnection.SendRecv(“api originate sofia/xxx.xxx.xxx.xxx/1001 &managed(myAppClassName)”); xxx.xxx.xxx.xxx – is my server IP address 1001 – is one of the default sample extensions Thanks! From: Yitzchok [mailto:adminjew@gmail.com] Sent: 03/05/11 13:56 To: FreeSWITCH Users Help Subject: Re: [Freeswitch-users] FreeSWITCH, mod_managed and IApiPlugin The correct way to do this is to connect to FreeSWITCH using ESL <http://wiki.freeswitch.org/wiki/ESL> from your application. Have your application that polls your database run outside of freeswitch and when you need to create a new call connect to FS using ESL (there is a .NET lib in \libs\esl\managed\) and create a new call with the Originate command that bridges to an extension or application something like this "originate sofia/gateway/name/8885551234 1024" or "originate sofia/gateway/name/8885551234 &managed(ClassNameToIApiPlugin)". Yitzchok On Tue, May 3, 2011 at 12:02 AM, Schenk, Oliver <OSchenk@wnr.com.au> wrote: Hi All, I’m completely new to FreeSWITCH, but in a week I managed to achieve quite a bit. It was quite a learning curve to say the least. This is my current setup: - FreeSWITCH 1.0.7 built from tarball. - Developing on Windows XP with VS2008 in C#. - Configured extension 1024 to connect to a managed dll file, which implements IAppPlugin. - Using X-Lite softphone I can connect to FreeSWITCH as user 1001 and dial 1024 and start going through a menu that I built in C#. It successfully retrieves records from an SQL database and so forth. No problems there. My first step was to create a module that gets called whenever a user dials IN bound. They will hear the menu just described. My struggle now is relating to OUT bound calls. What I want is a module that is started as soon as FreeSWITCH is started and begins executing on an endless processing loop in the background. This will continuously monitor a database and if certain conditions occur an outbound call should be queued and then made. If multiple calls need to be made I guess they will be queued and processed one by one. I can handle the queuing part. At this stage I will be testing using extension 1001 as the receiver of the call using my softphone. Question 1: I’ve been trying to use a class that implements IApiPlugin, but how do I get it to start when FreeSWITCH starts? As I said it should simply be a never ending thread as long as FreeSWITCH is running. I can’t find any information regarding how to “Execute” a managed module immediately when FreeSWITCH has started. Question 2: If IApiPlugin can do this, how do I get the session object? Like this? ManagedSession session = new ManagedSession(); session.Originate(???); I can’t find any help at all on this. Thanks very much! Oliver Schenk NOTICE - This e-mail and any files transmitted with it are confidential and are only for the use of the person to whom they are addressed. If you are not the intended recipient then you have received this e-mail in error; please advise us immediately if this is the case. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of WestNet Rail. _______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org NOTICE - This e-mail and any files transmitted with it are confidential and are only for the use of the person to whom they are addressed. If you are not the intended recipient then you have received this e-mail in error; please advise us immediately if this is the case. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of WestNet Rail.
ILoadNotificationPlugin is probably what you want, as it'll get notified that the assembly is being initialized for FS. I think you're right about creating new ManagedSession objects, but I don't recall exactly at this moment. -Michael From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Schenk, Oliver Sent: Monday, May 02, 2011 10:03 PM To: freeswitch-users@lists.freeswitch.org Subject: [Freeswitch-users] FreeSWITCH, mod_managed and IApiPlugin Hi All, I'm completely new to FreeSWITCH, but in a week I managed to achieve quite a bit. It was quite a learning curve to say the least. This is my current setup: - FreeSWITCH 1.0.7 built from tarball. - Developing on Windows XP with VS2008 in C#. - Configured extension 1024 to connect to a managed dll file, which implements IAppPlugin. - Using X-Lite softphone I can connect to FreeSWITCH as user 1001 and dial 1024 and start going through a menu that I built in C#. It successfully retrieves records from an SQL database and so forth. No problems there. My first step was to create a module that gets called whenever a user dials IN bound. They will hear the menu just described. My struggle now is relating to OUT bound calls. What I want is a module that is started as soon as FreeSWITCH is started and begins executing on an endless processing loop in the background. This will continuously monitor a database and if certain conditions occur an outbound call should be queued and then made. If multiple calls need to be made I guess they will be queued and processed one by one. I can handle the queuing part. At this stage I will be testing using extension 1001 as the receiver of the call using my softphone. Question 1: I've been trying to use a class that implements IApiPlugin, but how do I get it to start when FreeSWITCH starts? As I said it should simply be a never ending thread as long as FreeSWITCH is running. I can't find any information regarding how to "Execute" a managed module immediately when FreeSWITCH has started. Question 2: If IApiPlugin can do this, how do I get the session object? Like this? ManagedSession session = new ManagedSession(); session.Originate(???); I can't find any help at all on this. Thanks very much! Oliver Schenk NOTICE - This e-mail and any files transmitted with it are confidential and are only for the use of the person to whom they are addressed. If you are not the intended recipient then you have received this e-mail in error; please advise us immediately if this is the case. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of WestNet Rail.
You can launch a separate thread...using delegate void Listener(); I haven't done outcalling yet, but my guess is to create a new Session, do the bridge...and transfer the session to the extension(could start the bridge here too) that launches the App with the script to play in it's own thread. If you get it going, could you send me some of that code...? Kris public class Loading : FreeSWITCH.ILoadNotificationPlugin { delegate void Listener(); public Loading() { Thread currentThread = Thread.CurrentThread; string threadName = "Thread Loading "; currentThread.Name = threadName; Event loading_event = new Event("CUSTOM", "livematch::maintenance"); loading_event.AddHeader("Action", "LiveMatchLoading"); loading_event.Fire(); Log.WriteLine(LogLevel.Info, "Loading constructor. "); freeswitch.msleep(200); } public bool Load() { Log.WriteLine(LogLevel.Info, "Load() called."); ManagedApplicationBase.LoadSystemSettings(); //from the Database // EventConsumers EventsLivematch = new EventConsumers(10);//<<< INCREASE to add more events ManagedApplicationBase.EventsLivematch.Add("CUSTOM", "livematch::maintenance"); ManagedApplicationBase.EventsLivematch.Add("HEARTBEAT", ""); ManagedApplicationBase.EventsLivematch.Add("CHANNEL_HANGUP", ""); ManagedApplicationBase.EventsLivematch.Add("SHUTDOWN", ""); // ManagedApplicationBase.EventsLivematch.Add("DTMF", ""); new Listener(ManagedApplicationBase.LiveMatchMaintenanceEvents).BeginInvoke(null, null); //subscribe to events // EventConsumers EventsConference = new EventConsumers(4);//<<< INCREASE to add more events ManagedApplicationBase.EventsConference.Add("CUSTOM", "conference::maintenance"); ManagedApplicationBase.EventsConference.Add("CUSTOM", "livematch::maintenance"); //to catch loading event so we can exit loop // ManagedApplicationBase.EventsConference.Add("CUSTOM", "multicast::event"); ManagedApplicationBase.EventsConference.Add("SHUTDOWN", ""); new Listener(ManagedApplicationBase.ConferenceMaintenanceEvents).BeginInvoke(null, null); Log.WriteLine(LogLevel.Info, "Load() ending."); return true; } } public static void ConferenceMaintenanceEvents()//runs only in the new thread { Thread.CurrentThread.Name = "Thread ConferenceMaintenanceEvents"; BaseLog.WriteLine(BaseLogLevel.Info, "Starting ConferenceMaintenanceEvents"); string EventName; string SessionUUID; FreeSWITCH.Native.Api fsApi = new FreeSWITCH.Native.Api(); string DigitPressedByMember; string xml_list = fsApi.Execute("conference", "xml_list"); BaseLog.WriteLine(BaseLogLevel.Info, "Conferences:" + xml_list); while (!ShuttingDown&&!FreeSwitchShutdown && !LoadingNewDLL) { //do DB lookups, outcall here using (Event ev_all = EventsConference.Pop()) { if (ev_all != null) { } } } ----- Original Message ----- From: "Michael Giagnocavo" <mgg@giagnocavo.net> To: "FreeSWITCH Users Help" <freeswitch-users@lists.freeswitch.org> Sent: Sunday, May 08, 2011 9:40 AM Subject: Re: [Freeswitch-users] FreeSWITCH, mod_managed and IApiPlugin ILoadNotificationPlugin is probably what you want, as it'll get notified that the assembly is being initialized for FS. I think you're right about creating new ManagedSession objects, but I don't recall exactly at this moment. -Michael From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Schenk, Oliver Sent: Monday, May 02, 2011 10:03 PM To: freeswitch-users@lists.freeswitch.org Subject: [Freeswitch-users] FreeSWITCH, mod_managed and IApiPlugin Hi All, I'm completely new to FreeSWITCH, but in a week I managed to achieve quite a bit. It was quite a learning curve to say the least. This is my current setup: - FreeSWITCH 1.0.7 built from tarball. - Developing on Windows XP with VS2008 in C#. - Configured extension 1024 to connect to a managed dll file, which implements IAppPlugin. - Using X-Lite softphone I can connect to FreeSWITCH as user 1001 and dial 1024 and start going through a menu that I built in C#. It successfully retrieves records from an SQL database and so forth. No problems there. My first step was to create a module that gets called whenever a user dials IN bound. They will hear the menu just described. My struggle now is relating to OUT bound calls. What I want is a module that is started as soon as FreeSWITCH is started and begins executing on an endless processing loop in the background. This will continuously monitor a database and if certain conditions occur an outbound call should be queued and then made. If multiple calls need to be made I guess they will be queued and processed one by one. I can handle the queuing part. At this stage I will be testing using extension 1001 as the receiver of the call using my softphone. Question 1: I've been trying to use a class that implements IApiPlugin, but how do I get it to start when FreeSWITCH starts? As I said it should simply be a never ending thread as long as FreeSWITCH is running. I can't find any information regarding how to "Execute" a managed module immediately when FreeSWITCH has started. Question 2: If IApiPlugin can do this, how do I get the session object? Like this? ManagedSession session = new ManagedSession(); session.Originate(???); I can't find any help at all on this. Thanks very much! Oliver Schenk NOTICE - This e-mail and any files transmitted with it are confidential and are only for the use of the person to whom they are addressed. If you are not the intended recipient then you have received this e-mail in error; please advise us immediately if this is the case. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of WestNet Rail.
participants (4)
-
Kris
-
Michael Giagnocavo
-
Schenk, Oliver
-
Yitzchok