<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
<html><head><meta http-equiv="Content-Type" content="text/html;charset=us-ascii">
<style>BODY{font:10pt Tahoma, Verdana, sans-serif}</style></head><body>
<DIV>Ed,</DIV>
<DIV> </DIV>
<DIV>There are really no good examples that explain it. I have a few projects I've done with demos they're all public in my GitLab server: <A href="http://git.drkngs.com/public">http://git.drkngs.com/public</A> to get a list of the feeds.</DIV>
<DIV> </DIV>
<DIV>From what it looks like , you want to do something with an inbound call, what you really need to do, is implment a class that implments IAppPlugin. This interface allows you to write a dial plan app from managed code. What you ned to do for the example you have there is:</DIV>
<DIV> </DIV>
<DIV>Change it from a module to a class that implments IAppPlugin.</DIV>
<DIV> </DIV>
<DIV>Change the Main to Run, the only method defined in that interface.</DIV>
<DIV> </DIV>
<DIV>The run method gets passed one argument (IAppPluginContext) which has a property named "Session", us it rather then trying to new up a ManagedSession, it gets passed to you on an inbound call.</DIV>
<DIV> </DIV>
<DIV>Route something to your code in the dial plan, Applicaition name is managed, and data should be the name of your class.</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>--Dave</DIV><BR>
<BLOCKQUOTE style="BORDER-LEFT: #0000ff 2px solid; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px">
<HR>
<B>From:</B> Peter Olsson [mailto:peter@olssononline.se]<BR><B>To:</B> FreeSWITCH Users Help [mailto:freeswitch-users@lists.freeswitch.org]<BR><B>Sent:</B> Sun, 15 Sep 2013 01:17:21 -0700<BR><B>Subject:</B> Re: [Freeswitch-users] mod_managed trouble<BR><BR>
<DIV>Please read <A href="http://wiki.freeswitch.org/wiki/Mod_managed#Native_Interop">http://wiki.freeswitch.org/wiki/Mod_managed#Native_Interop</A>, There is also a sample that links here, which should be enough to get you started; <A href="https://github.com/joshrivers/FreeSWITCH_Managed_ParkingLot">https://github.com/joshrivers/FreeSWITCH_Managed_ParkingLot</A>.
<DIV><BR></DIV>
<DIV>/Peter</DIV></DIV>
<DIV class=gmail_extra><BR><BR>
<DIV class=gmail_quote>2013/9/15 Ed Graves <SPAN><<A href="mailto:egravesvip@gmail.com">egravesvip@gmail.com</A>></SPAN><BR>
<BLOCKQUOTE style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class=gmail_quote>
<DIV>
<DIV>
<DIV>Hi. I've been working for days now trying to get a simple inbound call to work using <A href="http://vb.net/">vb.net</A> on Windows using FreeSWITCH version 1.2.12 and Visual Studio 2012.</DIV>
<DIV><BR></DIV>
<DIV>I'm tired and frustrated, but I think I'm almost there. Please help.</DIV>
<DIV> </DIV>
<DIV>I'm using the sample script below, but when I copy the .exe into place, FreeSWITCH tries to execute it immediately. When this happens, I get the output below, with lots of "session is not initialized" errors, which makes sense, because there is no session. </DIV>
<DIV><BR></DIV>
<DIV>But then when I place an inbound call using my soft-phone, the script runs and I still get the "session not initialized" errors.</DIV>
<DIV><BR></DIV>
<DIV>So, I don't understand why A) FreeSWITCH tries to run my app immediately when I copy it into place when I don't ask it to, and B) why I get these "session not initialized" errors when it runs in response to my inbound softphone call.</DIV>
<DIV><BR></DIV>
<DIV><BR></DIV>
<DIV>********** My Sample App **********</DIV>
<DIV><BR></DIV>
<DIV>Module inbound</DIV>
<DIV> Sub Main()<BR></DIV>
<DIV><BR></DIV>
<DIV> Dim fs As New FreeSWITCH.Native.ManagedSession()<BR></DIV>
<DIV><BR></DIV>
<DIV> fs.Answer()</DIV>
<DIV> fs.StreamFile("C:\Genesis\freeswitch\freeswitch1.2.12\Debug\sounds\en\us\callie\ivr\8000\ivr-congratulations_you_pressed_star.wav", 0)</DIV>
<DIV> FreeSWITCH.Log.WriteLine(FreeSWITCH.LogLevel.Error, "I'm working!!!")</DIV>
<DIV> fs.StreamFile("C:\Genesis\freeswitch\freeswitch-1.2.12\Debug\sounds\en\us\callie\ivr\8000\ivr-congratulations_you_pressed_star.wav", 0)</DIV>
<DIV> fs.Hangup("end")<BR></DIV>
<DIV> End Sub</DIV>
<DIV>End Module<BR></DIV></DIV>
<DIV><BR></DIV>
<DIV><BR></DIV>
<DIV>******** My output ********</DIV>
<DIV><BR></DIV>
<DIV>2013-09-14 01:55:08.541500 [INFO] mod_dialplan_xml.c:558 Processing egg <egg>->12345 in context public<BR></DIV>
<DIV>2013-09-14 01:55:08.541500 [ERR] switch_cpp.cpp:632 session is not initalized</DIV>
<DIV>2013-09-14 01:55:08.541500 [ERR] switch_cpp.cpp:951 session is not initalized</DIV>
<DIV>2013-09-14 01:55:08.541500 [ERR] switch_cpp.cpp:1287 I'm working!!!</DIV>
<DIV>2013-09-14 01:55:08.541500 [ERR] switch_cpp.cpp:951 session is not initalized</DIV>
<DIV>2013-09-14 01:55:08.541500 [ERR] switch_cpp.cpp:668 session is not initalized<BR></DIV>
<DIV><BR></DIV>
<DIV>Again, I'd really appreciate any help.</DIV>
<DIV><BR></DIV>
<DIV>Thanks in adance,</DIV>
<DIV>Ed</DIV>
<DIV><BR></DIV>
<DIV><BR></DIV>
<DIV><BR></DIV></DIV><BR>_________________________________________________________________________<BR>Professional FreeSWITCH Consulting Services:<BR><A href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</A><BR><A href="http://www.freeswitchsolutions.com/">http://www.freeswitchsolutions.com</A><BR><BR>FreeSWITCH-powered IP PBX: The CudaTel Communication Server<BR><A href="http://www.cudatel.com/">http://www.cudatel.com</A><BR><BR>Official FreeSWITCH Sites<BR><A href="http://www.freeswitch.org/">http://www.freeswitch.org</A><BR><A href="http://wiki.freeswitch.org/">http://wiki.freeswitch.org</A><BR><A href="http://www.cluecon.com/">http://www.cluecon.com</A><BR><BR>FreeSWITCH-users mailing list<BR><A href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</A><BR><A href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</A><BR>UNSUBSCRIBE:<A href="http://lists.freeswitch.org/mailman/options/freeswitch-users">http://lists.freeswitch.org/mailman/options/freeswitch-users</A><BR><A href="http://www.freeswitch.org/">http://www.freeswitch.org</A><BR><BR></BLOCKQUOTE></DIV><BR></DIV></BLOCKQUOTE>
<STYLE>
</STYLE>
<DIV> </DIV>
<DIV> </DIV></body></html>