[Freeswitch-dev] help to correct sip stack to send to kamailio in mod_sofia

Håkon Nessjøen haakon.nessjoen at gmail.com
Sat Jun 29 00:37:17 MSD 2013


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.


On 13 June 2013 07:36, ThanhTruong <ngoc217thanh at yahoo.com> wrote:

> hi,
>
> 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.
>
> 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.
>
> Do you have any ideal in my case ?
>
> any code suggestion ?
>
> Thank you in advance .
>
> ThanhTruong
>   ------------------------------
>  *From:* Brian West <brian at freeswitch.org>
> *To:* freeswitch-dev at lists.freeswitch.org
> *Sent:* Thursday, June 13, 2013 12:25 PM
> *Subject:* Re: [Freeswitch-dev] help to correct sip stack to send to
> kamailio in mod_sofia
>
> Can you explain why you think you need to modify mod_sofia to make this
> work?
>
> /b
>
> On Jun 12, 2013, at 10:22 PM, ThanhTruong <ngoc217thanh at yahoo.com> wrote:
>
> > hi all,
> >
> > I am very new in sofia sip, and I am develop one register module for FS
> using sofia sip stack.
> >
> > in FS, when i receive REGISTER message, i am trying to send it to
> another registrar server (kamailio).
> >
> > I have implement my code in incoming REGISTER message like:
> >
> >        nua_set_params(profile->nua,
> >                    SIPTAG_FROM_STR("sip:101 at 192.168.1.112:5062"),
> >                    NUTAG_ENABLEMESSAGE(1),
> >                    NUTAG_ENABLEINVITE(1),
> >                    NUTAG_AUTOALERT(1),
> >                    NUTAG_SESSION_TIMER(0),
> >                    NUTAG_AUTOANSWER(0),
> >                    TAG_NULL());
> >
> >        nua_register(nh,
> >                  NUTAG_PROXY("sip:192.168.1.112:5062"),
> >                  NUTAG_REGISTRAR("sip:192.168.1.112:5062"), //registra
> uri
> >                  SIPTAG_FROM_STR("sip:192.168.1.112:5062"),
> >                  NUTAG_INSTANCE (0),
> >                  NUTAG_M_USERNAME("101"),
> >                  TAG_NULL());
> >
> > 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.
> >
> > With this code bellow, i send REGISTER message and get response in
> kamailio as:
> >
> > send 613 bytes to udp/[192.168.1.112]:5062 at 03:10:42.833439:
> >
> ------------------------------------------------------------------------
> >    REGISTER sip:101 at 192.168.3.122:42806;rinstance=7742cc70900998e8
> SIP/2.0
> >    Via: SIP/2.0/UDP 192.168.1.112;rport;branch=z9hG4bKBB44UFQ9ySjQK
> >    Max-Forwards: 70
> >    From: <sip:192.168.1.112:5062>;tag=DXeN4j2DFt27j
> >    To: "101" <sip:101 at 192.168.1.112>;tag=cd424d7d
> >    Call-ID: ac980e34-4e79-1231-71ba-3e508d3991e2
> >    CSeq: 45210457 REGISTER
> >    Contact: <sip:101 at 192.168.1.112>
> >    User-Agent:
> FreeSWITCH-mod_sofia/1.5.2b+git~20130527T075833Z~f3541e00f4
> >    Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE,
> REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
> >    Supported: timer, precondition, path, replaces
> >    Content-Length: 0
> >
> >
> > recv 325 bytes from udp/[192.168.1.112]:5062 at 03:10:42.834220:
> >
> ------------------------------------------------------------------------
> >    SIP/2.0 404 Not here
> >    Via: SIP/2.0/UDP 192.168.1.112;rport=5060;branch=z9hG4bKBB44UFQ9ySjQK
> >    From: <sip:192.168.1.112:5062>;tag=DXeN4j2DFt27j
> >    To: "101" <sip:101 at 192.168.1.112>;tag=cd424d7d
> >    Call-ID: ac980e34-4e79-1231-71ba-3e508d3991e2
> >    CSeq: 45210457 REGISTER
> >    Server: kamailio (4.0.1 (x86_64/linux))
> >    Content-Length: 0
> >
> >
> > Then, I see that structure of SIP REGISTER message is not correct.
> >
> > Can some one help me to construct this message to send to kamailio ?
> > May we dont care about nua_create ? just using nua_set_params or
> nua_register or nua_options ?
> >
> > Thank all in advance.
> >
> > ThanhTruong
> >
> > _________________________________________________________________________
> > Professional FreeSWITCH Consulting Services:
> > consulting at freeswitch.org
> > http://www.freeswitchsolutions.com
> >
> > 
> > 
> >
> > Official FreeSWITCH Sites
> > http://www.freeswitch.org
> > http://wiki.freeswitch.org
> > http://www.cluecon.com
> >
> > FreeSWITCH-dev mailing list
> > FreeSWITCH-dev at lists.freeswitch.org
> > http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> > UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> > http://www.freeswitch.org
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-dev mailing list
> FreeSWITCH-dev at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org
>
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-dev mailing list
> FreeSWITCH-dev at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org
>
>


-- 
Håkon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20130628/a3d8647e/attachment-0001.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-dev mailing list