Hi Daniel,

Thanks for your advice. 
I uncomment #!define WITH_AUTH and now mslio is working fine.

However, some UA sent two REGISTER when connecting to Kamailio, 
and it turned to be the result that the offline messages were dumped for twice.

I tried to use if(registered("location"))  to detect that whether it is the initial register but failed.
registered("location") always returns false.

Before ,  when using OpenSips, registered("location","$avp(s:fu)","$ci")   works fine.
But at that time ,no NAT support at all.

Any idea for this issue??

Thank you very much.

Coca



2011/7/27 Daniel-Constantin Mierla <miconda@gmail.com>
Hello,

can you watch all network interfaces with ngrep and see if the messages are relayed? It may happen that they are looped due to the address in r-uri and then challenged for authentication. If so, then allow all requests from your server ip/port without authentication.

Cheers,
Daniel


On 7/26/11 10:04 PM, Coca wrote:
Hi list,

I have Kamailio running behind NAT.  (Amazon EC2)

When I use mslio module, storing messages for offline contact is working fine,
however the stored messages are never sent to the contacts when they get online.

My configuration is as below.
Any kind of help will be great appreciated.

Thank you!

----------------------------------------------------------------------------------------------------------------------
loadmodule "msilo.so"
...
modparam("msilo", "add_date", 0)
modparam("msilo", "db_url",DBURL)
...


route[REGISTRAR] {
if (is_method("REGISTER"))
{
if(isflagset(FLT_NATS))
{
setbflag(FLB_NATB);
# uncomment next line to do SIP NAT pinging 
setbflag(FLB_NATSIPPING);
}
$avp(s:fu) = $fu;
    $var(initialregister) = 1;
                if( registered("location")){
                       $var(initialregister) = 0;
                }
if (!save("location"))
sl_reply_error();

if( !is_present_hf("Expires") || $(hdr(Expires){s.int})!=0 && $var(initialregister)==1 ){
# Send messages recieved while offline
if (m_dump("$fu")){
                     xlog("L_INFO", "offline messages dumped for $avp(s:fu) \n");
                }
                else{
                         xlog("L_INFO", "no offline messages dumped for $avp(s:fu) \n");
}
}
exit;
}
}

# USER location service
route[LOCATION] {
if (!lookup("location")) {
switch ($rc) {
case -1:
                                 ...
                          

                             if (is_method("MESSAGE")) {
     $var(m_store_owner) = $tu;
                                     if (m_store("$var(m_store_owner)"))
                    {
                      xlog("L_INFO", "(MSILO_STORE) offline message stored for $var(m_store_owner)\n");
               if (!t_reply("202", "Accepted")) sl_reply_error();
                    } 
                   else {
              xlog("L_ERR","BUG: dropped an offline MESSAGE: M=$rm S=$rs D=$rr F=$fu T=$tu IP=$si ID=$ci UA=$ua Txt=$rb");
              if (!t_reply("503", "Service Unavailable"))  sl_reply_error();
                    };

              }
exit;

case -3:
t_newtran();
t_reply("404", "Not Found");
exit;
case -2:
sl_send_reply("405", "Method Not Allowed");
exit;
}
}

# when routing via usrloc, log the missed calls also
if (is_method("INVITE"))
{
setflag(FLT_ACCMISSED);
}
}



_______________________________________________
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

-- 
Daniel-Constantin Mierla -- http://www.asipto.com
Kamailio Advanced Training, Oct 10-13, Berlin: http://asipto.com/u/kat
http://linkedin.com/in/miconda -- http://twitter.com/miconda



--
--------------------------
Room to Fly, Endless Sky!

                  --Yi Chen