diff options
author | Benny Prijono <bennylp@teluu.com> | 2009-08-17 15:33:45 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2009-08-17 15:33:45 +0000 |
commit | 11cfa6f01fae0418234b517996d86094632f6e17 (patch) | |
tree | db0a05e93e473b9a9983f89b4a2bb53182a6c000 /pjsip-apps | |
parent | d29873572ef5ef79cf37c76247b4eecd8928ec53 (diff) |
Misc (ticket #915): added reload command in pjsua to shutdown and reinitialize the library
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2892 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip-apps')
-rw-r--r-- | pjsip-apps/src/pjsua/main.c | 21 | ||||
-rw-r--r-- | pjsip-apps/src/pjsua/pjsua_app.c | 10 |
2 files changed, 21 insertions, 10 deletions
diff --git a/pjsip-apps/src/pjsua/main.c b/pjsip-apps/src/pjsua/main.c index 79235308..37941efe 100644 --- a/pjsip-apps/src/pjsua/main.c +++ b/pjsip-apps/src/pjsua/main.c @@ -23,8 +23,9 @@ /* - * These are defined in pjsua.c. + * These are defined in pjsua_app.c. */ +extern pj_bool_t app_restart; pj_status_t app_init(int argc, char *argv[]); pj_status_t app_main(void); pj_status_t app_destroy(void); @@ -75,16 +76,20 @@ static void setup_signal_handler(void) int main(int argc, char *argv[]) { - if (app_init(argc, argv) != PJ_SUCCESS) - return 1; + do { + app_restart = PJ_FALSE; - setup_signal_handler(); + if (app_init(argc, argv) != PJ_SUCCESS) + return 1; - app_main(); - app_destroy(); + setup_signal_handler(); - /* This is on purpose */ - app_destroy(); + app_main(); + app_destroy(); + + /* This is on purpose */ + app_destroy(); + } while (app_restart); return 0; } diff --git a/pjsip-apps/src/pjsua/pjsua_app.c b/pjsip-apps/src/pjsua/pjsua_app.c index 36967d6a..0e9e50fd 100644 --- a/pjsip-apps/src/pjsua/pjsua_app.c +++ b/pjsip-apps/src/pjsua/pjsua_app.c @@ -146,6 +146,7 @@ static void ringback_start(pjsua_call_id call_id); static void ring_start(pjsua_call_id call_id); static void ring_stop(pjsua_call_id call_id); +pj_bool_t app_restart; /***************************************************************************** * Configuration manipulation @@ -2823,7 +2824,7 @@ static void keystroke_help(void) puts("| | V Adjust audio Volume | f Save config |"); puts("| S Send arbitrary REQUEST | Cp Codec priorities | f Save config |"); puts("+------------------------------+--------------------------+-------------------+"); - puts("| q QUIT sleep MS echo [0|1|txt] n: detect NAT type |"); + puts("| q QUIT L ReLoad sleep MS echo [0|1|txt] n: detect NAT type |"); puts("+=============================================================================+"); i = pjsua_call_get_count(); @@ -4103,10 +4104,13 @@ void console_app_main(const pj_str_t *uri_to_call) break; + case 'L': /* Restart */ + app_restart = PJ_TRUE; + /* Continues below */ + case 'q': goto on_exit; - case 'R': if (!pjsua_call_is_active(current_call)) { PJ_LOG(1,(THIS_FILE, "Call %d has gone", current_call)); @@ -4238,6 +4242,8 @@ pj_status_t app_init(int argc, char *argv[]) unsigned i; pj_status_t status; + app_restart = PJ_FALSE; + /* Create pjsua */ status = pjsua_create(); if (status != PJ_SUCCESS) |