SIPSorcery.SIPRegistrar.SIPRegistrarDaemon.SendNATKeepAlive C# (CSharp) Method

SendNATKeepAlive() private method

This event handler is fired when the SIP Registrar wants to send a NATKeepAlive message to a user contact to make an attempt to keep the connection open through the user's NAT server. In this case the NATKeepAlive messages are forwarded onto the NATKeepAlive relay which requests the SIPTransport layer to multiplex a 4 byte null payload onto one of its sockets and send to the specified agent. A typical scenario would have the SIP Registrar firing this event every 15s to send the null payloads to each of its registered contacts.
private SendNATKeepAlive ( SIPSorcery.Servers.NATKeepAliveMessage keepAliveMessage ) : void
keepAliveMessage SIPSorcery.Servers.NATKeepAliveMessage
return void
        private void SendNATKeepAlive(NATKeepAliveMessage keepAliveMessage)
        {
            try
            {
                byte[] buffer = keepAliveMessage.ToBuffer();
                m_natKeepAliveSender.Send(buffer, buffer.Length, m_natKeepAliveRelaySocket);
            }
            catch (Exception natSendExcp)
            {
                logger.Warn("Exception SendNATKeepAlive " + keepAliveMessage.RemoteEndPoint + ". " + natSendExcp.Message);
            }
        }