<?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() - ast_mono</title>
    <link>http://www.atrevido.net/blog/</link>
    <description>Something about .NET.</description>
    <copyright>Michael Giagnocavo</copyright>
    <lastBuildDate>Wed, 16 Mar 2005 17:06:55 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=65e1bf80-d2a7-42e8-904c-9e758ded0afa</trackback:ping>
      <pingback:server>http://www.atrevido.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.atrevido.net/blog/PermaLink,guid,65e1bf80-d2a7-42e8-904c-9e758ded0afa.aspx</pingback:target>
      <dc:creator>
      </dc:creator>
      <wfw:comment>http://www.atrevido.net/blog/CommentView,guid,65e1bf80-d2a7-42e8-904c-9e758ded0afa.aspx</wfw:comment>
      <wfw:commentRss>http://www.atrevido.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=65e1bf80-d2a7-42e8-904c-9e758ded0afa</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I'm doing my own realtime support for Asterisk, in an attempt to make it scale. Asterisk
is nice software, but straight out-of-CVS, the performance for high volume (say, over
20,000 clients) sucks. There are also other inconviences with using a file-based store
to determine how to route calls. Mainly, it's inflexible and hard to achieve high-perf
when everything is based on a large .conf file. Not to mention that Asterisk uses
linked lists for everything so looking up any user is an O(N) op (and parsing the
users file is O(N*N) by default!). So, I'm going to put my own logic as a replacement
for some of the critical parts. 
<br /><br />
One of my concerns was performance. Since I'll have multiple Asterisk clusters banging
on my .NET code (via SOAP), I wanted to ensure the whole end-to-end process was fast
enough. 
<br /><br />
I used <a href="http://www.cs.fsu.edu/~engelen/soap.html">gSOAP</a> to create the
C code on Linux. gSOAP is seriously nice. At least an order of magnitude easier to
use than I expected any SOAP library that works on Linux would be.<br /><br />
I created a simple test. I made a database with phone numbers and codecs. The
idea is that when an incoming call comes in, Asterisk will use my code to SOAP over
to my Windows machines, get the data, and then go on its merry way.<br /><br />
My Asterisk machine is a P4 2.4GHz, 512MB RAM (but, I have a Gnome session running
on it). My Windows XP machine (I tested against my desktop) is a P4 3GHz HT, 1.5GB
RAM. I'm running ASP.NET 2 Beta 1 and SQL Server 2000.<br /><br />
The test program consists of a loop (count 5000) that generates a random number, then
uses gSOAP to ask for the codec for that number. Simple, tight.<br /><br />
The results on Linux are particularly impressive. Each instance of the test app
only used a max of 4% processor, and under 1MB of RAM. The bottleneck was definately
inside ASP.NET. To simulate more load from other machines in a cluster, I ran 1, 2,
and 4 instances of the test program. Also note that background tasks on the XP machine
used up about 10% of the CPU.<br /><br />
Results:<br />
 Single process (5000 total requests): <br />
  Total time:                  
18 seconds (0.0036s/request)<br />
  Requests per second:   277<br />
  ASP.NET/IIS CPU:          30%<br />
  SQL Server CPU:           
4%<br /><br />
 Dual process (10,000 total requests):<br />
  Total time:                 
 23 seconds (0.0048s/request)<br />
  Requests per second:   384<br />
  ASP.NET/IIS CPU:          60%<br />
  SQL Server CPU:           
7%<br /><br />
 Quad process (20,000 total requests):<br />
  Total time:                 
 42 seconds (0.0052s/request)<br />
  Requests per second:   476<br />
  ASP.NET/IIS CPU:          80%<br />
  SQL Server CPU:           10%<br /><br />
These results are encouraging enough that I'm not worried of the performance impact
of using SOAP with Asterisk. My target was to have a response in less than 0.1 seconds.
Although, anything under 0.5s would be quite unnoticable to a client. Even in tests
with more threads, my single request response time was always way under 0.1 seconds.<br /><br />
Also, as far as I know, Whidbey Beta 2 (the version I'll go live with) makes
some performance improvements. And also, IIS6 on Windows 2003 is much faster than
IIS5.1 on XP. At any rate, a single proc desktop machine serving 476 RPS? That's pretty
damn good perf if you ask me!
</p>
        <img width="0" height="0" src="http://www.atrevido.net/blog/aggbug.ashx?id=65e1bf80-d2a7-42e8-904c-9e758ded0afa" />
      </body>
      <title>SOAP Performance (gSOAP / ASP.NET)</title>
      <guid isPermaLink="false">http://www.atrevido.net/blog/PermaLink,guid,65e1bf80-d2a7-42e8-904c-9e758ded0afa.aspx</guid>
      <link>http://www.atrevido.net/blog/2005/03/16/SOAP+Performance+GSOAP+ASPNET.aspx</link>
      <pubDate>Wed, 16 Mar 2005 17:06:55 GMT</pubDate>
      <description>&lt;p&gt;
I'm doing my own realtime support for Asterisk, in an attempt to make it scale. Asterisk
is nice software, but straight out-of-CVS, the performance for high volume (say, over
20,000 clients) sucks. There are also other inconviences with using a file-based store
to determine how to route calls. Mainly, it's inflexible and hard to achieve high-perf
when everything is based on a large .conf file. Not to mention that Asterisk uses
linked lists for everything so looking up any user is an O(N) op (and parsing the
users file is O(N*N) by default!). So, I'm going to put my own logic as a replacement
for some of the critical parts. 
&lt;br&gt;
&lt;br&gt;
One of my concerns was performance. Since I'll have multiple Asterisk clusters banging
on my .NET code (via SOAP), I wanted to ensure the whole end-to-end process was fast
enough. 
&lt;br&gt;
&lt;br&gt;
I used &lt;a href="http://www.cs.fsu.edu/~engelen/soap.html"&gt;gSOAP&lt;/a&gt; to create the
C code on Linux. gSOAP is seriously nice. At least an order of magnitude easier to
use than I expected any SOAP library that works on Linux would be.&lt;br&gt;
&lt;br&gt;
I created a simple test. I made a database with phone numbers&amp;nbsp;and codecs. The
idea is that when an incoming call comes in, Asterisk will use my code to SOAP over
to my Windows machines, get the data, and then go on its merry way.&lt;br&gt;
&lt;br&gt;
My Asterisk machine is a P4 2.4GHz, 512MB RAM (but, I have a Gnome session running
on it). My Windows XP machine (I tested against my desktop) is a P4 3GHz HT, 1.5GB
RAM. I'm running ASP.NET 2 Beta 1 and SQL Server 2000.&lt;br&gt;
&lt;br&gt;
The test program consists of a loop (count 5000) that generates a random number, then
uses gSOAP to ask for the codec for that number. Simple, tight.&lt;br&gt;
&lt;br&gt;
The results on Linux are particularly impressive. Each instance of&amp;nbsp;the test app
only used a max of 4% processor, and under 1MB of RAM. The bottleneck was definately
inside ASP.NET. To simulate more load from other machines in a cluster, I ran 1, 2,
and 4 instances of the test program. Also note that background tasks on the XP machine
used up about 10% of the CPU.&lt;br&gt;
&lt;br&gt;
Results:&lt;br&gt;
&amp;nbsp;Single process (5000 total requests):&amp;nbsp;&lt;br&gt;
&amp;nbsp; Total time:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
18 seconds (0.0036s/request)&lt;br&gt;
&amp;nbsp; Requests per second:&amp;nbsp;&amp;nbsp;&amp;nbsp;277&lt;br&gt;
&amp;nbsp; ASP.NET/IIS CPU:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;30%&lt;br&gt;
&amp;nbsp; SQL Server CPU:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;
4%&lt;br&gt;
&lt;br&gt;
&amp;nbsp;Dual process (10,000 total requests):&lt;br&gt;
&amp;nbsp; Total time:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;23 seconds (0.0048s/request)&lt;br&gt;
&amp;nbsp;&amp;nbsp;Requests per second:&amp;nbsp;&amp;nbsp; 384&lt;br&gt;
&amp;nbsp; ASP.NET/IIS CPU:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; 60%&lt;br&gt;
&amp;nbsp; SQL Server CPU:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;
7%&lt;br&gt;
&lt;br&gt;
&amp;nbsp;Quad process (20,000 total requests):&lt;br&gt;
&amp;nbsp; Total time:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;42 seconds (0.0052s/request)&lt;br&gt;
&amp;nbsp; Requests per second:&amp;nbsp;&amp;nbsp; 476&lt;br&gt;
&amp;nbsp; ASP.NET/IIS CPU:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; 80%&lt;br&gt;
&amp;nbsp; SQL Server CPU:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;10%&lt;br&gt;
&lt;br&gt;
These results are encouraging enough that I'm not worried of the performance impact
of using SOAP with Asterisk. My target was to have a response in less than 0.1 seconds.
Although, anything under 0.5s would be quite unnoticable to a client. Even in tests
with more threads, my single request response time was always way under 0.1 seconds.&lt;br&gt;
&lt;br&gt;
Also, as far as I know, Whidbey&amp;nbsp;Beta 2&amp;nbsp;(the version I'll go live with)&amp;nbsp;makes
some performance improvements. And also, IIS6 on Windows 2003 is much faster than
IIS5.1 on XP. At any rate, a single proc desktop machine serving 476 RPS? That's pretty
damn good perf if you ask me!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.atrevido.net/blog/aggbug.ashx?id=65e1bf80-d2a7-42e8-904c-9e758ded0afa" /&gt;</description>
      <comments>http://www.atrevido.net/blog/CommentView,guid,65e1bf80-d2a7-42e8-904c-9e758ded0afa.aspx</comments>
      <category>ast_mono</category>
      <category>Asterisk</category>
      <category>Code</category>
    </item>
    <item>
      <trackback:ping>http://www.atrevido.net/blog/Trackback.aspx?guid=a919e626-9144-4fec-9626-5a160960e460</trackback:ping>
      <pingback:server>http://www.atrevido.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.atrevido.net/blog/PermaLink,guid,a919e626-9144-4fec-9626-5a160960e460.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://www.atrevido.net/blog/CommentView,guid,a919e626-9144-4fec-9626-5a160960e460.aspx</wfw:comment>
      <wfw:commentRss>http://www.atrevido.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=a919e626-9144-4fec-9626-5a160960e460</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I chose to expose cli.h, since it's very simple :). My code generator is now debugged
enough to generate all the things required for the ManagedAsterisk and ast_mono runtime
to compile and allow access to a specific .h. Even the simple cli.h, which is
only 92 lines long, requires about 500 lines of output (C and C#) to be fully wiredup
(of course, this counts spacing and open/close braces).  <br /><br />
Anyways, a bit of tweaking the generated code (and applying the fixes to the generator),
it now compiles just fine without any warnings or errors. Yey.
</p>
        <img width="0" height="0" src="http://www.atrevido.net/blog/aggbug.ashx?id=a919e626-9144-4fec-9626-5a160960e460" />
      </body>
      <title>ast_mono - First class compiles!</title>
      <guid isPermaLink="false">http://www.atrevido.net/blog/PermaLink,guid,a919e626-9144-4fec-9626-5a160960e460.aspx</guid>
      <link>http://www.atrevido.net/blog/2004/11/24/astmono+First+Class+Compiles.aspx</link>
      <pubDate>Wed, 24 Nov 2004 07:18:18 GMT</pubDate>
      <description>&lt;p&gt;
I chose to expose cli.h, since it's very simple :). My code generator is now debugged
enough to generate all the things required for the ManagedAsterisk and ast_mono runtime
to compile and allow access to a specific .h. Even the simple&amp;nbsp;cli.h, which is
only 92 lines long, requires about 500 lines of output (C and C#) to be fully wiredup
(of course, this counts&amp;nbsp;spacing and open/close braces).&amp;nbsp;&amp;nbsp;&lt;br&gt;
&lt;br&gt;
Anyways, a bit of tweaking the generated code (and applying the fixes to the generator),
it now compiles just fine without any warnings or errors. Yey.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.atrevido.net/blog/aggbug.ashx?id=a919e626-9144-4fec-9626-5a160960e460" /&gt;</description>
      <comments>http://www.atrevido.net/blog/CommentView,guid,a919e626-9144-4fec-9626-5a160960e460.aspx</comments>
      <category>ast_mono</category>
    </item>
    <item>
      <trackback:ping>http://www.atrevido.net/blog/Trackback.aspx?guid=a0766978-f6b9-468c-98f1-a67302dbe6d6</trackback:ping>
      <pingback:server>http://www.atrevido.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.atrevido.net/blog/PermaLink,guid,a0766978-f6b9-468c-98f1-a67302dbe6d6.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://www.atrevido.net/blog/CommentView,guid,a0766978-f6b9-468c-98f1-a67302dbe6d6.aspx</wfw:comment>
      <wfw:commentRss>http://www.atrevido.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=a0766978-f6b9-468c-98f1-a67302dbe6d6</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
As mentioned before, one of the challenges of ast_mono is creating a “.NET-like”
library, when the underlying code is all C. Since there's no real grouping in the
C API other than which functions are in a certain header file, I don't have much
to go on. Here's a sample of the current thinking for the managed API:<br /><br /><strong>ManagedAsterisk.Core.Cli</strong><br />
  Contains the cli.h constants implemented as public static readonly fields.
The value is loaded in the .cctor via an internalcall that returns the constant. This
was done so that if a C constant is changed later on, recompiling the ast_mono runtime
will provide the new value to managed code, without any changes.<br />
  Also contains “static” functions, such as ast_cli_command, however,
renamed to Command (ManagedAsterisk.Core.Cli.Command).<br /><br /><strong>ManagedAsterisk.Core.Cli.Native</strong><br />
  This contains all the internalcall declarations to call the runtime wrapper
methods. For now, access is public to all the functions, such as ast_cli_command,
ast_cli_register and so on. Field accessors (see next) and constant accessors are
not accessible and must be accessed thru the respective classes. I'm not completely
sure on making this public, and might mark it internal instead (unless there's a good
reason that it needs to be public).<br /><br /><strong>ManagedAsterisk.Core.CliEntry</strong><br />
  This class is the managed version of struct ast_cli_entry. All the data is
kept in unmanaged memory, and only a pointer is kept in managed memory, using internalcalls
to access fields. It's constructed via new (heap allocated), or it's constructed by
passing a pointer. It has a manual free (IDisposable) method, but it's *not* finalizable.
This is because it's quite possible that the managed reference will go out of
scope while on the unmanaged side it might be still in use. Automatic finalization
(And hence a free) of it could easily cause Asterisk to segfault. Do note that
improper usage could lead to a memory leak, although in most cases.<br /><br />
  The fields, (char* usage, struct ast_cli_entry *next;, int inuse) are
all available as standard class properties. They are renamed to reflect that (public
string Usage{ get; set; }, etc.). Methods that take a struct ast_cli_entry* will take
a CliEntry class instead.<br /><br /><strong>ManagedAsterisk.Core.CliEntry.Native</strong><br />
  Private implementation details to get/set the data (something like ast_mono_wrapper_ast_cli_entry_set_usage).
Internalcalls set/get values, as well as enforce data limits (such as array
bounds -- no need to worry about buffer overflows). No plans to make publically
exposed.<br /><br />
---<br />
For files like channel.h, where there is a lot of both static and “instance”
methods, things will be put into one class, Core.Channel. There won't be a separate
Core.ChannelMethods or Core.ChannelClass. The cli.h just happened to lend itself to
this format.<br /><br />
Currently, the ast_mono code generator is in the final stage of taking the SWiG-generated
XML and producing the various declarations and wireup code required to make everything
work. This generated code will be heavily hand-edited before becoming part of the
ast_mono/ManagedAsterisk platform.
</p>
        <img width="0" height="0" src="http://www.atrevido.net/blog/aggbug.ashx?id=a0766978-f6b9-468c-98f1-a67302dbe6d6" />
      </body>
      <title>ast_mono - Phase 02 - Classes and Libraries</title>
      <guid isPermaLink="false">http://www.atrevido.net/blog/PermaLink,guid,a0766978-f6b9-468c-98f1-a67302dbe6d6.aspx</guid>
      <link>http://www.atrevido.net/blog/2004/11/21/astmono+Phase+02+Classes+And+Libraries.aspx</link>
      <pubDate>Sun, 21 Nov 2004 06:05:12 GMT</pubDate>
      <description>&lt;p&gt;
As mentioned before, one of the challenges of ast_mono is creating a &amp;#8220;.NET-like&amp;#8221;
library, when the underlying code is all C. Since there's no real grouping in the
C API other than which functions are in a certain header file,&amp;nbsp;I don't have much
to go on. Here's a sample of the current thinking for the managed API:&lt;br&gt;
&lt;br&gt;
&lt;strong&gt;ManagedAsterisk.Core.Cli&lt;/strong&gt;
&lt;br&gt;
&amp;nbsp; Contains the cli.h constants implemented as public static readonly fields.
The value is loaded in the .cctor via an internalcall that returns the constant. This
was done so that if a C constant is changed later on, recompiling the ast_mono runtime
will provide the new value to managed code, without any changes.&lt;br&gt;
&amp;nbsp; Also contains &amp;#8220;static&amp;#8221; functions, such as ast_cli_command, however,
renamed to Command (ManagedAsterisk.Core.Cli.Command).&lt;br&gt;
&lt;br&gt;
&lt;strong&gt;ManagedAsterisk.Core.Cli.Native&lt;/strong&gt;
&lt;br&gt;
&amp;nbsp; This contains all the internalcall declarations to call the runtime wrapper
methods. For now, access is public to all the functions, such as ast_cli_command,
ast_cli_register and so on. Field accessors (see next) and constant accessors are
not accessible and must be accessed thru the respective classes. I'm not completely
sure on making this public, and might mark it internal instead (unless there's a good
reason that it needs to be public).&lt;br&gt;
&lt;br&gt;
&lt;strong&gt;ManagedAsterisk.Core.CliEntry&lt;/strong&gt;
&lt;br&gt;
&amp;nbsp; This class is the managed version of struct ast_cli_entry. All the data is
kept in unmanaged memory, and only a pointer is kept in managed memory, using internalcalls
to access fields.&amp;nbsp;It's constructed via new (heap allocated),&amp;nbsp;or it's constructed&amp;nbsp;by
passing a pointer. It has a manual&amp;nbsp;free (IDisposable)&amp;nbsp;method, but it's *not*&amp;nbsp;finalizable.
This is&amp;nbsp;because it's quite possible that the managed reference will go out of
scope while on the unmanaged side it might be still&amp;nbsp;in use.&amp;nbsp;Automatic finalization
(And hence a free) of it could easily cause Asterisk to segfault.&amp;nbsp;Do note that
improper usage could lead to a memory leak, although in most cases.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;The fields, (char* usage, struct ast_cli_entry *next;, int inuse) are
all available as standard class properties. They are renamed to reflect that (public
string Usage{ get; set; }, etc.). Methods that take a struct ast_cli_entry* will take
a CliEntry class instead.&lt;br&gt;
&lt;br&gt;
&lt;strong&gt;ManagedAsterisk.Core.CliEntry.Native&lt;/strong&gt;
&lt;br&gt;
&amp;nbsp; Private implementation details to get/set the data (something like ast_mono_wrapper_ast_cli_entry_set_usage).
Internalcalls set/get values, as well as enforce data limits&amp;nbsp;(such as&amp;nbsp;array
bounds -- no need to worry about buffer overflows).&amp;nbsp;No plans to make publically
exposed.&lt;br&gt;
&lt;br&gt;
---&lt;br&gt;
For files like channel.h, where there is a lot&amp;nbsp;of both static and &amp;#8220;instance&amp;#8221;
methods, things will be put into one class, Core.Channel. There won't be a separate
Core.ChannelMethods or Core.ChannelClass. The cli.h just happened to lend itself to
this format.&lt;br&gt;
&lt;br&gt;
Currently, the ast_mono code generator is in the final stage of taking the SWiG-generated
XML and producing the various declarations and wireup code required to make everything
work. This generated code will be heavily hand-edited before becoming part of the
ast_mono/ManagedAsterisk platform.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.atrevido.net/blog/aggbug.ashx?id=a0766978-f6b9-468c-98f1-a67302dbe6d6" /&gt;</description>
      <comments>http://www.atrevido.net/blog/CommentView,guid,a0766978-f6b9-468c-98f1-a67302dbe6d6.aspx</comments>
      <category>ast_mono</category>
    </item>
    <item>
      <trackback:ping>http://www.atrevido.net/blog/Trackback.aspx?guid=8fadac68-6b4b-42ac-a9ca-b1b849f6b546</trackback:ping>
      <pingback:server>http://www.atrevido.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.atrevido.net/blog/PermaLink,guid,8fadac68-6b4b-42ac-a9ca-b1b849f6b546.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://www.atrevido.net/blog/CommentView,guid,8fadac68-6b4b-42ac-a9ca-b1b849f6b546.aspx</wfw:comment>
      <wfw:commentRss>http://www.atrevido.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=8fadac68-6b4b-42ac-a9ca-b1b849f6b546</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I was working on ast_mono tonight, and had to make some decisions on how the ManagedAsterisk
API would handle formatted (printf style) functions. 
<br /><br />
First, there's technical issues. printf functions use varargs. I'm not exactly sure
on how to forward and prototype these methods. I know IL supports varargs, but I don't
think that C# does. So, I'd end up doing a “params object[] args”
parameter. The issue is that my unmanaged runtime is then massed a set of pointers,
and would have to figure out what each item is to be able to format it correctly.
Still, it's possible.<br /><br />
Then the real issue comes into play. .NET APIs don't use printf style functions. To
many .NET programmers this style would seem foreign, and clash with other APIs. Since
one of the goals of ast_mono is to present an API that's consistent and feels like
any other .NET library, this is unacceptable. So, instead, I'm doing to use string.Format
to handle the formatting for these functions (such as ast_log). Yes, the functionality
is somewhat different, but overall it should provide a much better development experience
to ast_mono users.
</p>
        <img width="0" height="0" src="http://www.atrevido.net/blog/aggbug.ashx?id=8fadac68-6b4b-42ac-a9ca-b1b849f6b546" />
      </body>
      <title>ast_mono: printf functions</title>
      <guid isPermaLink="false">http://www.atrevido.net/blog/PermaLink,guid,8fadac68-6b4b-42ac-a9ca-b1b849f6b546.aspx</guid>
      <link>http://www.atrevido.net/blog/2004/11/14/astmono+Printf+Functions.aspx</link>
      <pubDate>Sun, 14 Nov 2004 04:45:08 GMT</pubDate>
      <description>&lt;p&gt;
I was working on ast_mono tonight, and had to make some decisions on how the ManagedAsterisk
API would handle formatted (printf style) functions. 
&lt;br&gt;
&lt;br&gt;
First, there's technical issues. printf functions use varargs. I'm not exactly sure
on how to forward and prototype these methods. I know IL supports varargs, but I don't
think that C# does. So, I'd end up doing a&amp;nbsp;&amp;#8220;params object[] args&amp;#8221;
parameter. The issue is that my unmanaged runtime is then massed a set of pointers,
and would have to figure out what each item is to be able to format it correctly.
Still, it's possible.&lt;br&gt;
&lt;br&gt;
Then the real issue comes into play. .NET APIs don't use printf style functions. To
many .NET programmers this style would seem foreign, and clash with other APIs. Since
one of the goals of ast_mono is to present an API that's consistent and feels like
any other .NET library, this is unacceptable. So, instead, I'm doing to use string.Format
to handle the formatting for these functions (such as ast_log). Yes, the functionality
is somewhat different, but overall it should provide a much better development experience
to ast_mono users.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.atrevido.net/blog/aggbug.ashx?id=8fadac68-6b4b-42ac-a9ca-b1b849f6b546" /&gt;</description>
      <comments>http://www.atrevido.net/blog/CommentView,guid,8fadac68-6b4b-42ac-a9ca-b1b849f6b546.aspx</comments>
      <category>ast_mono</category>
    </item>
    <item>
      <trackback:ping>http://www.atrevido.net/blog/Trackback.aspx?guid=3f409151-db81-4932-8502-c7592f645b4c</trackback:ping>
      <pingback:server>http://www.atrevido.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.atrevido.net/blog/PermaLink,guid,3f409151-db81-4932-8502-c7592f645b4c.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://www.atrevido.net/blog/CommentView,guid,3f409151-db81-4932-8502-c7592f645b4c.aspx</wfw:comment>
      <wfw:commentRss>http://www.atrevido.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=3f409151-db81-4932-8502-c7592f645b4c</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
As I mentioned a few posts ago, I have a makefile project in MSVC++ 8 (2005) setup.
Part of my solution builds with GCC on Linux, part on Windows with CSC. By using plink
(command-line version of Putty), I'm able to ssh over to my Linux machine and build.
The errors show up in the error list in VS2005. Except for one slight problem: Visual
Studio does not read the error line information correctly, resulting in an error if
I try to click and goto that line.<br /><br />
GCC outputs errors so: my.c:123: error: you suck. VS expects them as
my.c(1) : error you suck. So, I decided to write a filter for the output.
But, since it was around 2 AM, I decided to check and see if GCC supports out in the
style that VS expects. As far as I can tell, it doesn't. But, I found a link to a
page that has a program that accomplishes just this (GNU2MSDEV): <a href="http://www.xs4all.nl/~borkhuis/vxworks/vxw_pt1.html#1.13">http://www.xs4all.nl/~borkhuis/vxworks/vxw_pt1.html#1.13</a><br /><br />
Yey, I'm done, right? Well, not quite. GNU2MSDEV reads from stdin. GCC puts the errors
on stderr. So, the parser only gets part of the output, missing the critical parts.
Ouch. Now, since it's past my bedtime, I spent a while trying to figure out what was
going on, thinking perhaps the program was broken. Got the source, uncommented some
debugging stuff, and finally, I realised that I'd need to get stderr send over stdin,
as the easiest course of action. 
<br /><br />
I'm not sure how you redirect stderr in the NT command shell. One page I read said
this was impossible from the command line, and you need to use a different shell (they
suggested running Linux), or write a program to do it for you. I decided to just add
this to my linux commands. Now, my VS build command line looks like this:<br /><br />
plink 192.168.0.123 -ssh -l myUser -pw myPassword "cd /usr/src/something;make clean;
make install 2&gt;&amp;1;" | gnu2msdev<br /><br />
Presto. Now it works just perfectly, and I can double click the error list and go
right to the file/line where the error is. Of course, now it's 3AM for some reason,
and instead of writing some code to record phone calls, I'm instead going to go to
sleep.
</p>
        <img width="0" height="0" src="http://www.atrevido.net/blog/aggbug.ashx?id=3f409151-db81-4932-8502-c7592f645b4c" />
      </body>
      <title>GCC Visual Studio Integration</title>
      <guid isPermaLink="false">http://www.atrevido.net/blog/PermaLink,guid,3f409151-db81-4932-8502-c7592f645b4c.aspx</guid>
      <link>http://www.atrevido.net/blog/2004/11/04/GCC+Visual+Studio+Integration.aspx</link>
      <pubDate>Thu, 04 Nov 2004 09:02:41 GMT</pubDate>
      <description>&lt;p&gt;
As I mentioned a few posts ago, I have a makefile project in MSVC++ 8 (2005) setup.
Part of my solution builds with GCC on Linux, part on Windows with CSC. By using plink
(command-line version of Putty), I'm able to ssh over to my Linux machine and build.
The errors show up in the error list in VS2005. Except for one slight problem: Visual
Studio does not read the error line information correctly, resulting in an error if
I try to click and goto that line.&lt;br&gt;
&lt;br&gt;
GCC outputs errors so:&amp;nbsp;my.c:123: error:&amp;nbsp;you suck.&amp;nbsp;VS expects them as
my.c(1) :&amp;nbsp;error you suck.&amp;nbsp;So, I decided to write a filter for the output.
But, since it was around 2 AM, I decided to check and see if GCC supports out in the
style that VS expects. As far as I can tell, it doesn't. But, I found a link to a
page that has a program that accomplishes just this (GNU2MSDEV): &lt;a href="http://www.xs4all.nl/~borkhuis/vxworks/vxw_pt1.html#1.13"&gt;http://www.xs4all.nl/~borkhuis/vxworks/vxw_pt1.html#1.13&lt;/a&gt;
&lt;br&gt;
&lt;br&gt;
Yey, I'm done, right? Well, not quite. GNU2MSDEV reads from stdin. GCC puts the errors
on stderr. So, the parser only gets part of the output, missing the critical parts.
Ouch. Now, since it's past my bedtime, I spent a while trying to figure out what was
going on, thinking perhaps the program was broken. Got the source, uncommented some
debugging stuff, and finally, I realised that I'd need to get stderr send over stdin,
as the easiest course of action. 
&lt;br&gt;
&lt;br&gt;
I'm not sure how you redirect stderr in the NT command shell. One page I read said
this was impossible from the command line, and you need to use a different shell (they
suggested running Linux), or write a program to do it for you. I decided to just add
this to my linux commands. Now, my VS build command line looks like this:&lt;br&gt;
&lt;br&gt;
plink 192.168.0.123 -ssh -l myUser -pw myPassword "cd /usr/src/something;make clean;
make install 2&amp;gt;&amp;amp;1;" | gnu2msdev&lt;br&gt;
&lt;br&gt;
Presto. Now it works just perfectly, and I can double click the error list and go
right to the file/line where the error is. Of course, now it's 3AM for some reason,
and instead of writing some code to record phone calls, I'm instead going to go to
sleep.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.atrevido.net/blog/aggbug.ashx?id=3f409151-db81-4932-8502-c7592f645b4c" /&gt;</description>
      <comments>http://www.atrevido.net/blog/CommentView,guid,3f409151-db81-4932-8502-c7592f645b4c.aspx</comments>
      <category>ast_mono</category>
      <category>Code</category>
    </item>
    <item>
      <trackback:ping>http://www.atrevido.net/blog/Trackback.aspx?guid=4a0a4b05-81b2-4135-958c-b0904ff52d4d</trackback:ping>
      <pingback:server>http://www.atrevido.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.atrevido.net/blog/PermaLink,guid,4a0a4b05-81b2-4135-958c-b0904ff52d4d.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://www.atrevido.net/blog/CommentView,guid,4a0a4b05-81b2-4135-958c-b0904ff52d4d.aspx</wfw:comment>
      <wfw:commentRss>http://www.atrevido.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=4a0a4b05-81b2-4135-958c-b0904ff52d4d</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
As I was designing exactly how I was going to generate all the C# prototypes and basic
C implementations for my ast_mono internalcalls, I realised it'd be a bit more work
than I feel like doing, especially where there's already work done. I'm not looking
for a completely automated way to create code files that can be updated on-the-fly.
I think there will be a lot of customization going into each generated file, and I'm
comfortable with that. 
<br /><br />
So what I really want is a simple way to have some of my C# code emit some definitions
and code into two files (the C# prototype file and the C internalcall file). I don't
really care to actually process C header files all -- all I want is access to the
type definitions, even in a limited form. In taking a deeper look at SWiG, I found
that, lo-and-behold, it also emits its parse trees as XML if I so desire. Sweet. Now
I'll have a nicely packaged way to get at the type info of all the header files for
Asterisk. 
</p>
        <img width="0" height="0" src="http://www.atrevido.net/blog/aggbug.ashx?id=4a0a4b05-81b2-4135-958c-b0904ff52d4d" />
      </body>
      <title>Ok, maybe I'll take a small SWiG</title>
      <guid isPermaLink="false">http://www.atrevido.net/blog/PermaLink,guid,4a0a4b05-81b2-4135-958c-b0904ff52d4d.aspx</guid>
      <link>http://www.atrevido.net/blog/2004/10/26/Ok+Maybe+Ill+Take+A+Small+SWiG.aspx</link>
      <pubDate>Tue, 26 Oct 2004 07:20:26 GMT</pubDate>
      <description>&lt;p&gt;
As I was designing exactly how I was going to generate all the C# prototypes and basic
C implementations for my ast_mono internalcalls, I realised it'd be a bit more work
than I feel like doing, especially where there's already work done. I'm not looking
for a completely automated way to create code files that can be updated on-the-fly.
I think there will be a lot of customization going into each generated file, and I'm
comfortable with that. 
&lt;br&gt;
&lt;br&gt;
So what I really want is a simple way to have some of my C# code emit some definitions
and code into two files (the C# prototype file and the C internalcall file). I don't
really care to actually process C header files all -- all I want is access to the
type definitions, even in a limited form. In taking a deeper look at SWiG, I found
that, lo-and-behold, it also emits its parse trees as XML if I so desire. Sweet. Now
I'll have a nicely packaged way to get at the type info of all the header files for
Asterisk. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.atrevido.net/blog/aggbug.ashx?id=4a0a4b05-81b2-4135-958c-b0904ff52d4d" /&gt;</description>
      <comments>http://www.atrevido.net/blog/CommentView,guid,4a0a4b05-81b2-4135-958c-b0904ff52d4d.aspx</comments>
      <category>ast_mono</category>
    </item>
    <item>
      <trackback:ping>http://www.atrevido.net/blog/Trackback.aspx?guid=e265335c-8198-487a-9e79-51d2b6808a73</trackback:ping>
      <pingback:server>http://www.atrevido.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.atrevido.net/blog/PermaLink,guid,e265335c-8198-487a-9e79-51d2b6808a73.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://www.atrevido.net/blog/CommentView,guid,e265335c-8198-487a-9e79-51d2b6808a73.aspx</wfw:comment>
      <wfw:commentRss>http://www.atrevido.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=e265335c-8198-487a-9e79-51d2b6808a73</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Asterisk depends on quite a few structures, obviously :). One of my goals for ast_mono
is to make the API seem as .NET-friendly and standard as possible. This includes creating
a real object oriented API, rather than the C way (where you pass the structure in
as the first parameter). At runtime it'll be nearly the same thing, but it really
changes the whole of the API.<br /><br />
Before I can do any real function calls or library work, I need to have the base classes
defined: channels, files, etc. My first approach was the “nicest”. My
idea was to prototype the structures in C#, allowing direct access from the .NET runtime
to the structure, using C# unsafe code (i.e., ast_channel *myPtr; myPtr-&gt;language).
I'd rolle the unsafe code inside the class, so to an end-user, it'd appear as a normal
property. 
<br /><br />
However, I don't trust that all the structures in Asterisk will stay the same all
the time. If a field was added or moved around, I'd have to declare a whole different
prototype. To make things worse, I think it's entirely possible that there could
be some #defines that people change per-platform, and that there could be
multiple valid prototypes that I'd need to support (as part of the C# build process). My
goal is to ship a runtime that can be built on the target machine, but the C# API
should be able to be distributed in binary form without any issues. One main goal
of this is that building ast_mono won't require a C# compiler. The IL binaries should
be fully portable by themselves.<br /><br />
So, despite the advantages and elegancy of being able to access the structures with
pure managed code, it's not going to happen. I checked out <a href="http://www.swig.org">SWiG</a>,
and it's quite powerful. SWiG allows you to take C/C++ headers and turn them into
definitions for C#, Java, Perl, and a slew of others. I might possibly be able to
use this tool as a basis for my app. 
<br /><br />
For C#, SWiG creates a class that takes a pointer to the unmanaged structure. Then
it generates properties in C# that call P/Invoke methods on a C class it generates.
So to access the language field of ast_channel, the get property accessor P/Invokes
to ast_channel_get_language. This is OK. However, I believe it can be done better
using internalcalls. 
<br /><br />
Mono allows a runtime host to register internalcalls. Internalcalls run as part of
the runtime, and have access to the native .NET types. This removes the need for marshalling
to those calls: a big plus. Obviously there will still be some marshalling needed
for some types (i.e. taking a null-terminated ANSI string and creating a .NET string),
but it'll be easier to work with. For the performance and flexibility of doing things
this way, I think it's worth the bit of extra work to write a small program to generate
some of the wrapper code for me instead of using SWiG. (I also am not very fond of
the code generated by SWiG.) Also, I should be able to grab the comments from the
headers and generate some basic XML docs.<br /><br />
Methods are quite a bit simpler, with the same basic principles applying. I'll extend
my code to emit some basic definitions (C# prototypes + basic C Mono implementations)
and that should get me going. 
<br /><br />
On a side note, although right now I'm sticking to the ISO spec of C#, Mono 1.2 has
support for many of Whidbey's features. This means I get to use generics soon. Also,
I am going to be compiling with the Whidbey C# compiler, so compile-time only features,
such as partial classes, are available too. Yum :).
</p>
        <img width="0" height="0" src="http://www.atrevido.net/blog/aggbug.ashx?id=e265335c-8198-487a-9e79-51d2b6808a73" />
      </body>
      <title>ast_mono - Phase 01 - Structures</title>
      <guid isPermaLink="false">http://www.atrevido.net/blog/PermaLink,guid,e265335c-8198-487a-9e79-51d2b6808a73.aspx</guid>
      <link>http://www.atrevido.net/blog/2004/10/26/astmono+Phase+01+Structures.aspx</link>
      <pubDate>Tue, 26 Oct 2004 03:50:43 GMT</pubDate>
      <description>&lt;p&gt;
Asterisk depends on quite a few structures, obviously :). One of my goals for ast_mono
is to make the API seem as .NET-friendly and standard as possible. This includes creating
a real object oriented API, rather than the C way (where you pass the structure in
as the first parameter). At runtime it'll be nearly the same thing, but it really
changes the whole of the API.&lt;br&gt;
&lt;br&gt;
Before I can do any real function calls or library work, I need to have the base classes
defined: channels, files, etc. My first approach was the &amp;#8220;nicest&amp;#8221;. My
idea was to prototype the structures in C#, allowing direct access from the .NET runtime
to the structure, using C# unsafe code (i.e., ast_channel *myPtr; myPtr-&amp;gt;language).
I'd rolle the unsafe code inside the class, so to an end-user, it'd appear as a normal
property. 
&lt;br&gt;
&lt;br&gt;
However, I don't trust that all the structures in Asterisk will stay the same all
the time. If a field was added or moved around, I'd have to declare a whole different
prototype.&amp;nbsp;To make things worse, I think it's entirely possible that there could
be some&amp;nbsp;#defines that people change&amp;nbsp;per-platform, and that there could be
multiple valid prototypes&amp;nbsp;that I'd need to support (as part of the C# build process).&amp;nbsp;My
goal is to ship a runtime that can be built on the target machine, but the C# API
should be able to be distributed in binary form without any issues. One main goal
of this is that building ast_mono won't require a C# compiler. The IL binaries should
be fully portable by themselves.&lt;br&gt;
&lt;br&gt;
So, despite the advantages and elegancy of being able to access the structures with
pure managed code, it's not going to happen. I checked out &lt;a href="http://www.swig.org"&gt;SWiG&lt;/a&gt;,
and it's quite powerful. SWiG allows you to take C/C++ headers and turn them into
definitions for C#, Java, Perl, and a slew of others. I might possibly be able to
use this tool as a basis for my app. 
&lt;br&gt;
&lt;br&gt;
For C#, SWiG creates a class that takes a pointer to the unmanaged structure. Then
it generates properties in C# that call P/Invoke methods on a C class it generates.
So to access the language field of ast_channel, the get property accessor P/Invokes
to ast_channel_get_language. This is OK. However, I believe it can be done better
using internalcalls. 
&lt;br&gt;
&lt;br&gt;
Mono allows a runtime host to register internalcalls. Internalcalls run as part of
the runtime, and have access to the native .NET types. This removes the need for marshalling
to those calls: a big plus. Obviously there will still be some marshalling needed
for some types (i.e. taking a null-terminated ANSI string and creating a .NET string),
but it'll be easier to work with. For the performance and flexibility of doing things
this way, I think it's worth the bit of extra work to write a small program to generate
some of the wrapper code for me instead of using SWiG. (I also am not very fond of
the code generated by SWiG.) Also, I should be able to grab the comments from the
headers and generate some basic XML docs.&lt;br&gt;
&lt;br&gt;
Methods are quite a bit simpler, with the same basic principles applying. I'll extend
my code to emit some basic definitions (C# prototypes + basic C Mono implementations)
and that should get me going. 
&lt;br&gt;
&lt;br&gt;
On a side note, although right now I'm sticking to the ISO spec of C#, Mono 1.2 has
support for many of Whidbey's features. This means I get to use generics soon. Also,
I am going to be compiling with the Whidbey C# compiler, so compile-time only features,
such as partial classes, are available too. Yum :).
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.atrevido.net/blog/aggbug.ashx?id=e265335c-8198-487a-9e79-51d2b6808a73" /&gt;</description>
      <comments>http://www.atrevido.net/blog/CommentView,guid,e265335c-8198-487a-9e79-51d2b6808a73.aspx</comments>
      <category>ast_mono</category>
    </item>
    <item>
      <trackback:ping>http://www.atrevido.net/blog/Trackback.aspx?guid=07f05ef4-ebd2-496f-86c8-3195075699dc</trackback:ping>
      <pingback:server>http://www.atrevido.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.atrevido.net/blog/PermaLink,guid,07f05ef4-ebd2-496f-86c8-3195075699dc.aspx</pingback:target>
      <dc:creator />
      <wfw:comment>http://www.atrevido.net/blog/CommentView,guid,07f05ef4-ebd2-496f-86c8-3195075699dc.aspx</wfw:comment>
      <wfw:commentRss>http://www.atrevido.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=07f05ef4-ebd2-496f-86c8-3195075699dc</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Asterisk (<a href="http://www.asterisk.org">www.asterisk.org</a>), is a piece of extremely
powerful VoIP/PBX software. It can bridge just about any codec (u/aLaw, G.729, G.xxx,
GSM) and protocol (SIP, SCCP, H323, and it's own IAX). Plus it's got a ton of cool
features and is extensible. The only downside is that for maximum power, you must
use the C API. For some people, this means low productivity. For others, it means
forgetting about having great flexibility and power.<br /><br />
I like C#, and I want to write most of my code in C#. But, I'm also going to be writing
a lot of code for Asterisk. So, I'm doing the only sensible thing: Embed Mono (<a href="http://www.go-mono.com">www.go-mono.com</a>)
into Asterisk and load my .NET assemblies from there, while exposing the complete
Asterisk C API to my .NET applications. (In other words, much more than just spawning
a new process and passing args and reading stdout).<br /><br />
Well, after spending 2 days trying to get Mono to work and my code to link to it,
I finally got things working (without formatting and laying down Fedora Core 2!).
Nothing much yet, but I got a sample program to be loaded into the Asterisk process,
and I executed by dialing an extension. Now I just need to complete the API, enhance
the loader, and do everything else, and I'll have a very solid project.<br /><br />
If you use Asterisk and would like to write with C#, contact me (mgg @ this domain
.com). I'm also in #asterisk on irc.freenode.org as AgiNamu. 
<br /><br />
Or, if you like Microsoft and .NET, but want to get into VoIP, drop me a line. I haven't
seen any real solutions that compete against Asterisk for Win32 (or Win64).<br /></p>
        <img width="0" height="0" src="http://www.atrevido.net/blog/aggbug.ashx?id=07f05ef4-ebd2-496f-86c8-3195075699dc" />
      </body>
      <title>ast_mono_loader -- Embedding Mono into Asterisk - Phase 00</title>
      <guid isPermaLink="false">http://www.atrevido.net/blog/PermaLink,guid,07f05ef4-ebd2-496f-86c8-3195075699dc.aspx</guid>
      <link>http://www.atrevido.net/blog/2004/10/17/astmonoloader+Embedding+Mono+Into+Asterisk+Phase+00.aspx</link>
      <pubDate>Sun, 17 Oct 2004 00:41:52 GMT</pubDate>
      <description>&lt;p&gt;
Asterisk (&lt;a href="http://www.asterisk.org"&gt;www.asterisk.org&lt;/a&gt;), is a piece of extremely
powerful VoIP/PBX software. It can bridge just about any codec (u/aLaw, G.729, G.xxx,
GSM) and protocol (SIP, SCCP, H323, and it's own IAX). Plus it's got a ton of cool
features and is extensible. The only downside is that for maximum power, you must
use the C API. For some people, this means low productivity. For others, it means
forgetting about having great flexibility and power.&lt;br&gt;
&lt;br&gt;
I like C#, and I want to write most of my code in C#. But, I'm also going to be writing
a lot of code for Asterisk. So, I'm doing the only sensible thing: Embed Mono (&lt;a href="http://www.go-mono.com"&gt;www.go-mono.com&lt;/a&gt;)
into Asterisk and load my .NET assemblies from there, while exposing the complete
Asterisk C API to my .NET applications. (In other words, much more than just spawning
a new process and passing args and reading stdout).&lt;br&gt;
&lt;br&gt;
Well, after spending 2 days trying to get Mono to work and my code to link to it,
I finally got things working (without formatting and laying down Fedora Core 2!).
Nothing much yet, but I got a sample program to be loaded into the Asterisk process,
and I executed by dialing an extension. Now I just need to complete the API, enhance
the loader, and do everything else, and I'll have a very solid project.&lt;br&gt;
&lt;br&gt;
If you use Asterisk and would like to write with C#, contact me (mgg @ this domain
.com). I'm also in #asterisk on irc.freenode.org as AgiNamu. 
&lt;br&gt;
&lt;br&gt;
Or, if you like Microsoft and .NET, but want to get into VoIP, drop me a line. I haven't
seen any real solutions that compete against Asterisk for Win32 (or Win64).&lt;br&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.atrevido.net/blog/aggbug.ashx?id=07f05ef4-ebd2-496f-86c8-3195075699dc" /&gt;</description>
      <comments>http://www.atrevido.net/blog/CommentView,guid,07f05ef4-ebd2-496f-86c8-3195075699dc.aspx</comments>
      <category>ast_mono</category>
    </item>
  </channel>
</rss>