Questions about trying reregistration message when the connection is lost

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

 



Hi,

In order to support rfc5626, when a connection is lost, you should try to
send the register message again.
Browsing the code I realized that there actually is a function which
performs this task. The name of this function is
"pjsua_acc_on_tp_state_changed" which is in  pjsua_acc.c file line 2765.

This function is called by a callback set on the transport when it is
created and implemented by "on_tp_state_callback" (pjsua_core.c:1590)
function.
But, this callback is only set if the user provides its own callback, as you
can tell by this piece of code of pjsua_transport_create (pjsua_core.c:1943)

if (pjsua_var.ua_cfg.cb.on_transport_state) {
>        pjsip_tp_state_callback tpcb;
>        pjsip_tpmgr *tpmgr;
>        tpmgr = pjsip_endpt_get_tpmgr(pjsua_var.endpt);
>        tpcb = pjsip_tpmgr_get_state_cb(tpmgr);
>        if (tpcb != &on_tp_state_callback) {
>            pjsua_var.old_tp_cb = tpcb;
>            pjsip_tpmgr_set_state_cb(tpmgr, &on_tp_state_callback);
>        }
> }


So, if the user doesn't set any custom transport state callback, the
"on_tp_state_callback" is not set, and therefore, the reregistration is not
sent when the connection is lost.

Why is this working in this way?, Why is it necessary that the user have to
provide a custom callback for setting the reregistration callback
(pjsua_acc_on_tp_state_changed)?

Is this a bug? :)

Talking about the reregistration whenever the connection fails, as far as i
know and how that seems to work now, you need to send something in order to
realize that the connection has been interrupted (like for example the keep
alive), but if you scheduled a timer to send a keep alive every 30 minutes,
and the connection is lost just after a keep alive is sent, you need to wait
those 30 mins to realize the connection is broken, which is a long time
without any connection.

Is it possible to subscribe to some notification method of the underlying
Operating System in order to be notified when some interface has lost the
connection?

In a more precise way, if we talk about the iPhone. When the application is
on background, the only way to execute code of the application is by setting
a background timer which will execute a piece of code every given time, so,
we need to wait until that background handler is executed to send the keep
alive, and wait one more cycle to realize the connection is down. This is a
way too long time to leave the client un-communicated.

Do you know if there are any method to realize when the connection has been
broken and re-establish it?

Thanks in advance :)

Regards.
Roberto.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20111018/6a290d3e/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