OpenSIPS/opensips — pull request #100 by franklyfox (2013-10-04 15:40:24+00:00)
Title: enable rabbitmq heartbeat to solve issues of hanging SIP processing because of a broken amqp socket

This implementation enabled the rabbitmq's client side's heartbeat negotiation.
Issue:
Because of TCP's nature, it takes very long time for a TCP peer to make the decision of closing a local socket when the connection actually is broken. The event_rabbitmq module didn't handle the situation which causes the Opensips1.9 stop processing UDP packets until the O.S decides to close the local socket. One of the consequence is that UAC cannot register to the registrar during this time period.

Issue Reproduce:
1. Block an existing amqp connection from the rabbitmq-server that event_rabbitmq module connects to.
2. From the event_rabbitmq side, the UDP receive-buffer that Opensips uses should be full.

Solution:
If the module, even_rabbitmq/rabbitmq-client, doesn't get a heartbeat message from the rabbitmq-server within X seconds, the rabbitmq-client will kill the local socket connection actively.

Added a modparam:

modparam("event_rabbitmq", "heartbeat", [X seconds]