Destroy and recreate TCP transport when the connection change

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

 



Hi,

We're building a phone application which is using pjsip as the sip stack.

Everytime the connection changes, (i.e. you change from a WiFi connection
to a 3G connection), we need to recreate the transport, because of the
previous transport is no longer valid.

Right now, whenever we detect that connection change, we're "destroying"
the full pjsip stack (calling pjsua_destroy()) and proceeding the same as
the first start.
This works perfectly but pjsua_destroy() blocks the thread (which happens
to be the main thread) for a while.

We would like to be able to destroy the transport without destroy the full
stack of pjsip.

To achieve this, we have replaced the pjsua_destroy() with
pjsip_transport_shutdown(), but this replacement have some implications:

* How can we get the transport reference in this "transport_destroy()"
function?.
Right now, we are saving the transport in a static variable which is set in
the "on_transport_state" callback.

* When we call pjsip_init again, this Assert fails:
Assertion failed: (pj_list_find_node(&endpt->module_list, mod) == mod),
function pjsip_endpt_unregister_module, file ../src/pjsip/sip_endpoint.c,
line 229.

* As Benny told in this email (
http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2008-February/001868.html)
the transport is not destroyed at that time.
What happens if we try to connect to the same server? Do pjsip try to reuse
the "shutdown-but-not-destroyed" transport, which is no longer valid?

Which is the best method to create a new transport (and send a new REGISTER
message) everytime the connection of the phone changes?

Thanks in advance.
Roberto.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20120416/b81dc899/attachment-0001.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