Hi Team,

My issue for IM handling has been resolved.

@MS helped to look into the matter. From to the example
https://www.kamailio.org/docs/modules/5.1.x/modules/msilo.html#idp45433036

# -- tm params --

modparam("tm", "fr_timer", 10 )
modparam("tm", "fr_inv_timer", 15 )
modparam("tm", "wt_timer", 10 )
I replaced it as below
# -- tm params --

modparam("tm", "fr_timer", 10000 )
modparam("tm", "fr_inv_timer", 15 )
modparam("tm", "wt_timer", 10 )

Lower fr_timer was initiating 408 without waiting for 200 OK from destination because 10ms is too low. This was confusing msilo module and the sender device that MESSAGE sent was failed.
Increasing the fr_timer value resolved the issue.
This also resolved a ripple effect. i.e, kamailio delivery of offline messages from DB store to the destination party.
Since kamailio was get message delivery error, it was executing failure_route[1] that was storing the message again in DB store as offline message and so on.

lower fr_timer values are also exits in 3.x, 4.x, 5x and dev branches documentation.

Correction is required.


--

regards,

abdul basit | p: +92 32 1416 4196 | o: +92 30 0841 1445

On 9 April 2018 at 19:34, Abdul Basit <basit.engg@gmail.com> wrote:
Dear Team,

I have added traces via pasetbin

MESSAGE Stored When B is OffLine https://pastebin.com/NLwMePmf

[trace screenshot removed]

Next this messages should be delivered when B party REGISTER with the server

Issue 1: Message was delivered to B-party but it didn't remove form DB and as a result MESSAGE deliver to B-party as many times it come line  https://pastebin.com/7pb0wCKx
[trace screenshot removed]

Now next issue is
Issue 2: Messages deliver to B-party when its already online without storing in DB. B-party receive MESSAGE successfully but A-party gets MESSAGE delivery failed.
https://pastebin.com/zgDbK4F6

[trace screenshot removed]

I intentionally modified the 202 - description for better troubleshooting.

See if attachments were received properly through mailing list.

For convenience I have attached the pcap as well.

MESSAGE: 1: Accepted and Stored as expected
MESSAGE: 2: Server delivered Message when B comes online
MESSAGE: 3: Both A & B are online. A-party receives MESSAGE delivery failure where as B-party receives MESSAGE successfully


Modified default kamailio.cfg is https://pastebin.com/thZig5RC
It looks that mingled up the configuration.

Please see whats gone wrong here.


--
regards,

abdul basit | p: +92 32 1416 4196 | o: +92 30 0841 1445

On 9 April 2018 at 18:20, Abdul Basit <basit.engg@gmail.com> wrote:
Dear team,

Thank you for your reply.

@MS & @ Davld, Let me test again and share traces.

@Zaka, I will check the save() result as you suggested. Location is being saved and properly looked up because messages are being delivered (and not stored in DB ) when both parties are online.

--
regards,

abdul basit | p: +92 32 1416 4196 | o: +92 30 0841 1445

On 9 April 2018 at 16:38, Muhammad Zaka <muhammad.zaka@cloudcall.com> wrote:

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