> 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, -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20090218/a88c4319/attachment.html>