res_pjsip: Add 100rel option "peer_supported".

This patch adds a new option to the 100rel parameter for pjsip
endpoints called "peer_supported". When an endpoint with this option
receives an incoming request and the request indicated support for the
100rel extension, then Asterisk will send 1xx responses reliably. If
the request did not indicate 100rel support, Asterisk sends 1xx
responses normally.

ASTERISK-30158

Change-Id: Id6d95ffa8f00dab118e0b386146e99f254f287ad
This commit is contained in:
Maximilian Fridrich
2022-07-26 15:40:26 +02:00
committed by Friendly Automation
parent ef20afda63
commit 2efcb5890e
6 changed files with 134 additions and 7 deletions

View File

@@ -182,9 +182,16 @@ static int prack_handler(const struct aco_option *opt, struct ast_variable *var,
if (ast_true(var->value)) {
endpoint->extensions.flags |= PJSIP_INV_SUPPORT_100REL;
endpoint->rel100 = AST_SIP_100REL_SUPPORTED;
} else if (!strcasecmp(var->value, "peer_supported")) {
endpoint->extensions.flags |= PJSIP_INV_SUPPORT_100REL;
endpoint->rel100 = AST_SIP_100REL_PEER_SUPPORTED;
} else if (!strcasecmp(var->value, "required")) {
endpoint->extensions.flags |= PJSIP_INV_REQUIRE_100REL;
} else if (!ast_false(var->value)){
endpoint->rel100 = AST_SIP_100REL_REQUIRED;
} else if (ast_false(var->value)) {
endpoint->rel100 = AST_SIP_100REL_UNSUPPORTED;
} else {
return -1;
}
@@ -195,10 +202,12 @@ static int prack_to_str(const void *obj, const intptr_t *args, char **buf)
{
const struct ast_sip_endpoint *endpoint = obj;
if (endpoint->extensions.flags & PJSIP_INV_REQUIRE_100REL) {
*buf = "required";
} else if (endpoint->extensions.flags & PJSIP_INV_SUPPORT_100REL) {
if (endpoint->rel100 == AST_SIP_100REL_SUPPORTED) {
*buf = "yes";
} else if (endpoint->rel100 == AST_SIP_100REL_PEER_SUPPORTED) {
*buf = "peer_supported";
} else if (endpoint->rel100 == AST_SIP_100REL_REQUIRED) {
*buf = "required";
} else {
*buf = "no";
}