res_pjsip_session: Use Caller ID for extension matching.

Currently, there is no Caller ID available to us when
checking for an extension match when handling INVITEs.
As a result, extension patterns that depend on the Caller ID
are not matched and calls may be incorrectly rejected.

The Caller ID is not available because the supplement that
adds Caller ID to the session does not execute until after
this check. Supplement callbacks cannot yet be executed
at this point since the session is not yet in the appropriate
state.

To fix this without impacting existing behavior, the Caller ID
number is now retrieved before attempting to pattern match.
This ensures pattern matching works correctly and there is
no behavior change to the way supplements are called.

ASTERISK-28767 #close

Change-Id: Iec7f5a3b90e51b65ccf74342f96bf80314b7cfc7
This commit is contained in:
Naveen Albert
2022-11-26 12:54:29 +00:00
committed by Friendly Automation
parent f86d2a211c
commit c4066871d8
4 changed files with 271 additions and 226 deletions

View File

@@ -3603,6 +3603,25 @@ struct ast_sip_service_route_vector *ast_sip_service_route_vector_alloc(void);
*/
void ast_sip_service_route_vector_destroy(struct ast_sip_service_route_vector *service_routes);
/*!
* \brief Set the ID for a connected line update
*
* \retval -1 on failure, 0 on success
*/
int ast_sip_set_id_connected_line(struct pjsip_rx_data *rdata, struct ast_party_id *id);
/*!
* \brief Set the ID from an INVITE
*
* \param rdata
* \param id ID structure to fill
* \param default_id Default ID structure with data to use (for non-trusted endpoints)
* \param trusted_inbound Whether or not the endpoint is trusted (controls whether PAI or RPID can be used)
*
* \retval -1 on failure, 0 on success
*/
int ast_sip_set_id_from_invite(struct pjsip_rx_data *rdata, struct ast_party_id *id, struct ast_party_id *default_id, int trust_inbound);
/*!
* \brief Set name and number information on an identity header.
*