AMQP is an open standard for messaging middleware. It was developed by a working group interested in creating a standard for business messaging, because in the past only proprietary, expensive solutions existed. AMQP is now used in many software solutions, from Banking Sector to Cloud Computing. Its main advantages as a messaging protocol are its reliability, performance and flexibility. This means that two entities can send messages between them and it is possible to guarantee not only the actual delivery, but also the delivery time. For some industry sectors this is a vital feature, just imagine that a buy/sell stock action is delayed in a stock exchange application. I am sure that the investor will not understand that software made him lose millions. 🙂
Unlike other protocols that were developed with specific applications in mind, AMQP is also much more flexible. Flexibility comes from the entities it defines for sending and receiving messages and the complex architectures that can be created by combining them:
– Exchanges: the entities to which messages are sent. They distribute the messages to all connected parties that pass a certain filter.
– Queues: the entities that receive messages and queue them. They distribute the messages to the connected parties in the order they were queued.
– Bindings: the relationship between a queue and an exchange that filters the messages. This makes queues receive only the messages it is interested in.
VoipNow uses AMQP for building a highly reliable, distributed architecture that eventually is exposed to developers as CallAPI. CallAPI pretty much hides the complexity of the architecture (after all it’s a REST API, easy to use), but internal communication is made using AMQP. It is this protocol that allows you to interact with the Asterisk PBX engine. As you probably know, Asterisk has a manager interface called AMI. Unfortunately, this manager interface is doomed from the architecture standpoint because:
– it is not distributed
– it does not do routing for events, everything is broadcasted
– it is slow and not scalable, has a lot of overhead
– it uses a non standard protocol
– actions have different outcome based on the dialplan running
– it is pretty much synchronous, requires opened connections
– authentication and authorization are hideous.
In fact, there are even more issues with this interface, but these are a bit harder to explain. That’s why in VoipNow Professional 2.5.0 we added the AMQP API Interface and starting with VoipNow 2.6.0 we will remove the Asterisk AMI totally. As you probably know, Asterisk is just an internal component of the VoipNow Professional, developers never interact with the Asterisk, but with the APIs that provide direct access to functionality. Therefore, we will keep expanding CallAPI with new methods.
This technology is part of the VoipNow cloud commitment – it allows CallAPIs to process hundreds of thousands of commands per second in a distributed environment. For us it’s very important how developers interact with VoipNow, that’s why we didn’t want to make them do anything we wouldn’t do. The CallAPI REST interface is easy to use; it is capable of many interesting things and its OAuth authorization capabilities allow multiple third-party applications to interact with VoipNow using the same VoipNow account.
VoipNow uses an AMQP server, RabbitMQ, which is a highly available, scalable and robust server developed in Erlang. We tested the most important AMQP servers on the market and we can confirm that RabbitMQ is the best server available, so if you have a project where you think that AMQP is a good choice, we suggest you to use it.