It possible to write an AGI script in C?


#1

I need to call a program written in “C” from a dialplan. I assume there’s sa way to do this with AGI, but all the examples I’ve seen use an interpreted language (PHP, Perl, Python). Is it possible to write an AGI script in C? Any examples?

Thanks.


#2

Sure this is possible. If you dont want to implemet it at the lowest level have a look at some library that provides a nicer C interface
for example: http://sourceforge.net/projects/cagi/
(disclaimer: i haven’t used that one so i dont know if it works well)

There is another C-library that looked nice and supports AGI and the Manager API but i dont find a reference and it seems to have disappeared from the wiki. Maybe someone else here remembers.

Other than that you can quite easily write a native Asterisk application in C. Have a look at the apps/ subdir of your Asterisk source tree - there are tons of well-known examples (from app_echo to app_voicemail).