[Freeswitch-dev] .NET Development
Michael Giagnocavo
mgg at giagnocavo.net
Wed Jun 25 20:49:26 EDT 2008
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20080625/f73c7b78/attachment-0001.html
More information about the Freeswitch-dev
mailing list