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

Marko Tirs marko.tirs at yahoo.com
Thu Apr 20 21:48:29 CEST 2017


Hi Georg,
now I tested you function route[REGFWD] with following modparams
 modparam("uac","auth_realm_avp","$avp(i:10)")
modparam("uac","auth_username_avp","$avp(i:11)")
modparam("uac","auth_password_avp","$avp(i:12)")
and I didn't get any xlog output on your place. Instead of it I got 
14(2444) ERROR: uac [uac_reg.c:651]: reg_ht_get_byuuid(): reg hash table not initialized.
Probably my modparam wasn't good. What should I put there for yourastuser, yourastpass and yourastrealm? I took my values for them ((i:10, i:11, i:12) from an example, but I don't know what it does mean.
RegardsMarko

     
----- Forwarded Message -----
 From: gh <gh at heissa.de>
 To: Marko Tirs <marko.tirs at yahoo.com>; Kamailio (SER) - Users Mailing List <sr-users at lists.kamailio.org> 
 Sent: Sunday, April 16, 2017 11:22 PM
 Subject: Re: [SR-Users] Kamailio 5.0 doesn't forward Authorization (Digest username) to Asterisk
   
    _filtered #yiv6960180546 {margin:2cm;}#yiv6960180546 p {margin-bottom:0.25cm;line-height:120%;}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/20170420/a34a8ca3/attachment.html>


More information about the sr-users mailing list