diff --git a/res/res_pjsip/pjsip_config.xml b/res/res_pjsip/pjsip_config.xml index 270f79049c..eb78ac32b1 100644 --- a/res/res_pjsip/pjsip_config.xml +++ b/res/res_pjsip/pjsip_config.xml @@ -1274,12 +1274,24 @@ 12.0.0 String placed as the username portion of an SDP origin (o=) line. + + The username portion of an SDP origin to be used in the SDP 'o=' line. + Note: If this option is left empty or set only to whitespace, it will + automatically default to a hyphen ('-') to ensure compliance + with RFC 8866. + 12.0.0 String used for the SDP session (s=) line. + + The session name to be used in the SDP 's=' line. + Note: If this option is left empty or set only to whitespace, it will + automatically default to a hyphen ('-') to ensure compliance + with RFC 8866. + diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c index e23cc71916..cfc1456004 100644 --- a/res/res_pjsip/pjsip_configuration.c +++ b/res/res_pjsip/pjsip_configuration.c @@ -1650,6 +1650,18 @@ static int sip_endpoint_apply_handler(const struct ast_sorcery *sorcery, void *o return -1; } + if (ast_strlen_zero(endpoint->media.sdpsession) || !*ast_skip_blanks(endpoint->media.sdpsession)) { + ast_log(LOG_WARNING, "SDP session was set to empty on endpoint '%s'. Not permitted as per RFC8866. SDP session set to '-'. \n", + ast_sorcery_object_get_id(endpoint)); + ast_string_field_set(endpoint, media.sdpsession, "-"); + } + + if (ast_strlen_zero(endpoint->media.sdpowner) || *ast_skip_nonblanks(ast_skip_blanks(endpoint->media.sdpowner))) { + ast_log(LOG_WARNING, "SDP origin username on endpoint '%s' is empty or contains spaces ('%s'). Not permitted as per RFC8866. Setting to '-'.\n", + ast_sorcery_object_get_id(endpoint), endpoint->media.sdpowner); + ast_string_field_set(endpoint, media.sdpowner, "-"); + } + if (ast_rtp_dtls_cfg_validate(&endpoint->media.rtp.dtls_cfg)) { return -1; }