From 731459be7148a6a7443ff482b4da07811f0e1dc9 Mon Sep 17 00:00:00 2001 From: Oleksandr Gershkul Date: Tue, 12 Mar 2024 20:18:02 +0200 Subject: [PATCH] Implement SDP offer login in pjsua_app_cli --- pjsip-apps/src/pjsua/pjsua_app_cli.c | 40 ++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/pjsip-apps/src/pjsua/pjsua_app_cli.c b/pjsip-apps/src/pjsua/pjsua_app_cli.c index bf2237eda6..eb0e3f000a 100644 --- a/pjsip-apps/src/pjsua/pjsua_app_cli.c +++ b/pjsip-apps/src/pjsua/pjsua_app_cli.c @@ -38,6 +38,7 @@ #define CMD_QUIT 110 #define CMD_RESTART 120 #define CMD_HANDLE_IP_CHANGE 130 +#define CMD_TOGGLE_SDP_OFFER 140 /* call level 2 command */ #define CMD_CALL_NEW ((CMD_CALL*10)+1) @@ -1537,6 +1538,9 @@ static pj_status_t cmd_make_single_call(pj_cli_cmd_val *cval) pjsua_msg_data_init(&msg_data); TEST_MULTIPART(&msg_data); + if (app_config.enable_loam) { + call_opt.flag |= PJSUA_CALL_NO_SDP_OFFER; + } pjsua_call_make_call(current_acc, &tmp, &call_opt, NULL, &msg_data, ¤t_call); @@ -1582,6 +1586,10 @@ static pj_status_t cmd_make_multi_call(pj_cli_cmd_val *cval) tmp = pj_str(result.uri_result); } + if (app_config.enable_loam) { + call_opt.flag |= PJSUA_CALL_NO_SDP_OFFER; + } + for (i=0; iargv[1].ptr, "y", 1) == 0) { + app_config.enable_loam = 0; + } else { + app_config.enable_loam = 1; + } + + return PJ_SUCCESS; +} + /* Call handler */ pj_status_t cmd_call_handler(pj_cli_cmd_val *cval) { @@ -3221,12 +3244,22 @@ static pj_status_t add_other_command(pj_cli_t *c) char* ip_change_command = ""; + char* toggle_sdp_offer_command = + "" + " " + " " + " " + " " + ""; + pj_status_t status; pj_str_t sleep_xml = pj_str(sleep_command); pj_str_t network_xml = pj_str(network_command); pj_str_t shutdown_xml = pj_str(shutdown_command); pj_str_t restart_xml = pj_str(restart_command); pj_str_t ip_change_xml = pj_str(ip_change_command); + pj_str_t toggle_sdp_offer_xml = pj_str(toggle_sdp_offer_command); status = pj_cli_add_cmd_from_xml(c, NULL, &sleep_xml, cmd_sleep_handler, @@ -3257,6 +3290,13 @@ static pj_status_t add_other_command(pj_cli_t *c) status = pj_cli_add_cmd_from_xml(c, NULL, &ip_change_xml, cmd_ip_change_handler, NULL, NULL); + if (status != PJ_SUCCESS) + return status; + + status = pj_cli_add_cmd_from_xml(c, NULL, + &toggle_sdp_offer_xml, + cmd_toggle_call_sdp_offer, + NULL, NULL); return status; }