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); 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). As there is no examples of real use case scenarios using PJNATH and SIP together, I'm clueless. Regards, Guilherme Balena Versiani. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20120606/ed65d22d/attachment.html>