[Freeswitch-dev] .NET Development
Michael Giagnocavo
mgg at giagnocavo.net
Wed Jul 30 22:06:21 EDT 2008
Hi David,
It's my intention to get it all working and we're going to be putting some people on testing it out soon. I've just been busy with other stuff and haven't updated it. I imagine within a month we'll have gotten things smoothed out if no one else has by then. I'd hope that it'd be an "official" plugin as it eliminates the need for other language plugins; then again I'm biased against languages with no or poor specs or compilers ;).
I'm not sure there's an official bug opened for the string problem. IIRC, gfree is used all the time to free PInvoke strings, and that crashes on Windows. There was a patch submitted; I think it's in the 2.0 branch (which will really be the only deployment option anyways). It's easy to see if you hit the bug; run a plugin on Windows and see if it crashes (I believe the managed loader runs some functions that'd crash).
-Michael
-----Original Message-----
From: freeswitch-dev-bounces at lists.freeswitch.org [mailto:freeswitch-dev-bounces at lists.freeswitch.org] On Behalf Of David Brazier
Sent: Wednesday, July 30, 2008 9:51 AM
To: freeswitch-dev at lists.freeswitch.org
Cc: mgg at packetrino.com
Subject: Re: [Freeswitch-dev] .NET Development
Hi
Just wanted to check the status of mod_mono. To build it from SVN trunk, I needed to run swig to update all that stuff, basically (I think) because it was last updated for 1.0.0 and the switch core has moved on since then. That, along with a few other bumps, got it compiled and working on Windows. On Linux, I have had to do more like work out prerequisites, write Makefiles, manually do the "swigStringFix" (Michael do you have a reference to what Mono bug that works around?) etc., but I have finally got mod_mono to load (but not tested yet).
So is it intended that the main FS build would incorporate all the above so that mod_mono/mod_mono_managed becomes a standard module (built but not necessarily loaded by default)? Is anyone else working on this?
Should I update the wiki page?
Cheers
David
From: freeswitch-dev-bounces at lists.freeswitch.org [mailto:freeswitch-dev-bounces at lists.freeswitch.org] On Behalf Of Michael Giagnocavo
Sent: 26 June 2008 01:49
To: freeswitch-dev at lists.freeswitch.org
Subject: Re: [Freeswitch-dev] .NET Development
Hi Patrick,
What kind of .NET application are you developing? In the contrib folder there is the .NET event socket code (I think that's where it is). But I don't know anything about that.
I do know a bit about mod_mono, so I'll talk about that:
To get mod_mono to build, you'll need Windows and VS 2008 (well, I don't have the linux build steps anyways). You'll have to generate mono.lib for your compiler. From here:
http://www.mono-project.com/Embedding_Mono
"On windows you need to generate an import library for mono.dll by getting the following file:
http://anonsvn.mono-project.com/viewcvs/*checkout*/trunk/mono/msvc/mono.def
and creating mono.lib with the command:
lib /nologo /def:mono.def /out:mono.lib /machine:x86
"
Make sure your PATH has the Mono bin folder in it (such as "C:\Program files\Mono-1.9.1\bin").
From there, you can add mod_mono and mod_mono_managed to the build setting in the VS SLN and compile them. Load mod_mono in the modules.conf.xml, then drop your apps in <fsdir>\mod\mono\. If you compile debug, a few simple demos will compile and load (they are in the mod_mono_managed source, Demo.cs).
It's quite easy, as it uses the FS C++ API here's a simple, pointless app in Javascript for .NET:
import System;
import FreeSWITCH;
class JExample extends AppFunction
{
protected override function Run()
{
Session.Answer();
Session.Hangup("USER_BUSY");
}
}
Here is a 40-line RSS reader (well, printer, since I haven't gotten Cepstral building on Windows) in F#:
#light
namespace rss
open System
open System.Net
open System.IO
open System.Xml.Linq
open FreeSWITCH
module funcs =
let httpGet (url : string) =
let req = WebRequest.Create(url)
use resp = req.GetResponse()
use stream = resp.GetResponseStream()
use reader = new StreamReader(stream)
reader.ReadToEnd()
let getXDoc url = XDocument.Parse(httpGet url)
let xname s = XName.Get(s)
let getChannelTitle (doc : XDocument) = Seq.hd(doc.Descendants(xname "title")).Value
let getItemData (item : XElement) = (item.Element(xname "title").Value, item.Element(xname "description").Value)
open funcs
type reader() =
inherit AppFunction()
member app.item : int = 0
member app.say s =
// We need to init the TTS and all that, but for now...
Log.WriteLine(LogLevel.Info, "Say: " + s)
//app.Session.Speak s |> ignore
override app.Run() =
app.Session.Answer |> ignore
// app.Session.SetTtsParameters ("cepstral", "david")
app.say ("Reading " + app.Arguments)
let doc = getXDoc (app.Arguments)
app.say (getChannelTitle doc)
doc.Descendants(xname "item")
|> Seq.map getItemData
|> Seq.iter (fun (title, desc) ->
app.say ("Item, " + title)
app.say ("Description, " + desc))
app.Session.Hangup("NORMAL_CLEARING")
Hope that helps a bit.
-Michael
From: freeswitch-dev-bounces at lists.freeswitch.org [mailto:freeswitch-dev-bounces at lists.freeswitch.org] On Behalf Of Patrick Tran
Sent: Wednesday, June 25, 2008 6:24 PM
To: freeswitch-dev at lists.freeswitch.org
Subject: [Freeswitch-dev] .NET Development
I'm new to Freeswitch and trying to develop a .NET Application. I'm having a lot of trouble getting started though. There doesn't seem to be a lot support out there for this. My development has sort of come to a stand-still and I was wondering if anyone could help me get pointed in the right direction. Any help would be much appreciated.
Thanks
-Patrick
360CRM Limited, registered address, Caledonia House, 89 Seaward Street, Glasgow, G41 1HJ, Registered in Scotland, company number SC261952.
This email and its attachments may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of 360CRM Ltd. This email does not form any part of a contract. If you are not the intended recipient of this email and its attachments, you must take no action based upon them, nor must you copy or show them to anyone. Please contact the sender if you believe you have received this email in error.
_______________________________________________
Freeswitch-dev mailing list
Freeswitch-dev at lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
http://www.freeswitch.org
More information about the Freeswitch-dev
mailing list