Change port of Keep Alive reply in Kamailio

From Integrics Wiki
Jump to: navigation, search

Typically Kamailio sends the reply to a Keep Alive message to the port specified in the Contact: header.

In cases where it is preferred to have the reply to the source port of the Keep Alive message, the following part of Kamailio configuration can be changed from:

# Catch typical keep alive requests from SIP devices
if(is_method("OPTIONS") && uri==myself && $rU==$null) {
  sl_send_reply("200", "Keepalive");
  exit;
}

to

# Catch typical keep alive requests from SIP devices
if(is_method("OPTIONS") && uri==myself && $rU==$null) {
  force_rport();
  sl_send_reply("200", "Keepalive");
  exit;
}