Passing SIP through TURN

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Benny,

As I don't have much time to be checking the PJSIP code to make a patch,
I've used another approach:

-- Instead of having two transports, disconnect UDP and then connect the
TURN one, I've created an "special" TURN transport that contains a UDP
transport inside. This is like "inheriting" the UDP transport, in some way.
-- It has an additional function, and by calling it I open the TURN and
this special transport redirects the SIP traffic through the TURN server.

I think this would be a "safer" way, as it is not usual for PJSIP
applications to be registering/unregistering transports during the normal
execution of the program.

Regards,
Guilherme Balena Versiani.



On Wed, Jun 6, 2012 at 11:48 PM, Benny Prijono <bennylp at teluu.com> wrote:

> On Thu, Jun 7, 2012 at 2:38 AM, Guilherme Balena Versiani <guibv at nymgo.com
> > wrote:
>
>> Hello,
>>
>>
>> My idea is basically pass the SIP traffic through a TURN server to
>> overcome some firewall limitations.
>>
>> I'm using PJSUA, registering an UDP transport
>> using pjsua_transport_create as usual, and, when I discover a timeout 408
>> during the first REGISTER, my idea was to close the previously created UDP
>> transport and register a new one. I've implemented a sip_transport_turn.c
>> based on the sip_transport_udp.c, and during the initialization it sends an
>> allocate request to TURN to listen to SIP packets. In the on_rx_data
>> callback, I am checking if this is the first time I am sending packets to
>> this destination, and, if so, I'm using the pj_turn_sock_set_perm to add
>> permission to send data.
>>
>> Everything is great in theory, but I am facing a lot of problems in PJSUA
>> code (I'm using PJSIP 2.0):
>>
>>     1 - I'm trying to close the UDP transport in the on_reg_state
>> callback from pjsua_acc, using the function pjsua_transport_close;
>>     1.1 - If I try to pass PJ_TRUE to force the destruction of the UDP
>> transport, there is an assertion error being thrown
>> in pjsip_transport_destroy:
>>
>>         PJ_ASSERT_RETURN(pj_atomic_get(tp->ref_cnt) == 0, PJSIP_EBUSY);
>>
>>
> Just to clarify, you are trying to close UDP SIP transport, not your TURN
> UDP SIP transport, right? The force=TRUE option, I'm afraid is not working.
> You should use FALSE and let pjsip destroy the transport once the reference
> counter is zero.
>
>
>>     1.2 - If I try to pass PJ_FALSE, then the UDP transport is smoothly
>> destroyed after a while, but in this case PJSUA maintains an invalid
>> pointer in pjsua_var structure (specifically in tpdata member).
>>
>>
> This shouldn't happen unless the transport is destroyed prematurely.
>
> Best regards
>  Benny
>
>
> As there is no examples of real use case scenarios using PJNATH and SIP
>> together, I'm clueless.
>>
>>
>> Regards,
>> Guilherme Balena Versiani.
>>
>> _______________________________________________
>> Visit our blog: http://blog.pjsip.org
>>
>> pjsip mailing list
>> pjsip at lists.pjsip.org
>> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>>
>>
>
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
>
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20120606/8ee88181/attachment.html>


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux