res_pjsip_session: Add overlap_context option.

Adds the overlap_context option, which can be used
to explicitly specify a context to use for overlap
dialing extension matches, rather than forcibly
using the context configured for the endpoint.

ASTERISK-30262 #close

Change-Id: Ibbcd4a8b11402428a187fb56b8d4e7408774a0db
This commit is contained in:
Naveen Albert
2022-10-13 13:45:26 +00:00
committed by George Joseph
parent 1da489a434
commit d1bec3623e
8 changed files with 51 additions and 2 deletions

View File

@@ -3713,8 +3713,10 @@ static enum sip_get_destination_result get_destination(struct ast_sip_session *s
fetch_callerid_num(session, rdata, cid_num, sizeof(cid_num));
/* If there's an overlap_context override specified, use that; otherwise, just use the endpoint's context */
if (!strcmp(session->exten, pickupexten) ||
ast_exists_extension(NULL, session->endpoint->context, session->exten, 1, S_OR(cid_num, NULL))) {
ast_exists_extension(NULL, S_OR(session->endpoint->overlap_context, session->endpoint->context), session->exten, 1, S_OR(cid_num, NULL))) {
/*
* Save off the INVITE Request-URI in case it is
* needed: CHANNEL(pjsip,request_uri)
@@ -3729,7 +3731,7 @@ static enum sip_get_destination_result get_destination(struct ast_sip_session *s
*/
if (session->endpoint->allow_overlap && (
!strncmp(session->exten, pickupexten, strlen(session->exten)) ||
ast_canmatch_extension(NULL, session->endpoint->context, session->exten, 1, S_OR(cid_num, NULL)))) {
ast_canmatch_extension(NULL, S_OR(session->endpoint->overlap_context, session->endpoint->context), session->exten, 1, S_OR(cid_num, NULL)))) {
/* Overlap partial match */
return SIP_GET_DEST_EXTEN_PARTIAL;
}