<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    If Asterisk is still do it the authentication, then likely it is not
    much gain on overall scalability. Maybe you can just use kamailio as
    an edge proxy with Path enabled.<br>
    <br>
    Otherwise, the requests generated with uac_req_send() don't get in
    failure_route. You have to set the auth user/password in the
    $uac_req(...) fields -- see the variables core cookbook for them. On
    the other hand, this is not enough, you have to deal also with
    authentication for other requests, such as INVITEs/SUBSCRIBEs/etc.<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    <div class="moz-cite-prefix">On 31/03/16 10:57, Alberto Sagredo
      wrote:<br>
    </div>
    <blockquote
cite="mid:CADqf3zAC07vyBiWChb_Q571qLPfe0N_YV12n48EbLkWszkb4Nw@mail.gmail.com"
      type="cite">
      <div dir="ltr">I have it working, authenticating in Kamailio. And
        just works.
        <div><br>
        </div>
        <div>But there is a farm with lots of Asterisk and i was looking
          for an easy way to do not modify secret= and permit= on every
          Asterisk Machine... Thats why i was looking for that..</div>
        <div><br>
        </div>
        <div><br>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">2016-03-31 10:55 GMT+02:00 Marrold <span
            dir="ltr"><<a moz-do-not-send="true"
              href="mailto:kamailio@marrold.co.uk" target="_blank">kamailio@marrold.co.uk</a>></span>:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">Why not just authenticate on Kamailio in that
              case? 
              <div><br>
              </div>
              <div>Also, be aware that the Authorization Username ($au)
                is included in SIP digest authentication. $au and $fu
                aren't necessarily the same,  but on most end points the
                default is to use the same value for both. If you
                manipulate $fu or $au it may cause auth issues.</div>
            </div>
            <div class="HOEnZb">
              <div class="h5">
                <div class="gmail_extra"><br>
                  <div class="gmail_quote">On Thu, Mar 31, 2016 at 9:49
                    AM, Alberto Sagredo <span dir="ltr"><<a
                        moz-do-not-send="true"
                        href="mailto:alberto.sagredo@avanzada7.com"
                        target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:alberto.sagredo@avanzada7.com">alberto.sagredo@avanzada7.com</a></a>></span>
                    wrote:<br>
                    <blockquote class="gmail_quote" style="margin:0 0 0
                      .8ex;border-left:1px #ccc solid;padding-left:1ex">
                      <div dir="ltr">Hi Marrold. I want to authenticate
                        user on Kamailio but want Asterisk to see them
                        registered with kamailio ip as contact.<br>
                        <div><br>
                        </div>
                        <div>I making also some manipulations in $fu as
                          users are different (emp_xxx_ext) in kamailio
                          than in Asterisk xxx_ext</div>
                        <div><br>
                        </div>
                        <div>Thanks</div>
                      </div>
                      <div>
                        <div>
                          <div class="gmail_extra"><br>
                            <div class="gmail_quote">2016-03-31 10:48
                              GMT+02:00 Marrold <span dir="ltr"><<a
                                  moz-do-not-send="true"
                                  href="mailto:kamailio@marrold.co.uk"
                                  target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:kamailio@marrold.co.uk">kamailio@marrold.co.uk</a></a>></span>:<br>
                              <blockquote class="gmail_quote"
                                style="margin:0 0 0 .8ex;border-left:1px
                                #ccc solid;padding-left:1ex">
                                <div dir="ltr">Why not just relay the
                                  registration messages to Asterisk
                                  itself? What's the use case?
                                  <div><br>
                                  </div>
                                  <div>Cheers</div>
                                </div>
                                <div class="gmail_extra"><br>
                                  <div class="gmail_quote">
                                    <div>
                                      <div>On Thu, Mar 31, 2016 at 9:34
                                        AM, Alberto Sagredo <span
                                          dir="ltr"><<a
                                            moz-do-not-send="true"
                                            href="mailto:alberto.sagredo@avanzada7.com"
                                            target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:alberto.sagredo@avanzada7.com">alberto.sagredo@avanzada7.com</a></a>></span>
                                        wrote:<br>
                                      </div>
                                    </div>
                                    <blockquote class="gmail_quote"
                                      style="margin:0 0 0
                                      .8ex;border-left:1px #ccc
                                      solid;padding-left:1ex">
                                      <div>
                                        <div>
                                          <div dir="ltr">Hi
                                            <div><br>
                                            </div>
                                            <div>Im trying to modify
                                              example for
                                              Asterisk/Kamailio
                                              integration that miconda
                                              did, and trying to handle
                                              Forwarded register to
                                              Asterisk in an
                                              authenticated way instead
                                              removing secret in
                                              asterisk.</div>
                                            <div><br>
                                            </div>
                                            <div>I have made this
                                              changes</div>
                                            <div><br>
                                            </div>
                                            <div><br>
                                            </div>
                                            <div>
                                              <p
                                                style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span>route[REGFWD]
                                                  {</span></p>
                                              <p
                                                style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span> 
                                                       
                                                  if(!is_method("REGISTER"))</span></p>
                                              <p
                                                style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span> 
                                                        {</span></p>
                                              <p
                                                style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span> 
                                                                return; </span></p>
                                              <p
                                                style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span> 
                                                        }</span></p>
                                              <p
style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px"><span>  
                                                       </span></p>
                                              <p
                                                style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span> 
                                                        $var(rip) =
                                                  $var(astip);</span></p>
                                              <p
                                                style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span> 
                                                       
                                                  $uac_req(method)="REGISTER";</span></p>
                                              <p
                                                style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span> 
                                                       
                                                  $uac_req(ruri)="sip:"
                                                  + $var(rip) + ":" +
                                                  $var(astport);</span></p>
                                              <p
                                                style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span> 
                                                       
                                                  $uac_req(furi)="sip:"
                                                  + $(au{s.substr,8,0})
                                                  + "@" + $var(rip);</span></p>
                                              <p
                                                style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span> 
                                                       
                                                  $uac_req(turi)="sip:"
                                                  + $(au{s.substr,8,0})
                                                  + "@" + $var(rip);</span></p>
                                              <p
                                                style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span> 
                                                       
                                                  $uac_req(hdrs)="Contact:
                                                  <sip:" + $au + "@"</span></p>
                                              <p
                                                style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span> 
                                                                       
                                                          +
                                                  $sel(cfg_get.kamailio.bindip)</span></p>
                                              <p
                                                style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span> 
                                                                       
                                                          + ":" +
                                                  $sel(cfg_get.kamailio.bindport)
                                                  + ">\r\n";</span></p>
                                              <p
                                                style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span> 
                                                       
                                                  if($sel(contact.expires)
                                                  != $null)</span></p>
                                              <p
                                                style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span> 
                                                               
                                                  $uac_req(hdrs)=
                                                  $uac_req(hdrs) +
                                                  "Expires: " +
                                                  $sel(contact.expires)
                                                  + "\r\n";</span></p>
                                              <p
                                                style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span> 
                                                        else  </span></p>
                                              <p
                                                style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span> 
                                                               
                                                  $uac_req(hdrs)=
                                                  $uac_req(hdrs) +
                                                  "Expires: " +
                                                  $hdr(Expires) +
                                                  "\r\n";</span></p>
                                              <p
style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px"><span></span><br>
                                              </p>
                                              <p
                                                style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span> 
                                                        xlog("Dentro de
                                                  REGFWD");</span></p>
                                              <p
style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px"><span></span><br>
                                              </p>
                                              <p
                                                style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span> 
                                                       
                                                  t_on_failure("REG_AST");</span></p>
                                              <p
style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px"><span></span><br>
                                              </p>
                                              <p
                                                style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span> 
                                                        uac_req_send();</span></p>
                                              <p
style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px"><span></span><br>
                                              </p>
                                              <p
                                                style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span>}</span></p>
                                            </div>
                                            <div><span><br>
                                              </span></div>
                                            <div><span><br>
                                              </span></div>
                                            <div><span><br>
                                              </span></div>
                                            <div><br>
                                            </div>
                                            <div> <span
                                                style="font-family:Menlo;font-size:11px">failure_route[REG_AST]
                                                {</span></div>
                                            <p
style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px"><span></span><br>
                                            </p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span> 
                                                  if (t_is_canceled()) {</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span> 
                                                      exit;</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span> 
                                                  }</span></p>
                                            <p
style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px"><span></span><br>
                                            </p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span> 
                                                  xlog("Dentro de REG
                                                AST");</span></p>
                                            <p
style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px"><span></span><br>
                                            </p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span> 
                                                 
                                                if(t_check_status("401|407"))
                                                {</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span> 
                                                      xlog("Dentro de
                                                401");</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span> 
                                                      $avp(auser) =
                                                "test";</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span> 
                                                      $avp(apass) =
                                                "test";</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span> 
                                                      uac_auth();</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span> 
                                                      t_relay();</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span> 
                                                      exit;</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span> 
                                                  }</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span>}</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span><br>
                                              </span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span>What
                                                i see  on traces:</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span><br>
                                              </span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span>U
                                                x.x.x..240:5060 ->
                                                x.x.x..56:5060</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span>REGISTER
                                                <a class="moz-txt-link-freetext" href="sip:x.x.x.56:5060">sip:x.x.x.56:5060</a>
                                                SIP/2.0.</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span>Via:
                                                SIP/2.0/UDP
                                                x.x.x.240;branch=z9hG4bKfb46.a47535d4000000000000000000000000.0.</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span>To:
<a class="moz-txt-link-rfc2396E" href="sip:200@x.x.x.56"><sip:200@x.x.x.56></a>.</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span>From:
<a class="moz-txt-link-rfc2396E" href="sip:200@x.x.x.56"><sip:200@x.x.x.56></a>;tag=533cb9e91f4b999cf76861cbb9ed54ed-6a4f.</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span>CSeq:
                                                10 REGISTER.</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span>Call-ID:
                                                <a
                                                  moz-do-not-send="true"
href="mailto:09dc120d65932ed7-16044@127.0.0.1" target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:09dc120d65932ed7-16044@127.0.0.1">09dc120d65932ed7-16044@127.0.0.1</a></a>.</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span>Max-Forwards:
                                                70.</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span>Content-Length:
                                                0.</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span>User-Agent:
                                                ANY.</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span>Contact:
<a class="moz-txt-link-rfc2396E" href="sip:emp_001_200@x.x.x.240:5060"><sip:emp_001_200@x.x.x.240:5060></a>.</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span>Expires:
                                                3600.</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span>.</span></p>
                                            <p
style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px"><span></span><br>
                                            </p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span>#</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span>U
                                                x.x.x.56:5060 -> </span>x.x.x..240<span>:5060</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span>SIP/2.0
                                                401 Unauthorized.</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span>Via:
                                                SIP/2.0/UDP </span>x.x.x..240<span>;branch=z9hG4bKfb46.a47535d4000000000000000000000000.0;received=</span>x.x.x..240<span>;rport=5060.</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span>From:
<a class="moz-txt-link-rfc2396E" href="sip:200@x.x.x.56"><sip:200@x.x.x.56></a>;tag=533cb9e91f4b999cf76861cbb9ed54ed-6a4f.</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span>To:
<a class="moz-txt-link-rfc2396E" href="sip:200@x.x.x.56"><sip:200@x.x.x.56></a>;tag=as62b47138.</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span>Call-ID:
                                                <a
                                                  moz-do-not-send="true"
href="mailto:09dc120d65932ed7-16044@127.0.0.1" target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:09dc120d65932ed7-16044@127.0.0.1">09dc120d65932ed7-16044@127.0.0.1</a></a>.</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span>CSeq:
                                                10 REGISTER.</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span>Server:
                                                FPBX-2.11.0(11.17.1).</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span>Allow:
                                                INVITE, ACK, CANCEL,
                                                OPTIONS, BYE, REFER,
                                                SUBSCRIBE, NOTIFY, INFO,
                                                PUBLISH, MESSAGE.</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span>Supported:
                                                replaces, timer.</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span>WWW-Authenticate:
                                                Digest algorithm=MD5,
                                                realm="asterisk",
                                                nonce="59e39692".</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span>Content-Length:
                                                0.</span></p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">
                                            </p>
                                            <p
                                              style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span>.</span></p>
                                            <div><span><br>
                                              </span></div>
                                            <div><span><br>
                                              </span></div>
                                            <div><span>But Kamailio is
                                                not
                                                sending authentication .</span></div>
                                            <div><span><br>
                                              </span></div>
                                            <div><span>Any idea what
                                                could be wrong? Or any
                                                tip to do what i try.</span></div>
                                            <div><span><br>
                                              </span></div>
                                            <div><span>The idea is that
                                                a sip endpoint register
                                                with authentication on
                                                kamailio and it sends
                                                register with
                                                authentication to
                                                asterisk.</span></div>
                                            <div><span><br>
                                              </span></div>
                                            <div><span>Thanks in advance</span></div>
                                            <div><span><br>
                                              </span></div>
                                            <div><span><br>
                                              </span></div>
                                          </div>
                                          <br>
                                        </div>
                                      </div>
_______________________________________________<br>
                                      SIP Express Router (SER) and
                                      Kamailio (OpenSER) - sr-users
                                      mailing list<br>
                                      <a moz-do-not-send="true"
                                        href="mailto:sr-users@lists.sip-router.org"
                                        target="_blank">sr-users@lists.sip-router.org</a><br>
                                      <a moz-do-not-send="true"
                                        href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users"
                                        rel="noreferrer" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
                                      <br>
                                    </blockquote>
                                  </div>
                                  <br>
                                </div>
                                <br>
_______________________________________________<br>
                                SIP Express Router (SER) and Kamailio
                                (OpenSER) - sr-users mailing list<br>
                                <a moz-do-not-send="true"
                                  href="mailto:sr-users@lists.sip-router.org"
                                  target="_blank">sr-users@lists.sip-router.org</a><br>
                                <a moz-do-not-send="true"
                                  href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users"
                                  rel="noreferrer" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
                                <br>
                              </blockquote>
                            </div>
                            <br>
                          </div>
                        </div>
                      </div>
                      <br>
                      _______________________________________________<br>
                      SIP Express Router (SER) and Kamailio (OpenSER) -
                      sr-users mailing list<br>
                      <a moz-do-not-send="true"
                        href="mailto:sr-users@lists.sip-router.org"
                        target="_blank">sr-users@lists.sip-router.org</a><br>
                      <a moz-do-not-send="true"
                        href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users"
                        rel="noreferrer" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
                      <br>
                    </blockquote>
                  </div>
                  <br>
                </div>
              </div>
            </div>
            <br>
            _______________________________________________<br>
            SIP Express Router (SER) and Kamailio (OpenSER) - sr-users
            mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
            <a moz-do-not-send="true"
              href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users"
              rel="noreferrer" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
            <br>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a>
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>
Kamailio World Conference, Berlin, May 18-20, 2016 - <a class="moz-txt-link-freetext" href="http://www.kamailioworld.com">http://www.kamailioworld.com</a></pre>
  </body>
</html>