<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" version="2.0">
  <channel>
    <title>[Giagnocavo]Michael::Write() - FreeSWITCH</title>
    <link>http://www.atrevido.net/blog/</link>
    <description>Something about .NET.</description>
    <copyright>Michael Giagnocavo</copyright>
    <lastBuildDate>Mon, 13 Oct 2008 22:43:10 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.3.9074.18820</generator>
    <managingEditor>mggUNSPAM@telefinity.com</managingEditor>
    <webMaster>mggUNSPAM@telefinity.com</webMaster>
    <item>
      <trackback:ping>http://www.atrevido.net/blog/Trackback.aspx?guid=8046151c-913f-4bef-b5a2-6e5cc3203aca</trackback:ping>
      <pingback:server>http://www.atrevido.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.atrevido.net/blog/PermaLink,guid,8046151c-913f-4bef-b5a2-6e5cc3203aca.aspx</pingback:target>
      <dc:creator>
      </dc:creator>
      <wfw:comment>http://www.atrevido.net/blog/CommentView,guid,8046151c-913f-4bef-b5a2-6e5cc3203aca.aspx</wfw:comment>
      <wfw:commentRss>http://www.atrevido.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=8046151c-913f-4bef-b5a2-6e5cc3203aca</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <a href="http://wiki.freeswitch.org/wiki/Mod_managed">mod_managed</a> is
now in the <a href="http://www.freeswitch.org/">FreeSWITCH </a>tree. This replaces
mod_mono, and allows selection of either the Microsoft CLR or Mono 2.0+ as the runtime
engine to use. All the interfaces, and most of the code, are identical for both versions.
Modules written on Mono will work on the CLR version and vice versa.<br /><br />
Check it out.<br /><p></p><img width="0" height="0" src="http://www.atrevido.net/blog/aggbug.ashx?id=8046151c-913f-4bef-b5a2-6e5cc3203aca" /></body>
      <title>Mono or CLR in FreeSWITCH</title>
      <guid isPermaLink="false">http://www.atrevido.net/blog/PermaLink,guid,8046151c-913f-4bef-b5a2-6e5cc3203aca.aspx</guid>
      <link>http://www.atrevido.net/blog/2008/10/13/Mono+Or+CLR+In+FreeSWITCH.aspx</link>
      <pubDate>Mon, 13 Oct 2008 22:43:10 GMT</pubDate>
      <description>&lt;a href="http://wiki.freeswitch.org/wiki/Mod_managed"&gt;mod_managed&lt;/a&gt; is now in the &lt;a href="http://www.freeswitch.org/"&gt;FreeSWITCH &lt;/a&gt;tree.
This replaces mod_mono, and allows selection of either the Microsoft CLR or Mono 2.0+
as the runtime engine to use. All the interfaces, and most of the code, are identical
for both versions. Modules written on Mono will work on the CLR version and vice versa.&lt;br&gt;
&lt;br&gt;
Check it out.&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.atrevido.net/blog/aggbug.ashx?id=8046151c-913f-4bef-b5a2-6e5cc3203aca" /&gt;</description>
      <comments>http://www.atrevido.net/blog/CommentView,guid,8046151c-913f-4bef-b5a2-6e5cc3203aca.aspx</comments>
      <category>Code</category>
      <category>FreeSWITCH</category>
    </item>
    <item>
      <trackback:ping>http://www.atrevido.net/blog/Trackback.aspx?guid=0658d23d-d1b5-4e15-b979-f89d4f0952df</trackback:ping>
      <pingback:server>http://www.atrevido.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.atrevido.net/blog/PermaLink,guid,0658d23d-d1b5-4e15-b979-f89d4f0952df.aspx</pingback:target>
      <dc:creator>
      </dc:creator>
      <wfw:comment>http://www.atrevido.net/blog/CommentView,guid,0658d23d-d1b5-4e15-b979-f89d4f0952df.aspx</wfw:comment>
      <wfw:commentRss>http://www.atrevido.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=0658d23d-d1b5-4e15-b979-f89d4f0952df</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">FreeSWITCH's mod_mono plugin should now
work fine on Linux. Additionally, it's in the Visual Studio Solution file, all you
need to do is compile mod_mono (it won't build by default). There's also now support
for running mod_mono inside FreeSWITCH inside another managed application, just in
case you're embedding FreeSWITCH.<br /><br />
For more info: <a href="http://wiki.freeswitch.org/wiki/Mod_mono">http://wiki.freeswitch.org/wiki/Mod_mono</a><br /><p></p><img width="0" height="0" src="http://www.atrevido.net/blog/aggbug.ashx?id=0658d23d-d1b5-4e15-b979-f89d4f0952df" /></body>
      <title>Update on mod_mono in FreeSWITCH</title>
      <guid isPermaLink="false">http://www.atrevido.net/blog/PermaLink,guid,0658d23d-d1b5-4e15-b979-f89d4f0952df.aspx</guid>
      <link>http://www.atrevido.net/blog/2008/09/18/Update+On+Modmono+In+FreeSWITCH.aspx</link>
      <pubDate>Thu, 18 Sep 2008 02:24:38 GMT</pubDate>
      <description>FreeSWITCH's mod_mono plugin should now work fine on Linux. Additionally, it's in the Visual Studio Solution file, all you need to do is compile mod_mono (it won't build by default). There's also now support for running mod_mono inside FreeSWITCH inside another managed application, just in case you're embedding FreeSWITCH.&lt;br&gt;
&lt;br&gt;
For more info: &lt;a href="http://wiki.freeswitch.org/wiki/Mod_mono"&gt;http://wiki.freeswitch.org/wiki/Mod_mono&lt;/a&gt;
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.atrevido.net/blog/aggbug.ashx?id=0658d23d-d1b5-4e15-b979-f89d4f0952df" /&gt;</description>
      <comments>http://www.atrevido.net/blog/CommentView,guid,0658d23d-d1b5-4e15-b979-f89d4f0952df.aspx</comments>
      <category>FreeSWITCH</category>
    </item>
    <item>
      <trackback:ping>http://www.atrevido.net/blog/Trackback.aspx?guid=7f03299e-3674-444c-acb7-aa79c7e71993</trackback:ping>
      <pingback:server>http://www.atrevido.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.atrevido.net/blog/PermaLink,guid,7f03299e-3674-444c-acb7-aa79c7e71993.aspx</pingback:target>
      <dc:creator>
      </dc:creator>
      <wfw:comment>http://www.atrevido.net/blog/CommentView,guid,7f03299e-3674-444c-acb7-aa79c7e71993.aspx</wfw:comment>
      <wfw:commentRss>http://www.atrevido.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=7f03299e-3674-444c-acb7-aa79c7e71993</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <i>Managed code? In MY softswitch? It's
more common than you think.</i>
        <br />
        <br />
A while back, I tried creating a mono plugin for Asterisk. The goal being that'd you'd
be able to write in-process apps in decent languages, rather than resorting to C.
Well, there were no standards of how functions operated (i.e., who's responsible for
memory), and my requests to standardize these were met with hostility. (Actually,
when I asked why they didn't refactor some stuff, like the multi-thousand-line switch
statements, I was told "refactoring doesn't exist for C"... sigh.) But the real showstopper
was that we couldn't figure out how to get Asterisk to play nice with mono as far
as threads go. I had a very active Asterisk developer work on it with me, and he pretty
much told me it wasn't going to work. Oh well.<br /><br />
When I stopped really being involved with Asterisk, I had seen a couple big Asterisk
developers leave to start <a href="http://www.FreeSWITCH.org">FreeSWITCH</a>. It was
mainly an idea at that point, to do things right and build a scalable, clean system.
Well, fast forward a few years and FreeSWITCH has really come far. You can go read
their site for more details, but it's a more flexible, scalable, and vastly cleaner
VoIP platform. That's why, at v1.0.1, it already supports UDP, TCP, TLS, SRTP, IPv6,
wideband codecs, and more. Oh, and it runs cross-platform, including Windows.<br /><br />
But the really great thing about FS is that it was designed to be modular from the
beginning. And, it was designed to allow people build apps into it. It has some nice
out-of-process extensibility, think Asterisk Manager and AGI, without the suck. [I
wonder how many * flames I'm gonna get?] But also of interest, they designed an app
API from the start. It's written in C++, and SWIG friendly so you can quickly add
other languages (Javascript and Lua seem to be the most popular). 
<br /><br />
Well, the thought of running interpreted stuff in-process disgusted me, so I immediately
set out to try to add Mono support. Much to my surprise, the FS team was extremely
supportive. They helped me figure out all the bits of FS and the API I needed. In
fact, one of the project leads told me, "Hell, if you're gonna write mod_mono, we'll
give you checkin support right now.". A short bit later, we had mod_mono working!<br /><br />
Not satisfied with doing just apps, I turned to doing a full integration. A bit of
SWIGwork later, and I had the entire FreeSWITCH header files SWIG'd and C# accessible.
I found a few APIs that didn't import (varargs stuff, I think), but the FS team helped
add some different methods to work around that. 
<br /><br />
The Mono side was pretty straightforward. We write a C/C++ module for FS that gets
Mono up and running. Then it kicks off mod_mono_managed, which actually loads modules,
runs initialization code, etc. 
<br />
The biggest problem I ran into was a problem between SWIG and Mono. Mono would attempt
to free strings with g_free, crashing on Windows. I wrote a SWIG-C# post-processor
to tweak the SWIG code to avoid it; I'm not sure it's accurate, but we haven't noticed
issues so far. A few things we ran into were quickly cleared up by the awesome people
#mono. This week we'll be testing and make sure it's fixed in Mono 2.0. 
<br /><br />
So, the bottom line is that you can write any sort of module for FreeSWITCH, from
simple apps and API functions, down to a full codec or endpoint, all in managed code
(though, the interop might not be pretty sometimes). I've tried some simple stuff
out in C#, F#, and Javascript (JScript .NET), and it all works fine. The code is in
the FS SVN, under /freeswitch/src/mod/languages/mod_mono and mod_mono_managed. It's
not part of the official build yet, so there may be a bit of work involved in getting
it going. But I have heard from other people that they've gotten it working. Some
info is here: <a href="http://wiki.freeswitch.org/wiki/Mod_mono">http://wiki.freeswitch.org/wiki/Mod_mono</a> --
Right now, we've only tested on Mono 1.9.1, but we're going to only support 2.0 as
of very soon. (F# only supports 2.0, so earlier versions are irrelevant to my interests
:).) 
<br /><br />
This is exciting for us, as it allows us to build *safe* applications that run in-process
with the switch. But, unlike the embedded scripting languages, we get top-notch performance
and access to complete libraries. We're combining this in-process approach with out-of-process
(<a href="http://wiki.freeswitch.org/wiki/Event_Socket">Event Socket</a>, outbound)
to get a robust and very scalable system. For our particular application, we have
several GB of decision data that we keep in RAM on separate servers (which is in turn
sync'd to SQL Server 2008, via a proprietary change replication system). For obvious
reasons, we didn't want that memory being stuck in the FS process. Having Mono on
both sides allows us to share code between the different systems, while still getting
optimizations for both environments.<br /><br />
You can email me: mgg AT a t r e v i d o _ net or use the chat widget on the on my
site if you have questions or problems getting it going. 
<br /><br />
I'll post a follow up once it's in the official build.<br /><br /><p></p><img width="0" height="0" src="http://www.atrevido.net/blog/aggbug.ashx?id=7f03299e-3674-444c-acb7-aa79c7e71993" /></body>
      <title>Mono in FreeSWITCH - Experience in embedding Mono</title>
      <guid isPermaLink="false">http://www.atrevido.net/blog/PermaLink,guid,7f03299e-3674-444c-acb7-aa79c7e71993.aspx</guid>
      <link>http://www.atrevido.net/blog/2008/09/02/Mono+In+FreeSWITCH+Experience+In+Embedding+Mono.aspx</link>
      <pubDate>Tue, 02 Sep 2008 02:04:38 GMT</pubDate>
      <description>&lt;i&gt;Managed code? In MY softswitch? It's more common than you think.&lt;/i&gt;
&lt;br&gt;
&lt;br&gt;
A while back, I tried creating a mono plugin for Asterisk. The goal being that'd you'd
be able to write in-process apps in decent languages, rather than resorting to C.
Well, there were no standards of how functions operated (i.e., who's responsible for
memory), and my requests to standardize these were met with hostility. (Actually,
when I asked why they didn't refactor some stuff, like the multi-thousand-line switch
statements, I was told "refactoring doesn't exist for C"... sigh.) But the real showstopper
was that we couldn't figure out how to get Asterisk to play nice with mono as far
as threads go. I had a very active Asterisk developer work on it with me, and he pretty
much told me it wasn't going to work. Oh well.&lt;br&gt;
&lt;br&gt;
When I stopped really being involved with Asterisk, I had seen a couple big Asterisk
developers leave to start &lt;a href="http://www.FreeSWITCH.org"&gt;FreeSWITCH&lt;/a&gt;. It was
mainly an idea at that point, to do things right and build a scalable, clean system.
Well, fast forward a few years and FreeSWITCH has really come far. You can go read
their site for more details, but it's a more flexible, scalable, and vastly cleaner
VoIP platform. That's why, at v1.0.1, it already supports UDP, TCP, TLS, SRTP, IPv6,
wideband codecs, and more. Oh, and it runs cross-platform, including Windows.&lt;br&gt;
&lt;br&gt;
But the really great thing about FS is that it was designed to be modular from the
beginning. And, it was designed to allow people build apps into it. It has some nice
out-of-process extensibility, think Asterisk Manager and AGI, without the suck. [I
wonder how many * flames I'm gonna get?] But also of interest, they designed an app
API from the start. It's written in C++, and SWIG friendly so you can quickly add
other languages (Javascript and Lua seem to be the most popular). 
&lt;br&gt;
&lt;br&gt;
Well, the thought of running interpreted stuff in-process disgusted me, so I immediately
set out to try to add Mono support. Much to my surprise, the FS team was extremely
supportive. They helped me figure out all the bits of FS and the API I needed. In
fact, one of the project leads told me, "Hell, if you're gonna write mod_mono, we'll
give you checkin support right now.". A short bit later, we had mod_mono working!&lt;br&gt;
&lt;br&gt;
Not satisfied with doing just apps, I turned to doing a full integration. A bit of
SWIGwork later, and I had the entire FreeSWITCH header files SWIG'd and C# accessible.
I found a few APIs that didn't import (varargs stuff, I think), but the FS team helped
add some different methods to work around that. 
&lt;br&gt;
&lt;br&gt;
The Mono side was pretty straightforward. We write a C/C++ module for FS that gets
Mono up and running. Then it kicks off mod_mono_managed, which actually loads modules,
runs initialization code, etc. 
&lt;br&gt;
The biggest problem I ran into was a problem between SWIG and Mono. Mono would attempt
to free strings with g_free, crashing on Windows. I wrote a SWIG-C# post-processor
to tweak the SWIG code to avoid it; I'm not sure it's accurate, but we haven't noticed
issues so far. A few things we ran into were quickly cleared up by the awesome people
#mono. This week we'll be testing and make sure it's fixed in Mono 2.0. 
&lt;br&gt;
&lt;br&gt;
So, the bottom line is that you can write any sort of module for FreeSWITCH, from
simple apps and API functions, down to a full codec or endpoint, all in managed code
(though, the interop might not be pretty sometimes). I've tried some simple stuff
out in C#, F#, and Javascript (JScript .NET), and it all works fine. The code is in
the FS SVN, under /freeswitch/src/mod/languages/mod_mono and mod_mono_managed. It's
not part of the official build yet, so there may be a bit of work involved in getting
it going. But I have heard from other people that they've gotten it working. Some
info is here: &lt;a href="http://wiki.freeswitch.org/wiki/Mod_mono"&gt;http://wiki.freeswitch.org/wiki/Mod_mono&lt;/a&gt; --
Right now, we've only tested on Mono 1.9.1, but we're going to only support 2.0 as
of very soon. (F# only supports 2.0, so earlier versions are irrelevant to my interests
:).) 
&lt;br&gt;
&lt;br&gt;
This is exciting for us, as it allows us to build *safe* applications that run in-process
with the switch. But, unlike the embedded scripting languages, we get top-notch performance
and access to complete libraries. We're combining this in-process approach with out-of-process
(&lt;a href="http://wiki.freeswitch.org/wiki/Event_Socket"&gt;Event Socket&lt;/a&gt;, outbound)
to get a robust and very scalable system. For our particular application, we have
several GB of decision data that we keep in RAM on separate servers (which is in turn
sync'd to SQL Server 2008, via a proprietary change replication system). For obvious
reasons, we didn't want that memory being stuck in the FS process. Having Mono on
both sides allows us to share code between the different systems, while still getting
optimizations for both environments.&lt;br&gt;
&lt;br&gt;
You can email me: mgg AT a t r e v i d o _ net or use the chat widget on the on my
site if you have questions or problems getting it going. 
&lt;br&gt;
&lt;br&gt;
I'll post a follow up once it's in the official build.&lt;br&gt;
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.atrevido.net/blog/aggbug.ashx?id=7f03299e-3674-444c-acb7-aa79c7e71993" /&gt;</description>
      <comments>http://www.atrevido.net/blog/CommentView,guid,7f03299e-3674-444c-acb7-aa79c7e71993.aspx</comments>
      <category>FreeSWITCH</category>
      <category>VoIP</category>
    </item>
  </channel>
</rss>