Yes, it may work. But more better way is to check media stream if your app handle RTP/RTCP packets. If you only handle SIP signal, you can use re-INVITE to check whether call is alive. And in the future we will use session timer until timer supported by pjsip . regards, Gang On Wed, Feb 18, 2009 at 5:52 PM, Ignacio S?nchez <ignacio.sanchez at vocali.net> wrote: >> Hi, >> >> I'm trying to communicate two computers using PJSUA via TCP. >> When one of the sides crash, loss the connection or something similar - >> and >> so, finished abnormally the communication - ?the other does not finish the >> call. >> What can I do to finish the call in the side is still alive? >> >> Thanks... >> > > Hi again, > > I found a possible solution to solve my problem. This is to check > periodically the call alive, and if fail, hangup the call. > > --- pjproject-1.0-org/pjsip-apps/src/pjsua/pjsua_app.c 2009-02-18 > 09:51:46.000000000 +0100 > +++ pjproject-1.0/pjsip-apps/src/pjsua/pjsua_app.c 2009-02-18 > 10:07:30.000000000 +0100 > @@ -4278,6 +4278,21 @@ > return 0; > } > > +/* Call alive verifier method */ > +static int check_alive_call(void *arg) { > + const pj_str_t SIP_INFO = pj_str("INFO"); > + while (1) { > + sleep(4); > + if (current_call != PJSUA_INVALID_ID) { > + /* If can't send call request, hangup... */ > + pj_status_t status = pjsua_call_send_request(current_call, > &SIP_INFO, NULL); > + } > + } > + return 0; > +} > + > +pthread_t t; > + > pj_status_t app_main(void) > { > pj_thread_t *stdout_refresh_thread = NULL; > @@ -4290,6 +4305,12 @@ > return status; > } > > + pj_thread_t *check_alive_call_thread= NULL; > + > + /* Start call alive verifier */ > + pj_thread_create(app_config.pool, "check_alive_call", > &check_alive_call, > + NULL, 0, 0, &check_alive_call_thread); > + > /* Start console refresh thread */ > if (stdout_refresh > 0) { > pj_thread_create(app_config.pool, "stdout", &stdout_refresh_proc, > > _______________________________________________ > 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 > >