Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there parallels to Asterisk AMI and AGI in FreeSWITCH?

Asterisk has Asterisk Manager Interface (AMI) and Asterisk Gateway Interface (AGI), using which one can trigger PHP scripts at certain events from Asterisk. Using the same PHP scripts can also instruct Asterisk what to do next to a call/conference. Are there parallels to AMI and AGI in FreeSWITCH?

like image 601
jeff musk Avatar asked Dec 29 '11 00:12

jeff musk


People also ask

Is FreeSWITCH based on Asterisk?

It's interesting to note that FreeSWITCH was in fact developed as an attempt by a reputable Asterisk developer to tackle some of the perceived issues with Asterisk software. This led to a ground-up rebuild of what eventually became known as FreeSWITCH.


3 Answers

These are good questions. I just wanted to add a few things to what @dkwiebe said (which is correct, BTW).

The AMI equivalent in FreeSWITCH is the event socket. (Technically it's not the "Event Socket Library" or ESL, which is an abstraction layer for writing programs that use the event socket. I just wanted to make that distinction.) In fact, the FreeSWITCH equivalent of "asterisk -r" is actually an ESL-based program called "fs_cli" - short for FreeSWITCH Command Line Interface. The fs_cli program is a great example of what you can accomplish with ESL.

Also, there is no reason that you cannot use an ESL program to do many of the things that can be done with AGI scripts. The ESL "connection object" can "lock on" to a single call leg and control it. There are examples on the wiki and the forthcoming FreeSWITCH Cookbook will have some recipes on the subject. (Full disclosure: I am a co-author of the FreeSWITCH Cookbook.)

Another ESL-related method of controlling calls like AGI is with the fs_ivrd daemon. It's less commonly used than ESL but is a nice option for AGI-like scripting. See this wiki page for more details.

Lastly, I would like to mention that Lua is a great choice for doing scripting/logic/etc. in call control. It is simple, light, and easy to learn. In the lab we've seen a few thousand concurrent Lua-controlled calls on an 8-core machine. Lua works even in some very demanding environments.

Feel free to join #freeswitch on irc.freenode.net to discuss your questions with the FreeSWITCH community.

like image 118
Michael Collins Avatar answered Sep 22 '22 22:09

Michael Collins


There's a page on the FreeSWITCH wiki addressing most of these "Asterisk to FreeSWITCH" questions: Rosetta Stone.

like image 35
hdiogenes Avatar answered Sep 20 '22 22:09

hdiogenes


AGI are for scripts used durring a call (i.e. called from dialplan durrign dialplan execution). Scripts that listen to the AMI and wait for events are standalone. While that latter, can, technically, do the former's job as well, you are much better off keeping them separate.

like image 36
Mbrevda Avatar answered Sep 19 '22 22:09

Mbrevda