<div dir="ltr">Hi,<div><br></div><div>I&#39;m currently working on authentication below is the snipped of code used in our opensips.cfg which I believe handles all the authentication and registering work.</div><div><br></div>
<div>With these setting only one of our endpoints works which is a SIP phone programme called PhonerLite and the other SIP phone don&#39;t work (unless I change the Domain IP address in the table to the Opensips Servers IP address and FreePBX never works.</div>
<div><br></div><div>The end goal is to be able to authenticate by using just the Endpoints IP address or else by having the IP address and a Username and Password.</div><div><br></div><div><br></div><div><div>## EC - auth</div>
<div>loadmodule &quot;auth.so&quot;</div><div>loadmodule &quot;auth_db.so&quot;</div><div>loadmodule &quot;db_mysql.so&quot;</div><div>#loadmodule &quot;alias_db.so&quot;</div><div>modparam(&quot;auth_db&quot;, &quot;db_url&quot;, &quot;mysql://opensips:test@localhost/opensips&quot;)</div>
<div>modparam(&quot;auth_db&quot;, &quot;calculate_ha1&quot;, 1)</div><div>modparam(&quot;auth_db&quot;, &quot;load_credentials&quot;, &quot;$avp(cred)=rpid;email_address&quot;)</div><div>modparam(&quot;auth_db&quot;, &quot;password_column&quot;, &quot;password&quot;)</div>
<div><br></div><div># EC - enable domain auth</div><div>modparam(&quot;auth_db&quot;, &quot;use_domain&quot;, 1)</div><div>loadmodule &quot;domain.so&quot;</div><div>modparam(&quot;domain&quot;, &quot;db_url&quot;, &quot;mysql://opensips:test@localhost/opensips&quot;)</div>
<div><br></div><div><br></div><div>route{<br></div><div><br></div><div><br></div><div><div><span class="" style="white-space:pre">        </span>if (!is_method(&quot;REGISTER&quot;)) {</div><div><span class="" style="white-space:pre">        </span># EC - auth</div>
<div><span class="" style="white-space:pre">        </span>if (!proxy_authorize(&quot;&quot;, &quot;subscriber&quot;)) {</div><div><span class="" style="white-space:pre">                        </span> xlog(&quot;proxy challenge!&quot;);</div><div><span class="" style="white-space:pre">                </span>proxy_challenge(&quot;&quot;, &quot;0&quot;);  # Realm will be autogenerated</div>
<div><span class="" style="white-space:pre">                </span>exit;</div><div><span class="" style="white-space:pre">        </span>}</div><div><br></div><div><span class="" style="white-space:pre">        </span>if (!db_check_from()) {</div><div>
<span class="" style="white-space:pre">                </span>  xlog(&quot;forbidden!&quot;);</div><div><span class="" style="white-space:pre">                        </span> sl_send_reply(&quot;403&quot;,&quot;Forbidden auth ID&quot;);</div><div><span class="" style="white-space:pre">                        </span> exit;</div>
<div><span class="" style="white-space:pre">                </span> }</div><div><span class="" style="white-space:pre">        </span>consume_credentials();</div><div><span class="" style="white-space:pre">        </span>} </div><div><span class="" style="white-space:pre">        </span></div>
<div><span class="" style="white-space:pre">        </span>#</div><div><span class="" style="white-space:pre">        </span>if (is_method(&quot;REGISTER&quot;)){</div><div><span class="" style="white-space:pre">        </span>if (!www_authorize(&quot;&quot;, &quot;subscriber&quot;)) {</div>
<div><span class="" style="white-space:pre">                </span> xlog(&quot;www challenge!&quot;);</div><div><span class="" style="white-space:pre">                </span>www_challenge(&quot;&quot;, &quot;0&quot;);  # Realm will be autogenerated</div>
<div><span class="" style="white-space:pre">                </span>exit;</div><div><span class="" style="white-space:pre">        </span>}</div><div><span class="" style="white-space:pre">        </span>if (!db_check_from()) {</div><div><span class="" style="white-space:pre">                </span>  xlog(&quot;forbidden!&quot;);</div>
<div><span class="" style="white-space:pre">                        </span> sl_send_reply(&quot;403&quot;,&quot;Forbidden auth ID&quot;);</div><div><span class="" style="white-space:pre">                        </span> exit;</div><div><span class="" style="white-space:pre">                </span> }</div>
<div><span class="" style="white-space:pre">        </span>xlog(&quot;register!&quot;);</div><div><span class="" style="white-space:pre">                </span>if (!save(&quot;location&quot;)) {</div><div><span class="" style="white-space:pre">                </span>xlog(&quot;failed to save location!&quot;);</div>
<div><span class="" style="white-space:pre">                        </span>sl_reply_error();</div><div><span class="" style="white-space:pre">        </span>}</div><div><span class="" style="white-space:pre">                </span> exit;</div><div><span class="" style="white-space:pre">        </span>}</div>
</div><div><br></div><div>}</div><div><br></div><div>If anyone can help that would be great! or else point me in the direction of examples of different authentication would be greatly appreciated .</div><div><br></div><div>
Thanks</div><div><br clear="all"><div><div dir="ltr">Alec Doran-Twyford<div><br><div>| Junior Support Enginner for IVSTel</div></div><div>| E-mail: <a href="mailto:a.dorantwyford@ivstel.com" target="_blank">a.dorantwyford@ivstel.com</a> | Phone: <a href="tel:%2B61%202%209288%208890" value="+61292888890" target="_blank">+61 2 9288 8890</a> |</div>

<div><br></div></div></div>
</div></div></div>