AGI
AGI is Asterisk Gateway interface. It can be used to extend asterisk functionalities with help of different programming/scripting languages like C#, Perl, PHP etc.
According to VoIp-info.org
- AGI may control the dialplan, called in extensions.conf
- EAGI gives the application the possibility to access and control the sound channel in addition to interaction with the dial plan
- FastAGI can be used to do the processing on a remote machine
- DeadAGI gives access to a dead channel, after hang-up.
Basically there are few commands exposed by AGI and give programmers the power to enjoy Asterisk facilities with language of their own choice.
You can take complete list of AGI commands from HERE.
If you are a C# programmer then the source code of C# dll can be found at Gundy’s blog. His blog is a really good help to start. I should thank Gabriel from here because with his help and excellent startup material in his site I could develop a couple of cool applications using AGI.
Startup
For start the first thing you need to have installed in your box is Mono Tone. That is an open source project to use .NET Framework in Linux.
You can download Mono-Tone from http://www.mono-project.com/Downloads.
After installing you can use .NET assemblies and execute .exe files. You can compile any C# files with – mcs command line which is equivalent to csc in Windows. And you can run .exe file with mono command. But wait! Don’t go too fast because although you can run .exe file using mono command in Mono Project but AGI won’t execute your executables using mono. Asterisk and your .NET assembly share same console so you need to pass data from your program directly to Asterisk. You need to do some configurations to be able to run .NET assemblies directly and without mono command. For that you need to configure your binfmt. You can find the configuration HERE. (Find solution under Can I run Mono applications without using 'mono program.exe'?
After that if you plan to restart your box in order to have same configuration after entry you need to add same configuration to /etc/rc.local
You need to place monotone.dll and your .net assemblies in /var/lib/asterisk/agi-bin/ and your sound files (in .gsm format) in /var/lib/asterisk/sounds/.
Now you are ready to start with your first program.