[SR-Users] Kamailio 5.0 doesn't forward Authorization (Digest username) to Asterisk

gh gh at heissa.de
Sun Apr 16 23:22:08 CEST 2017


Hi Marko,

does xlog work on your side? Do you get the expected values for each 
variable?

uac_reg_request_to can be used to send an authenticated request to a 
remote user in the uac registrations table. It sets the request-uri, 
dst-uri and auth_*_avp pv's to the values that correspond to the 
supplied user.

The mode indicates whether the user should match the local uuid 
(mode=0), or the username (mode=1).

The auth_*_avp module parameters must be set to valid pv's.

This function can be used only from REQUEST_ROUTE, FAILURE_ROUTE, and 
BRANCH_ROUTE.


modparam("uac","auth_username_avp","$avp(yourastuser)")

modparam("uac","auth_password_avp","$avp(yourastpass)")

modparam("uac","auth_realm_avp","$avp(yourastrealm)")

# Forward REGISTER to Asterisk
route[REGFWD] {
if(!is_method("REGISTER"))
     {
     return;
     }
$var(rip) = $sel(cfg_get.asterisk.bindip);
$uac_req(method)="REGISTER";
$uac_req(ruri)="sip:" + $var(rip) + ":" + $sel(cfg_get.asterisk.bindport);
#$uac_req(furi)="sip:" + $au + "@" + $var(rip);
     #$uac_req(turi)="sip:" + $au + "@" + $var(rip);

if(uac_reg_request_to("$fU", 0))
     {
xlog("L_NOTICE", "Fixme [$fU] on [$rd] via [$du]");
       t_on_failure("REMOTE_AUTH");
       t_relay();
     }


     $uac_req(hdrs)="Contact: <sip:" + $au + "@"
     + $sel(cfg_get.kamailio.bindip)
             + ":" + $sel(cfg_get.kamailio.bindport) + ">\r\n";
if($sel(contact.expires) != $null)
$uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $sel(contact.expires) + 
"\r\n";
else
         $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $hdr(Expires) + 
"\r\n";
uac_req_send();
}
#!endif


On 16.04.2017 22:29, Marko Tirs wrote:
> Hi Georg,
>
> I believe my issue relates to this function:
>
> # Forward REGISTER to Asterisk
> route[REGFWD] {
>     if(!is_method("REGISTER"))
>     {
>         return;
>     }
>     $var(rip) = $sel(cfg_get.asterisk.bindip);
>     $uac_req(method)="REGISTER";
>     $uac_req(ruri)="sip:" + $var(rip) + ":" + 
> $sel(cfg_get.asterisk.bindport);
>     $uac_req(furi)="sip:" + $au + "@" + $var(rip);
>     $uac_req(turi)="sip:" + $au + "@" + $var(rip);
>     $uac_req(hdrs)="Contact: <sip:" + $au + "@"
>                 + $sel(cfg_get.kamailio.bindip)
>                 + ":" + $sel(cfg_get.kamailio.bindport) + ">\r\n";
>     if($sel(contact.expires) != $null)
>         $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + 
> $sel(contact.expires) + "\r\n";
>     else
>         $uac_req(hdrs)= $uac_req(hdrs) + "Expires: " + $hdr(Expires) + 
> "\r\n";
>     uac_req_send();
> }
> #!endif
>
> Where should I put your code to test it?
>
> Regards
> Marko
>
>
>
>
> ----- Forwarded Message -----
> *From:* gh <gh at heissa.de>
> *To:* Kamailio (SER) - Users Mailing List <sr-users at lists.kamailio.org>
> *Sent:* Sunday, April 16, 2017 6:47 PM
> *Subject:* [SR-Users] Kamailio 5.0 doesn't forward Authorization 
> (Digest username) to Asterisk
>
> Hi Marko,
>
> i work on the same scenario. It should work with:
>
> if(uac_reg_request_to("$fU", 0))
>     {
> xlog("L_NOTICE", "Found remote user [$rU] on [$rd] via [$du]");
> t_on_failure("REMOTE_AUTH");
>
> t_relay();
>     }
>
>
> But in my case xlog() currently does not print out the variables, so i
> am not able to debug:-(
>
> Can you try this code and tell me if xlog() works for you?
>
> Best regards
>
> Georg
>
>
>
> MY ISSUE:
> ----------------------
> Hi Daniel,
>
> yes I want to register my SIP clients twice to have full media path 
> through Asterisk.
>
> Now I register eg. clients 31 & 32 on Kamailio and when I try to call 
> 31->32 then my call reaches Asterisk but it doesn't find the callee 
> because it isn't registered in Asterisk.
>
> Am I right that Kamailio cuts a part of register message header 
> (Authorisation - Digest name) which it receives from SIP-client and 
> forward just such shortened message to Asterisk or there is an other 
> problem?
>
> Is there any better approach for above requirement (full media path 
> through Asterisk for all calls and for all users registered by Kamailio)?
>
> Thank you
> Regards
> Marko
>
>
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20170416/daa53ec1/attachment.html>


More information about the sr-users mailing list