@miconda , Yes i am adding and removing on the fly. I am adding(using ka_add_destination)
to KA list on successful registration and removing(using ka_del_destination) when
registration expires.
```
#####################KEEPALIVE#######################################
modparam("keepalive", "ping_interval", 20)
modparam("keepalive", "delete_counter", 5)
modparam("keepalive", "ping_from", "sip:keepalive@fromsbc")
request_route {
##ON RECIEVING OPTIONS FROM KA MODULE ON 9090 PORT, Set $du using handle_ruri_alias ,
replace tp with transport and relay it to edge proxy from which we recieved register
packet
if ($Rp == "9090" && is_method("OPTIONS")){
if (t_newtran()) {
if (handle_ruri_alias()){
$avp(request_uri)= $ru ;
$avp(pb-ip)=$(avp(request_uri){param.value,pb-ip});
if (is_ipv6($avp(pb-ip))) {
if
(subst_uri('/^sip:(.*)@(.*);pb-ip=(.*);pb-pt=(.*);tp=(.*)$/sip:\1@[\3]:\4;pb-ip=\3;pb-pt=\4;transport=\5/i')){
xlog("L_INFO","(KA OPTIONS) : ($avp(uuid)) : Destination URI <$du>
created from alias.");
t_relay();
}
} else {
if
(subst_uri('/^sip:(.*)@(.*);pb-ip=(.*);pb-pt=(.*);tp=(.*)$/sip:\1@\3:\4;pb-ip=\3;pb-pt=\4;transport=\5/i')){
xlog("L_INFO","(KA OPTIONS) : ($avp(uuid)) : Destination URI <$du>
created from alias.");
t_relay();
}
}
}
exit;
}
$du=sip:APPLICATION_SERVER_IP:5060; ##IP of application server ( Freeswitch) to which
kamailio will relay register packet add_contact_alias();
t_on_reply("reply_register")
if (!t_relay()) {
sl_reply_error();
}
exit;
}
onreply_route[reply_register ]{
if ((status=~"200") && $rm=="REGISTER" &&
$(avp(c_ct){param.value,expires}) != 0)
{
## On receiving fresh registration (i.e with expires !=0) , Kamailio will register a
contact address for that registration in KA module ping registry.
$avp(ka_contact) =
'sip:'+$fU+'@LOCAL_IP:9090;alias='+$(avp(c_ct){param.value,alias})+';pb-ip='+$(avp(c_ct){param.value,pb-ip})+';pb-pt='+$(avp(c_ct){param.value,pb-pt})+';tp='+$(avp(c_ct){param.value,transport}{s.rm,>});
ka_add_destination("$avp(ka_contact)","config");
}
if ((status=~"200") && $rm=="REGISTER" &&
$(avp(c_ct){param.value,expires}) == 0)
{
$avp(ka_contact) =
'sip:'+$fU+'@LOCAL_IP:9090;alias='+$(avp(c_ct){param.value,alias})+';pb-ip='+$(avp(c_ct){param.value,pb-ip})+';pb-pt='+$(avp(c_ct){param.value,pb-pt})+';tp='+$(avp(c_ct){param.value,transport}{s.rm,>});
ka_del_destination("$avp(ka_contact)","config");
}
}
```
@NGSegovia , I am adding destinations from CFG file.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2448#issuecomment-683752918