<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="WordSection1"></div>
<div class="WordSection1">
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span lang="EN-US" style="">In my topology, Kamailio is the one making contact with a remote VOIP company, meaning, as it comes for my scope – Kamailio acts as the gateway.</span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span lang="EN-US" style=""> </span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span lang="EN-US" style="">I also have the dialog module loaded.</span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span lang="EN-US" style=""> </span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><img width="713" height="81" id="Picture_x0020_3" data-outlook-trace="F:1|T:1" src="cid:image001.png@01D627AB.1FEFD2F0"></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
 </p>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
Does it change your answer in any way?</p>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
 </p>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
Also, if I choose to authenticate with Freeswitch, do you have any idea how to choose the username/password by the realm? I'm using a singular 'gateway' settings that goes straight to Kamailio, but I may want to have multiple sets of username/password for different
 providers.</p>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
 </p>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<a name="_olk_signature">Edward</a><span style=""><span lang="EN-US" style=""></span></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style=""> </span></span></p>
<span style=""></span>
<div style="border:none; border-top:solid #E1E1E1 1.0pt; padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;border:none; padding:0cm">
<a name="_olk_replyheader"><b>From: </b></a><a href="mailto:miconda@gmail.com"><span style="">Daniel-Constantin Mierla</span><span style=""></span></a><span style=""><br>
<b>Sent: </b>Monday, 11 May 2020 14:33<br>
<b>To: </b></span><a href="mailto:sr-users@lists.kamailio.org"><span style="">Kamailio (SER) - Users Mailing List</span><span style=""></span></a><span style="">;
</span><a href="mailto:edward@telemessage.com"><span style="">Edward Romanenco</span><span style=""></span></a><span style=""><br>
<b>Subject: </b>Re: [SR-Users] Digest authentication w/ Kamailio & Freeswitch</span></p>
</div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style=""> </span></span></p>
<span style=""></span>
<p><a name="_olk_quotedtext">Hello,</a></p>
<p><span style=""> </span></p>
<p><span style=""> </span></p>
<p><span style="">if you have this topology:</span></p>
<p><span style=""> </span></p>
<p><span style="">[freeswitch] ====> [kamailio] ====> [gateway]</span></p>
<p><span style=""> </span></p>
<p><span style="">and the gateway is sending back 407, the I would still use freeswitch to do the authentication, otherwise you need dialog module in kamailio to track cseq changes. FreeSwitch originates the call and then can increase the cseq as it needs.
 If the gateway is a proxy (e.g., another Kamailio), then cseq increase is not needed and you can just do it with uac module without dialog module.</span></p>
<p><span style=""> </span></p>
<p><span style="">Regarding your question of adding the Proxy-Authorization header in the first INVITE, that can work sometimes if you know the nonce the gateway is going to use, which can be the case of caching the nonce when receiving the 407 first time and
 reusing it later. However, the nonce typically is invalidated after a while (or even on first usage), so reusing it is not going to work always. Which is for good reasons, otherwise there can be reply-attacks.</span></p>
<p><span style=""> </span></p>
<p><span style="">Cheers,<br>
Daniel</span></p>
<p><span style=""> </span></p>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="">On 10.05.20 18:53, Edward Romanenco wrote:</span></span></p>
</div>
<blockquote style="margin-top:5.0pt; margin-bottom:5.0pt">
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">Hi!</span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black"> </span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">I've using a SIP setup that includes both Kamailio & Freeswitch, invites are passed from Freeswitch and relayed by Kamailio to various dispatchers, I would like to have Kamailio authenticating when
 Proxy Authentication is required. </span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black"> </span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">As I understood, this can be achieved with the help of a failure route, problem is, when I'm utilizing this method - the 407 response gets reverted back to Freeswitch, which returns the revised invite
 filled with the default Freeswitch username/password, how can let Kamailio handle the authentication once receiving the 407? Can I work straight without relying on a failure route, but having the Proxy
</span></span><span style=""><span style="color:black">Authentication</span></span><span style=""><span style="font-size:12.0pt; color:black"> header on my original invite?</span></span><span style=""><span style=""></span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black"> </span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">This is my relevant configuration -</span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">route[RELAY] {</span></span></p>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">    if (is_method("INVITE|BYE|SUBSCRIBE|UPDATE")) {</span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">        if(!t_is_set("branch_route")) {</span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">                        t_on_branch("MANAGE_BRANCH");</span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">                 }</span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">    }</span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">    if (is_method("INVITE|SUBSCRIBE|UPDATE")) {</span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">        if(!t_is_set("onreply_route")) {</span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">                          t_on_reply("MANAGE_REPLY");</span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">                }</span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">    }</span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">    if (is_method("INVITE")) {</span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">        if(!t_is_set("failure_route")) {</span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">                     t_on_failure("KAM_AUTH");</span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">                }</span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">    }</span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black"> </span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">    if (!t_relay()) {</span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">        sl_reply_error();</span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">    }</span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">    exit;</span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">}</span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black"> </span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">failure_route[KAM_AUTH] {</span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">  if(t_check_status("401|407")) {</span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">    $avp(auser) = "xxx";</span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">    $avp(apass) = "yyy";</span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">    t_on_failure("OUTGOING_FAILURE");</span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">    uac_auth();</span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">    t_relay();</span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">    exit;</span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">  }</span></span></p>
</div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">}</span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black"> </span></span></p>
</div>
<div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style="font-size:12.0pt; color:black">Edward</span></span></p>
</div>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style=""><span style=""><br style="">
<br style="">
</span></span></p>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";"><span style="">_______________________________________________</span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";"><span style="">Kamailio (SER) - Users Mailing List</span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";"><span style=""></span><a href="mailto:sr-users@lists.kamailio.org"><span style="">sr-users@lists.kamailio.org</span><span style=""></span></a><span style=""></span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";"><span style=""></span><a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users"><span style="">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</span><span style=""></span></a><span style=""></span></pre>
</blockquote>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";"><span style="">-- </span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";"><span style="">Daniel-Constantin Mierla -- </span><a href="http://www.asipto.com"><span style="">www.asipto.com</span><span style=""></span></a><span style=""></span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";"><span style=""></span><a href="http://www.twitter.com/miconda"><span style="">www.twitter.com/miconda</span><span style=""></span></a><span style=""> -- </span><a href="http://www.linkedin.com/in/miconda"><span style="">www.linkedin.com/in/miconda</span><span style=""></span></a><span style=""></span></pre>
<pre style="margin: 0cm 0cm 0.0001pt; font-size: 10pt; font-family: "Courier New";"><span style="">Funding: </span><a href="https://www.paypal.me/dcmierla"><span style="">https://www.paypal.me/dcmierla</span><span style=""></span></a><span style=""></span></pre>
<span style=""></span>
<p class="MsoNormal" style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style="font-size:10.0pt; font-family:"Courier New""> </span></p>
</div>
</body>
</html>