<div dir="ltr">Why not put Kamailio in front of the freeswitch server? Then it will handle the register messages, and you can tell it to forward all SIP messages to freeswitch if it was authenticated. Thats the usual way to do it, I would guess.</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On 13 June 2013 07:36, ThanhTruong <span dir="ltr">&lt;<a href="mailto:ngoc217thanh@yahoo.com" target="_blank">ngoc217thanh@yahoo.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div style="font-size:12pt;font-family:times new roman,new york,times,serif"><div><span>hi,</span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif">
<span><br></span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif"><span>In mod_sofia, it handle REGISTER message, and I want to route this message to kamailio server, then kamailio will return 401, then, we can use sofia-sip (in UA) to authenticate with kamailio, if 200OK return from kamailio, i will return 200ok back to sip client.</span></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif"><span><br></span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif">
<span>In this case, I think i need to change code in handle register in mod_sofia. But this is in mind, and code in mod_sofia is very complex, I can find where to send REGISTER message to kamailio but message is not correct, kamailio cant understand this message.</span></div>
<div style="font-style:normal;font-size:16px;background-color:transparent;font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif"><span><br></span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif">
<span>Do you have any ideal in my case ?</span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif"><span><br></span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif">
<span>any code suggestion ?</span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif"><span><br></span></div><div style="font-style:normal;font-size:16px;background-color:transparent;font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif">
<span>Thank you in advance .</span></div><span class="HOEnZb"><font color="#888888"><div></div><div> </div><div>ThanhTruong<br></div>  </font></span><div style="font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif;font-size:12pt">
<span class="HOEnZb"><font color="#888888"> </font></span><div style="font-family:&#39;times new roman&#39;,&#39;new york&#39;,times,serif;font-size:12pt"><span class="HOEnZb"><font color="#888888"> <div dir="ltr"> <hr size="1">
  <font face="Arial"> <b><span style="font-weight:bold">From:</span></b> Brian West &lt;<a href="mailto:brian@freeswitch.org" target="_blank">brian@freeswitch.org</a>&gt;<br> <b><span style="font-weight:bold">To:</span></b> <a href="mailto:freeswitch-dev@lists.freeswitch.org" target="_blank">freeswitch-dev@lists.freeswitch.org</a> <br>
 <b><span style="font-weight:bold">Sent:</span></b> Thursday, June 13, 2013 12:25 PM<br> <b><span style="font-weight:bold">Subject:</span></b> Re: [Freeswitch-dev] help to correct sip stack to send to kamailio
        in mod_sofia<br> </font> </div></font></span><div><div class="h5"> <div><br>Can you explain why you think you need to modify mod_sofia to make this work?<br><br>/b<br><br>On Jun 12, 2013, at 10:22 PM, ThanhTruong &lt;<a href="mailto:ngoc217thanh@yahoo.com" target="_blank">ngoc217thanh@yahoo.com</a>&gt; wrote:<br>
<br>&gt; hi all,<br>&gt; <br>&gt; I am very new in sofia sip, and I am develop one register module for FS using sofia sip stack.<br>&gt; <br>&gt; in FS, when i receive REGISTER message, i am trying to send it to another registrar server (kamailio).<br>
&gt; <br>&gt; I have implement my code in incoming REGISTER message like:<br>&gt; <br>&gt;         nua_set_params(profile-&gt;nua,<br>&gt;                    SIPTAG_FROM_STR(&quot;sip:<a href="mailto:101@192.168.1.112" target="_blank">101@192.168.1.112</a>:5062&quot;),<br>
&gt;       
             NUTAG_ENABLEMESSAGE(1),<br>&gt;                    NUTAG_ENABLEINVITE(1),<br>&gt;                    NUTAG_AUTOALERT(1),<br>&gt;                    NUTAG_SESSION_TIMER(0),<br>&gt;                    NUTAG_AUTOANSWER(0),<br>
&gt;                    TAG_NULL());<br>&gt; <br>&gt;         nua_register(nh,<br>&gt;                  NUTAG_PROXY(&quot;sip:<a href="http://192.168.1.112:5062" target="_blank">192.168.1.112:5062</a>&quot;),<br>&gt;                  NUTAG_REGISTRAR(&quot;sip:<a href="http://192.168.1.112:5062" target="_blank">192.168.1.112:5062</a>&quot;), //registra uri<br>
&gt;                 
 SIPTAG_FROM_STR(&quot;sip:<a href="http://192.168.1.112:5062" target="_blank">192.168.1.112:5062</a>&quot;),<br>&gt;                  NUTAG_INSTANCE (0),<br>&gt;                  NUTAG_M_USERNAME(&quot;101&quot;),<br>&gt;                  TAG_NULL());<br>
&gt; <br>&gt; I have one account 101/xxxx in kamailio, i want to register from softphone to FS, FS send register and process authentication with kamailio, then return 200OK back to softphone.<br>&gt; <br>&gt; With this code bellow, i send REGISTER message and get response in kamailio as:<br>
&gt; <br>&gt; send 613 bytes to udp/[192.168.1.112]:5062 at 03:10:42.833439:<br>&gt;    ------------------------------------------------------------------------<br>&gt;    REGISTER sip:<a href="mailto:101@192.168.3.122" target="_blank">101@192.168.3.122</a>:42806;rinstance=7742cc70900998e8 SIP/2.0<br>
&gt;   
 Via: SIP/2.0/UDP 192.168.1.112;rport;branch=z9hG4bKBB44UFQ9ySjQK<br>&gt;    Max-Forwards: 70<br>&gt;    From: &lt;sip:<a href="http://192.168.1.112:5062" target="_blank">192.168.1.112:5062</a>&gt;;tag=DXeN4j2DFt27j<br>&gt;    To: &quot;101&quot; &lt;sip:<a href="mailto:101@192.168.1.112" target="_blank">101@192.168.1.112</a>&gt;;tag=cd424d7d<br>
&gt;    Call-ID: ac980e34-4e79-1231-71ba-3e508d3991e2<br>&gt;    CSeq: 45210457 REGISTER<br>&gt;    Contact: &lt;sip:<a href="mailto:101@192.168.1.112" target="_blank">101@192.168.1.112</a>&gt;<br>&gt;    User-Agent: FreeSWITCH-mod_sofia/1.5.2b+git~20130527T075833Z~f3541e00f4<br>
&gt;    Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE<br>&gt;    Supported: timer, precondition, path, replaces<br>&gt;    Content-Length: 0<br>&gt;    <br>&gt; <br>
&gt; recv 325 bytes from
 udp/[192.168.1.112]:5062 at 03:10:42.834220:<br>&gt;    ------------------------------------------------------------------------<br>&gt;    SIP/2.0 404 Not here<br>&gt;    Via: SIP/2.0/UDP 192.168.1.112;rport=5060;branch=z9hG4bKBB44UFQ9ySjQK<br>
&gt;    From: &lt;sip:<a href="http://192.168.1.112:5062" target="_blank">192.168.1.112:5062</a>&gt;;tag=DXeN4j2DFt27j<br>&gt;    To: &quot;101&quot; &lt;sip:<a href="mailto:101@192.168.1.112" target="_blank">101@192.168.1.112</a>&gt;;tag=cd424d7d<br>
&gt;    Call-ID: ac980e34-4e79-1231-71ba-3e508d3991e2<br>&gt;    CSeq: 45210457 REGISTER<br>&gt;    Server: kamailio (4.0.1 (x86_64/linux))<br>&gt;    Content-Length: 0<br>&gt;    <br>&gt; <br>&gt; Then, I see that structure of SIP REGISTER message is not correct.<br>
&gt; <br>&gt; Can some one help me to construct this message to send to kamailio ?<br>&gt; May we dont care about nua_create ? just using
 nua_set_params or nua_register or nua_options ?<br>&gt; <br>&gt; Thank all in advance.<br>&gt;  <br>&gt; ThanhTruong<br>&gt; <br>&gt; _________________________________________________________________________<br>&gt; Professional FreeSWITCH Consulting Services:<br>
&gt; <a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>&gt; <a href="http://www.freeswitchsolutions.com/" target="_blank">http://www.freeswitchsolutions.com</a><br>&gt; <br>&gt; FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
&gt; <a href="http://www.cudatel.com/" target="_blank">http://www.cudatel.com</a><br>&gt; <br>&gt; Official FreeSWITCH Sites<br>&gt; <a href="http://www.freeswitch.org/" target="_blank">http://www.freeswitch.org</a><br>&gt; <a href="http://wiki.freeswitch.org/" target="_blank">http://wiki.freeswitch.org</a><br>
&gt; <a href="http://www.cluecon.com/" target="_blank">http://www.cluecon.com</a><br>&gt; <br>&gt; FreeSWITCH-dev mailing list<br>&gt; <a href="mailto:FreeSWITCH-dev@lists.freeswitch.org" target="_blank">FreeSWITCH-dev@lists.freeswitch.org</a><br>
&gt; <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev</a><br>&gt; UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-dev</a><br>
&gt; <a href="http://www.freeswitch.org/" target="_blank">http://www.freeswitch.org</a><br><br><br>_________________________________________________________________________<br>Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br><a href="http://www.freeswitchsolutions.com/" target="_blank">http://www.freeswitchsolutions.com</a><br><br>FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com/" target="_blank">http://www.cudatel.com</a><br><br>Official FreeSWITCH Sites<br><a href="http://www.freeswitch.org/" target="_blank">http://www.freeswitch.org</a><br><a href="http://wiki.freeswitch.org/" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com/" target="_blank">http://www.cluecon.com</a><br><br>FreeSWITCH-dev mailing list<br><a href="mailto:FreeSWITCH-dev@lists.freeswitch.org" target="_blank">FreeSWITCH-dev@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev</a><br>UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-dev</a><br>
<a href="http://www.freeswitch.org/" target="_blank">http://www.freeswitch.org</a><br><br><br></div> </div></div></div> </div>  </div></div><br>_________________________________________________________________________<br>

Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-dev mailing list<br>
<a href="mailto:FreeSWITCH-dev@lists.freeswitch.org">FreeSWITCH-dev@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-dev" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-dev</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Håkon<br>
</div>