-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
I've just tried new mod_managed under Win32 and I get a weird behavior.
I try the example below:
public class DemoScript : IApiPlugin
{
public void Execute(ApiContext context)
{
context.Stream.Write(string.Format("DemoScripts executed with
args '{0}' and event type {1}.",
context.Arguments, context.Event == null ? "<none>" :
context.Event.GetEventType()));
}
public void ExecuteBackground(ApiBackgroundContext context)
{
Log.WriteLine(LogLevel.Notice, "DemoScripts on a background
thread #({0}), with args '{1}'.",
System.Threading.Thread.CurrentThread.ManagedThreadId,
context.Arguments);
}
}
It's just like the ApiDemo from Demo.cs
So When I copy DemoScript.csx to managed dir the console log is:
"
freeswi...@zwierko-laptop> Loading
c:\Users\Zwierko\Projects\fs\svn\Debug\mod\managed\DemoScripts.csx from
domain DemoScripts.csx_3
2009-07-28 20:57:16.710000 [INFO] switch_cpp.cpp:1130 Compiling
c:\Users\Zwierko\Projects\fs\svn\Debug\mod\managed\DemoScripts.csx
2009-07-28 20:57:16.970000 [ERR] switch_cpp.cpp:1130 There were 1 errors
compiling
c:\Users\Zwierko\Projects\fs\svn\Debug\mod\managed\DemoScripts.csx.
2009-07-28 20:57:16.970000 [ERR] switch_cpp.cpp:1130 CS5001: Program
'c:\Users\Zwierko\AppData\Local\Temp\fc8jnlir.exe' does not contain a
static 'Main' method
suitable for an entry point
"
Adding
"
public static void Main()
{
}
"
solves the issue. Is this how it's supposed to work?
Another strange thing is that when I compile this class to DLL (release)
it does not work at all...
freeswi...@zwierko-laptop> Loading
c:\Users\Zwierko\Projects\fs\svn\Debug\mod\managed\FSScripts.dll from
domain FSScripts.dll_5
freeswi...@zwierko-laptop>
freeswi...@zwierko-laptop> managed DemoScript 111
API CALL [managed(DemoScript 111)] output:
2009-07-28 21:13:03.542000 [ERR] switch_cpp.cpp:1130 API plugin
DemoScript not found.
2009-07-28 21:13:03.542000 [ERR] mod_managed.cpp:393 Execute failed for
DemoScript 111 (unknown module or exception).
And another issue with scripts. I use script code as example:
"
public class ScriptDemo
{
static void Main()
{
switch (FreeSWITCH.Script.ContextType)
{
case ScriptContextType.Api:
{
var ctx = FreeSWITCH.Script.GetApiContext();
ctx.Stream.Write("Script executing as API with args:
" + ctx.Arguments);
break;
}
case ScriptContextType.ApiBackground:
{
var ctx = FreeSWITCH.Script.GetApiBackgroundContext();
Log.WriteLine(LogLevel.Notice, "Executing as
APIBackground with args: " + ctx.Arguments);
break;
}
case ScriptContextType.App:
{
var ctx = FreeSWITCH.Script.GetAppContext();
Log.WriteLine(LogLevel.Notice, "Executing as App
with args: " + ctx.Arguments);
break;
}
}
}
}
"
console log is as follows:
freeswi...@zwierko-laptop> Loading
c:\Users\Zwierko\Projects\fs\svn\Debug\mod\managed\Script.csx from
domain Script.csx_8
2009-07-28 21:19:36.289000 [INFO] switch_cpp.cpp:1130 Compiling
c:\Users\Zwierko\Projects\fs\svn\Debug\mod\managed\Script.csx
2009-07-28 21:19:36.438000 [INFO] switch_cpp.cpp:1130 File
c:\Users\Zwierko\Projects\fs\svn\Debug\mod\managed\Script.csx compiled
successfully.
2009-07-28 21:19:36.451000 [ERR] switch_cpp.cpp:1130 Entry point:
ScriptDemo.Main is not public. This may cause errors with Mono.
2009-07-28 21:19:36.458000 [NOTICE] switch_cpp.cpp:1130 Loaded App
Script.csx, aliases 'Script.csx', into domain Script.csx_8.
2009-07-28 21:19:36.459000 [NOTICE] switch_cpp.cpp:1130 Loaded Api
Script.csx, aliases 'Script.csx', into domain Script.csx_8.
2009-07-28 21:19:36.459000 [INFO] switch_cpp.cpp:1130 Finished loading
c:\Users\Zwierko\Projects\fs\svn\Debug\mod\managed\Script.csx into
domain Script.csx_8.
managed ScriptDemo 111
2009-07-28 21:19:53.452000 [ERR] switch_cpp.cpp:1130 API plugin
ScriptDemo not found.
API CALL [managed(ScriptDemo 111)] output:
2009-07-28 21:19:53.452000 [ERR] mod_managed.cpp:393 Execute failed for
ScriptDemo 111 (unknown module or exception).
Again, am I doing something wrong in here?
Thanks, for any feedback
Lukasz Zwierko
Michael Giagnocavo wrote:
> Ah, that’s embarrassing. I added them and tried building FreeSWITCH.Managed
> from svn and it worked fine now. (I’ll kick off a new complete build in a
> minute.)
>
> -Michael
>
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Diego Toro
> Sent: Sunday, July 26, 2009 8:47 AM
> To: [email protected]
> Subject: Re: [Freeswitch-users] mod_managed users?
>
> Hi Michael,
>
> Thank you for your job with mod_managed, I get lastest version with
> mod_managed but the files PluginInterfaces.cs, PluginManager.cs and
> ScriptPluginManager.cs were not downloaded.
>
> Diego
>
>
> --- On Sun, 7/26/09, Michael Giagnocavo <[email protected]> wrote:
>
> From: Michael Giagnocavo <[email protected]>
> Subject: Re: [Freeswitch-users] mod_managed users?
> To: "[email protected]"
> <[email protected]>
> Date: Sunday, July 26, 2009, 2:18 AM
> Hello,
>
> I just checked in a new mod_managed. It breaks backwards
> compatibility, but adds scripting and reloading support.
>
> I tested it on CentOS 5.3 x64 with Mono 2.4.2.2. Just make &
> make install seemed to take care of everything.
>
> Let me know if you have better luck with this version.
>
> Thanks,
> Michael
>
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Muhammad
> Shahzad
> Sent: Saturday, July 18, 2009 6:58 AM
> To: [email protected]
> Subject: Re: [Freeswitch-users] mod_managed users?
>
> Sorry for replying late.
>
> I have tried mod_managed again on same machine (Lenovo 3000 N200), same OS
> (Ubuntu-9.04) and Mono version 2.0.1 but with latest FS revision 14249.
>
> It compiles correctly this time but gives following error upon "make install",
>
> =====================================================================
> making install mod_managed
> make[5]: *** No rule to make target
> `/usr/local/freeswitch/mod/mod_managed.so', needed by `local_install'. Stop.
> make[4]: *** [install] Error 1
> make[3]: *** [mod_managed-install] Error 1
> make[2]: *** [install-recursive] Error 1
>
> =====================================================================
>
> Here is compilation log when executing "make", if it could of any help.
>
> =====================================================================
> making all mod_managed
> Compiling freeswitch_managed.cpp...
> g++ -I/usr/src/svn-src/freeswitch/src/include
> -I/usr/src/svn-src/freeswitch/libs/libteletone/src -fPIC -fvisibility=hidden
> -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1 -g -O2 -D_GNU_SOURCE
> -D_REENTRANT -pthread -I/usr/include/mono-1.0 -I/usr/include/glib-2.0
> -I/usr/lib/glib-2.0/include -DHAVE_CONFIG_H -c -o freeswitch_managed.o
> freeswitch_managed.cpp
> Compiling freeswitch_wrap.cpp...
> g++ -I/usr/src/svn-src/freeswitch/src/include
> -I/usr/src/svn-src/freeswitch/libs/libteletone/src -fPIC -fvisibility=hidden
> -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1 -g -O2 -D_GNU_SOURCE
> -D_REENTRANT -pthread -I/usr/include/mono-1.0 -I/usr/include/glib-2.0
> -I/usr/lib/glib-2.0/include -DHAVE_CONFIG_H -c -o freeswitch_wrap.o
> freeswitch_wrap.cpp
> Demo.cs(58,14): warning CS0169: The private method
> `FreeSWITCH.Demo.AppDemo.hangupHook()' is never used
> Compilation succeeded - 1 warning(s)
> Compiling mod_managed.cpp...
> /usr/src/svn-src/freeswitch/libtool --mode=compile --tag=CXX g++
> -I/usr/src/svn-src/freeswitch/src/include
> -I/usr/src/svn-src/freeswitch/libs/libteletone/src -fPIC -fvisibility=hidden
> -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1 -g -O2 -D_GNU_SOURCE
> -D_REENTRANT -pthread -I/usr/include/mono-1.0 -I/usr/include/glib-2.0
> -I/usr/lib/glib-2.0/include -DHAVE_CONFIG_H -c -o mod_managed.lo
> mod_managed.cpp
> libtool: compile: g++ -I/usr/src/svn-src/freeswitch/src/include
> -I/usr/src/svn-src/freeswitch/libs/libteletone/src -fPIC -fvisibility=hidden
> -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1 -g -O2 -D_GNU_SOURCE
> -D_REENTRANT -pthread -I/usr/include/mono-1.0 -I/usr/include/glib-2.0
> -I/usr/lib/glib-2.0/include -DHAVE_CONFIG_H -c mod_managed.cpp -fPIC -DPIC
> -o .libs/mod_managed.o
> mod_managed.cpp: In function ‘void InitManagedSession(ManagedSession*, char*
> (*)(void*, switch_input_type_t), void (*)())’:
> mod_managed.cpp:97: warning: deprecated conversion from string constant to
> ‘char*’
> libtool: compile: g++ -I/usr/src/svn-src/freeswitch/src/include
> -I/usr/src/svn-src/freeswitch/libs/libteletone/src -fPIC -fvisibility=hidden
> -DSWITCH_API_VISIBILITY=1 -DHAVE_VISIBILITY=1 -g -O2 -D_GNU_SOURCE
> -D_REENTRANT -pthread -I/usr/include/mono-1.0 -I/usr/include/glib-2.0
> -I/usr/lib/glib-2.0/include -DHAVE_CONFIG_H -c mod_managed.cpp -o
> mod_managed.o >/dev/null 2>&1
> Creating mod_managed.la...
> cat: .libs/mod_managed.log: No such file or directory
>
> =====================================================================
>
> Thank you.
> On Fri, Jul 17, 2009 at 10:59 AM, Muhammad Shahzad
> <[email protected]<http://us.mc335.mail.yahoo.com/mc/[email protected]>>
> wrote:
> I tried to install mod_managed on ubuntu-9.04, mono framework version 2.0. It
> gave me a lots of errors in Loader.cs, which seems to be SWIG related. Since
> i am not a expert in SWIG so i disabled this module. This happend long ago, i
> think FS svn revision 136xx.
>
> Let me try to compile it from latest FS revision and see if it works. I will
> let you know the results.
>
> Thank you.
>
> On Fri, Jul 17, 2009 at 3:54 AM, Diego Toro
> <[email protected]<http://us.mc335.mail.yahoo.com/mc/[email protected]>>
> wrote:
> Hey, I am here :)
>
> I am working with mod_managed on Windows 2003 and Windows Vista with
> sucessfull. I noted on user list the issue with LoadFile on Loader.cs when a
> assembly had reference to others assemblies, I change LoadFile by LoadFrom
> and the load is made fine.
>
> I use c# application and sqlserver 2005, using FS and mod_managed.
>
> Diego
>
> --- On Thu, 7/16/09, Michael Giagnocavo
> <[email protected]<http://us.mc335.mail.yahoo.com/mc/[email protected]>>
> wrote:
>
> From: Michael Giagnocavo
> <[email protected]<http://us.mc335.mail.yahoo.com/mc/[email protected]>>
> Subject: [Freeswitch-users] mod_managed users?
> To:
> "[email protected]<http://us.mc335.mail.yahoo.com/mc/[email protected]>"
>
> <[email protected]<http://us.mc335.mail.yahoo.com/mc/[email protected]>>
> Date: Thursday, July 16, 2009, 4:43 PM
>
> Hey, if there are any mod_managed users on this list, I’d love it if you were
> able to let me know. I’d like to get feedback, positive or negative, on what
> worked, what didn’t, and how mod_managed can improve for you. Feel free to
> write on list or directly to me: mgg at giagnocavo.net<http://giagnocavo.net/>
>
> Thanks!
> -Michael
> -----Inline Attachment Follows-----
>
> _______________________________________________
> FreeSWITCH-users mailing list
> [email protected]<http://us.mc335.mail.yahoo.com/mc/[email protected]>
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org<http://www.freeswitch.org/>
>
>
>
> _______________________________________________
> FreeSWITCH-users mailing list
> [email protected]<http://us.mc335.mail.yahoo.com/mc/[email protected]>
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org<http://www.freeswitch.org/>
>
>
> --
> Muhammad Shahzad
> -----------------------------------
> CISCO Rich Media Communication Specialist (CRMCS)
> CISCO Certified Network Associate (CCNA)
> Cell: +92 334 422 40 88
> MSN:
> [email protected]<http://us.mc335.mail.yahoo.com/mc/[email protected]>
> Email:
> [email protected]<http://us.mc335.mail.yahoo.com/mc/[email protected]>
>
>
>
> --
> Muhammad Shahzad
> -----------------------------------
> CISCO Rich Media Communication Specialist (CRMCS)
> CISCO Certified Network Associate (CCNA)
> Cell: +92 334 422 40 88
> MSN:
> [email protected]<http://us.mc335.mail.yahoo.com/mc/[email protected]>
> Email:
> [email protected]<http://us.mc335.mail.yahoo.com/mc/[email protected]>
>
> -----Inline Attachment Follows-----
> _______________________________________________
> FreeSWITCH-users mailing list
> [email protected]<http://us.mc335.mail.yahoo.com/mc/[email protected]>
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org<http://www.freeswitch.org/>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> FreeSWITCH-users mailing list
> [email protected]
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iQEcBAEBAgAGBQJKb1CvAAoJED7LBosr0F2u6E4H/i0SVOJDrh4+3ex6nEDnVJQl
mLjTPpyoAyP3cEp37YmQbrk2DAqfmQgysygaiKP6yxdFsyDsPmphMV1biWGi8DgM
pwTiGQACFdWWiWiYk/J09ZbRJR24S8zHxuETQK93/7fy53tgqW6o35hLxb3arOaH
VOAUDHQkMX7Q/PFaorWk/bhYDbq6+XxwkBCQHeMk3zErZT1rl+haxVtBXN1N0h8+
k5t3C5bJpPNjpTmm4m0BEOdA7WfU2iFIJeOH9ZoHih01n68COnb52pl349Ah2fV8
cVVouTbOtjGsRpyq9OYh7XhIFzH/QUZQykL/BMlR3Df3g8KRJ8Q8p/zj5bNRDlA=
=LgK4
-----END PGP SIGNATURE-----
_______________________________________________
FreeSWITCH-users mailing list
[email protected]
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org