Please check the return value of save and replace the logic: -
$var(save_result) = save("location") ;
if ($var(save_result) <= -1) {
xlogl("L_ERROR", "[$rm] -> Unable to save user location \n");
sl_reply_error();exit();
}
if ($var(save_result) == 1) {
xlogl("L_INFO", "[$rm] -> dumping messages with MSILO \n");
# MSILO - dumping user's offline messages to user
if (m_dump("$fu")) {
xlogl("L_NOTICE", "MSILO: offline messages for $fu dumped - if they were \n");
}
else {
xlogl("L_NOTICE", "MSILO: no offline messages dumped \n");
};
}
This means dump the message only when it is not re-registration.
Thanks
Regards
Muhammad Zaka
From: sr-users [mailto:sr-users-bounces@
lists.kamailio.org ] On Behalf Of Abdul Basit
Sent: 08 April 2018 18:43
To: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org>; Kamailio (SER) - Users Mailing List <sr-users@lists.sip-router.org>
Subject: Re: [SR-Users] MSILO: SIP stored offline MESSAGE repetitive delivery
Dear Team,
Still stuck with the issue. Kindly suggest where i did wrong.
--
regards,
abdul basit | p: +92 32 1416 4196 | o: +92 30 0841 1445
On 6 April 2018 at 20:50, Abdul Basit <basit.engg@gmail.com> wrote:
Hi team,
I am facing an issue while setting up IM server based on kamailio.
SIP-SIP online messaging is fine. For offline messaging i am using msilo module which is storing offline messages in 'silo' table.
As B-party come online ... it receive offline messages stored in database. But
Problem is.. these messages will deliver to B-party as many time it REGISTER online.
How can I configure msilo module to mark messages delivery status?
or how can i delete the delivered messages so that there will be no chance of delivering them again on next REGISTER?Message parts of kamailio.cfg are
....
/* add local domain aliases */
alias="192.168.10.18"
port=9060
# ----- msilo params -----
modparam("msilo", "db_url", DBURL)
modparam("msilo", "db_table", "silo")
modparam("msilo", "sc_mid", "id")
modparam("msilo","from_address","sip:registrar@192. 168.10.18:9060 ")
modparam("msilo","contact_hdr","Contact: registrar@192.168.10.18:9060; msilo=yes\r\n")
modparam("msilo","content_type_hdr","Content-Type: text/plain\r\n")
........
route[MSILO_MESSAGE] {
if (!is_method("MESSAGE")) return;
xlogl("L_NOTICE", "[$rm] r-uri: $ru d-uri: $du \n");
if (lookup("location")) {
xlogl("L_NOTICE", "[$rm] -> loaction found. Relying message [[$rb]] to the UAC \n");
t_relay();
} else {
if (!t_newtran()) {
xlogl("L_ERROR", "[$rm] -> ERROR creating new transaction \n");
sl_reply_error();
exit;
};
xlogl("L_NOTICE", "[$rm] -> Storing MSILO_MESSAGE \n [$ru]-[$tu]-[$ou] \n ");
if (m_store("$ru")) {
xlogl("L_NOTICE", "MSILO: offline message stored! \n");
if (!t_reply("202", "Accpeted and Strored")) {
xlogl("L_ERROR", "MSILO: Err sending 202 reply... \n");
sl_reply_error();
}
} else {
xlogl("L_ERROR", "MSILO: offline message NOT stored... \n");
if (!t_reply("503", "Service Unavailable")) {
sl_reply_error();
}
}
}
exit;
}
.....
# Handle SIP registrations
route[REGISTRAR] {
if (!is_method("REGISTER")) return; // discard all non-REGISTER methods
if(isflagset(FLT_NATS)) {
setbflag(FLB_NATB);
#!ifdef WITH_NATSIPPING
setbflag(FLB_NATSIPPING); //# do SIP NAT pinging
#!endif
}
$avp(received) = "sip:" + $si + ":" + $sp + ";transport=" + $proto;
xlogl("L_INFO", "[$rm] -> UAC actual location $avp(received) \n");
if (!save("location",0x04)) {
xlogl("L_ERROR", "[$rm] -> Unable to save user location \n");
sl_reply_error();
}
else {
xlogl("L_INFO", "[$rm] -> dumping messages with MSILO \n");
# MSILO - dumping user's offline messages to user
if (m_dump("$fu")) {
xlogl("L_NOTICE", "MSILO: offline messages for $fu dumped - if they were \n");
}
else {
xlogl("L_NOTICE", "MSILO: no offline messages dumped \n");
};
}
exit;
}Any idea?
--
regards,
abdul basit
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr- users