Hello Team,
We are using Kamailio 5.4.7 (DMQ + Presence) modules. We want to replicate
all subscribe from server-1(Presence) to server-2(Presence).Replication
worked perfectly fine but we noticed that after replicate the subscribe
event both the presence server are generating the NOTIFY which should not.
Can you please guide us where we made the mistake or how we can just
replicate the subscribe information to other server using DMQ module?
Please find the configuration
SERVER-1 (Presence)
========================
### presence_dialoginfo params ###
modparam("presence_dialoginfo", "force_single_dialog", 1)
######## presence params #########
modparam("presence", "db_table_lock_type", 0)
modparam("presence", "db_url", DBURL_LOCAL)
modparam("presence", "db_update_period", 30)
modparam("presence", "send_fast_notify", 1)
modparam("presence", "clean_period", 100)
modparam("presence", "subs_db_mode", 3)
modparam("presence", "timeout_rm_subs", 0) //new/
modparam("presence", "notifier_poll_rate", 20) //new//
modparam("presence", "waitn_time",1)
modparam("presence", "fetch_rows", 1000)
modparam("presence", "presentity_table", "presentity")
modparam("presence", "active_watchers_table",
"active_watchers")
modparam("presence", "watchers_table", "watchers")
modparam("presence", "max_expires", 3600)
modparam("presence", "server_address",
"sip:presence@VAR_LOCAL_IP:SIP_PORT")
modparam("presence", "notifier_processes", 0)
modparam("presence", "publ_cache", 1)
modparam("presence", "subs_htable_size", 15)
modparam("presence", "pres_htable_size", 15)
modparam("presence", "delete_same_subs", 1)
modparam("presence", "timer_mode", 0)
modparam("presence", "force_delete", 1)
modparam("presence", "enable_dmq", 1)
######## presence_xml params ######
modparam("presence_xml", "db_url", DBURL_LOCAL)
modparam("presence_xml", "force_active", 1)
#modparam("presence_xml", "disable_presence",1)
#--- dmq db param ----
modparam("dmq","server_address","sip:VAR_LOCAL_IP:SIP_PORT")
modparam("dmq", "notification_address", DMQ_NOTIFY_ADDR1)
modparam("dmq", "num_workers", 4)
modparam("dmq", "multi_notify", 1)
modparam("dmq", "ping_interval", 60)
if(is_method("KDMQ")) {
dmq_handle_message();
}
route[HANDLE_PRESENCE] {
if (! t_newtran())
{
sl_reply_error();
exit;
}
if(is_method("PUBLISH"))
{
if ($hdr(Event) == "message-summary") {
if($hdr(P-Flags)=~"1") {
remove_hf("Event");
append_hf("Event: dialog\r\n");
msg_apply_changes();
remove_hf("Content-Type");
append_hf("Content-Type:
application/dialog-info+xml\r\n");
msg_apply_changes();
}
}
if((search_hf("To", "queue+", "a"))
&&
is_present_hf("SIP-If-Match")){
remove_hf("SIP-If-Match");
msg_apply_changes();
}
xlog("L_ERR","(xhttp:request) : HANDLE_PUBLISH_FUN
\n");
handle_publish();
t_release();
} else if( is_method("SUBSCRIBE")) {
handle_subscribe();
if(!dmq_is_from_node()) dmq_t_replicate();
t_release();
}
exit;
}
SERVER-2 (Presence)
======================
### presence_dialoginfo params ###
modparam("presence_dialoginfo", "force_single_dialog", 1)
######## presence params #########
modparam("presence", "db_table_lock_type", 0)
modparam("presence", "db_url", DBURL_LOCAL)
modparam("presence", "db_update_period", 30)
modparam("presence", "send_fast_notify", 1)
modparam("presence", "clean_period", 100)
modparam("presence", "subs_db_mode", 3)
modparam("presence", "timeout_rm_subs", 0) //new/
modparam("presence", "notifier_poll_rate", 20) //new//
modparam("presence", "waitn_time",1)
modparam("presence", "fetch_rows", 1000)
modparam("presence", "presentity_table", "presentity")
modparam("presence", "active_watchers_table",
"active_watchers")
modparam("presence", "watchers_table", "watchers")
modparam("presence", "max_expires", 3600)
modparam("presence", "server_address",
"sip:presence@VAR_LOCAL_IP:SIP_PORT")
modparam("presence", "notifier_processes", 0)
modparam("presence", "publ_cache", 1)
modparam("presence", "subs_htable_size", 15)
modparam("presence", "pres_htable_size", 15)
modparam("presence", "delete_same_subs", 1)
modparam("presence", "timer_mode", 0)
modparam("presence", "force_delete", 1)
modparam("presence", "enable_dmq", 1)
######## presence_xml params ######
modparam("presence_xml", "db_url", DBURL_LOCAL)
modparam("presence_xml", "force_active", 1)
#modparam("presence_xml", "disable_presence",1)
#--- dmq db param ----
modparam("dmq","server_address","sip:VAR_LOCAL_IP:SIP_PORT")
modparam("dmq", "notification_address", DMQ_NOTIFY_ADDR1)
modparam("dmq", "num_workers", 4)
modparam("dmq", "multi_notify", 1)
modparam("dmq", "ping_interval", 60)
if(is_method("KDMQ")) {
dmq_handle_message();
}
route[HANDLE_PRESENCE] {
if (! t_newtran())
{
sl_reply_error();
exit;
}
if(is_method("PUBLISH"))
{
if ($hdr(Event) == "message-summary") {
if($hdr(P-Flags)=~"1") {
remove_hf("Event");
append_hf("Event: dialog\r\n");
msg_apply_changes();
remove_hf("Content-Type");
append_hf("Content-Type:
application/dialog-info+xml\r\n");
msg_apply_changes();
}
}
if((search_hf("To", "queue+", "a"))
&&
is_present_hf("SIP-If-Match")){
remove_hf("SIP-If-Match");
msg_apply_changes();
}
xlog("L_ERR","(xhttp:request) : HANDLE_PUBLISH_FUN
\n");
handle_publish();
t_release();
} else if( is_method("SUBSCRIBE")) {
handle_subscribe();
if(!dmq_is_from_node()) dmq_t_replicate();
t_release();
}
exit;
}
version: kamailio 5.4.7 (x86_64/linux) a19fe1
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE,
USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC,
TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT,
USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST,
HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024,
BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: a19fe1
compiled on 00:05:09 Oct 21 2021 with gcc 8.3.0
--
Hardik Patel