Skip to content

Commit

Permalink
Enable Late Offer Answer Mode (LOAM) feature in the pjsua
Browse files Browse the repository at this point in the history
This feature enables empty SDP in the INVITE request. The messages
exchanged between the caller (user agent client) and the called
party (user agent server) are identical, but responsibility for
choosing the media shifts from one to the other.
  • Loading branch information
Oleksandr-Goodicus committed Feb 22, 2024
1 parent b0be170 commit 91cb0ca
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
3 changes: 3 additions & 0 deletions pjsip-apps/src/pjsua/pjsua_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -1998,6 +1998,9 @@ static pj_status_t app_init(void)
pjsua_call_setting_default(&call_opt);
call_opt.aud_cnt = app_config.aud_cnt;
call_opt.vid_cnt = app_config.vid.vid_cnt;
if (app_config.enable_loam) {
call_opt.flag |= PJSUA_CALL_NO_SDP_OFFER;
}

#if defined(PJSIP_HAS_TLS_TRANSPORT) && PJSIP_HAS_TLS_TRANSPORT!=0
/* Wipe out TLS key settings in transport configs */
Expand Down
1 change: 1 addition & 0 deletions pjsip-apps/src/pjsua/pjsua_app_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ typedef struct pjsua_app_config
pj_bool_t ipv6;
pj_bool_t enable_qos;
pj_bool_t no_mci;
pj_bool_t enable_loam;
pj_bool_t no_tcp;
pj_bool_t no_udp;
pj_bool_t use_tls;
Expand Down
14 changes: 13 additions & 1 deletion pjsip-apps/src/pjsua/pjsua_app_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ static void usage(void)
#endif
puts (" --set-qos Enable QoS tagging for SIP and media.");
puts (" --no-mci Disable message composition indication (RFC 3994)");
puts (" --set-loam Enable Late offer answer model");
puts (" --local-port=port Set TCP/UDP port. This implicitly enables both ");
puts (" TCP and UDP transports on the specified port, unless");
puts (" if TCP or UDP is disabled.");
Expand Down Expand Up @@ -393,7 +394,8 @@ static pj_status_t parse_args(int argc, char *argv[],
OPT_TLS_NEG_TIMEOUT, OPT_TLS_CIPHER,
OPT_CAPTURE_DEV, OPT_PLAYBACK_DEV,
OPT_CAPTURE_LAT, OPT_PLAYBACK_LAT, OPT_NO_TONES, OPT_JB_MAX_SIZE,
OPT_STDOUT_REFRESH, OPT_STDOUT_REFRESH_TEXT, OPT_IPV6, OPT_QOS, OPT_MCI,
OPT_STDOUT_REFRESH, OPT_STDOUT_REFRESH_TEXT, OPT_IPV6, OPT_QOS,
OPT_MCI, OPT_LOAM,
#ifdef _IONBF
OPT_STDOUT_NO_BUF,
#endif
Expand Down Expand Up @@ -535,6 +537,7 @@ static pj_status_t parse_args(int argc, char *argv[],
#endif
{ "set-qos", 0, 0, OPT_QOS},
{ "no-mci", 0, 0, OPT_MCI},
{ "set-loam", 0, 0, OPT_LOAM},
{ "use-timer", 1, 0, OPT_TIMER},
{ "timer-se", 1, 0, OPT_TIMER_SE},
{ "timer-min-se", 1, 0, OPT_TIMER_MIN_SE},
Expand Down Expand Up @@ -1471,6 +1474,9 @@ static pj_status_t parse_args(int argc, char *argv[],
case OPT_MCI:
cfg->no_mci = PJ_TRUE;
break;
case OPT_LOAM:
cfg->enable_loam = PJ_TRUE;
break;
case OPT_VIDEO:
cfg->vid.vid_cnt = 1;
cfg->vid.in_auto_show = PJ_TRUE;
Expand Down Expand Up @@ -1988,6 +1994,12 @@ int write_settings(pjsua_app_config *config, char *buf, pj_size_t max)
if (config->no_mci) {
pj_strcat2(&cfg, "--no-mci\n");
}

/* Late Offer Answer Model */
if (config->enable_loam) {
pj_strcat2(&cfg, "--set-loam\n");
}

/* UDP Transport. */
pj_ansi_snprintf(line, sizeof(line), "--local-port %d\n",
config->udp_cfg.port);
Expand Down
10 changes: 10 additions & 0 deletions pjsip-apps/src/pjsua/pjsua_app_legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,9 @@ static void ui_make_new_call()

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_, &current_call);

Expand Down Expand Up @@ -773,6 +776,10 @@ static void ui_make_multi_call()
tmp = pj_str(result.uri_result);
}

if (app_config.enable_loam) {
call_opt.flag |= PJSUA_CALL_NO_SDP_OFFER;
}

for (i=0; i<my_atoi(menuin); ++i) {
pj_status_t status;

Expand Down Expand Up @@ -1099,6 +1106,9 @@ static void ui_call_reinvite()
static void ui_send_update()
{
if (current_call != -1) {
if (app_config.enable_loam) {
call_opt.flag |= PJSUA_CALL_NO_SDP_OFFER;
}
pjsua_call_update2(current_call, &call_opt, NULL);
} else {
PJ_LOG(3,(THIS_FILE, "No current call"));
Expand Down

0 comments on commit 91cb0ca

Please sign in to comment.