[SR-Users] Asterisk Ignore "UNREGISTER" because retransmit

pavel@eremina.net eremina.net at gmail.com
Thu Feb 20 16:16:42 CET 2014


Hi, All!
Try to register user in Kamailio and then relay REG massage to Asterisk.
Asterisk register user and looks good.

But when I send Unreg message to Kamailio, it unregister user successfully
but Asterisk say: Message REGISTER Ignoring because retransmit (CSeq 1234
our CSeq 1234).

Did someone know how solve this problem: i think that Asterisk need
different CSeq for first REGISTER and Second after 401 code.

dump my conf: At route[REGISTER]:
                if (!save("location")) {
                        sl_reply_error();
                   } else {
                            reg_fetch_contacts("location", "$tu", "cc");
                            $var(useragent) = $ulc(cc=>user_agent);
                            xlog("L_INFO","EXpires in Contact:
$ulc(cc=>expires)");

                                if ($ulc(cc=>expires)==0) {
                                   $var(query) = "insert into activity
values (now(),'unr','"+$ci+"','"+$fu+"');";
                                   sql_query("events", "$var(query)");
                                    $var(string_temp) = "$(hdr(expires))";
                                   xlog("L_INFO", "UNregistered $ru FROM
$fu exp $var(string_temp)");
                            } else {
                                    if ($var(registered)==0) {
                                     $var(query) = "insert into activity
values (now(),'reg','"+$ci+"','"+$fu+"');";
                                     sql_query("events", "$var(query)");
                                    }

                                    xlog("L_INFO", "Registered $ru FROM $fu
exp $ulc(cc=>expires)");
                                    }
                  }
                 xlog("L_INFO","DU(TD): $td");
                if ($td == "mydomain.com") {route(TOASTERISK); }
                exit;
        }
}

route[TOASTERISK] {
 xlog("L_INFO","ROUTE to ASTERISK from $ru to $tu");
 #append_branch();

 t_on_failure("FAILAUTH");

 $ru = "sip:"+ $td;
 consume_credentials();

  route(RELAY);
exit;

}

failure_route[FAILAUTH] {

        if (t_is_canceled()) {
                exit;
        }

         if (t_check_status("(401)|(407)")) {

         xlog("L_INFO", "Remote asked for authentication");
         $avp(realm)="";
         uac_auth();
        }

        route(RELAY);

}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20140220/ce874107/attachment.html>


More information about the sr-users mailing list