mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 11:58:52 +00:00
res_pjsip: Add TEL URI support for basic calls.
This change allows TEL URI requests to come through for basic calls. The allowed requests are INVITE, ACK, BYE, and CANCEL. The From and To headers will now allow TEL URIs, as well as the request URI. Support is only for TEL URIs present in traffic from a remote party. Asterisk does not generate any TEL URIs on its own. ASTERISK-26894 Change-Id: If5729e6cd583be7acf666373bf9f1b9d653ec29a
This commit is contained in:
committed by
Friendly Automation
parent
3e054c9ebc
commit
881a3f2306
@@ -2472,6 +2472,69 @@ struct ast_threadpool *ast_sip_threadpool(void)
|
||||
return sip_threadpool;
|
||||
}
|
||||
|
||||
int ast_sip_is_uri_sip_sips(pjsip_uri *uri)
|
||||
{
|
||||
return (PJSIP_URI_SCHEME_IS_SIP(uri) || PJSIP_URI_SCHEME_IS_SIPS(uri));
|
||||
}
|
||||
|
||||
int ast_sip_is_allowed_uri(pjsip_uri *uri)
|
||||
{
|
||||
return (ast_sip_is_uri_sip_sips(uri) || PJSIP_URI_SCHEME_IS_TEL(uri));
|
||||
}
|
||||
|
||||
const pj_str_t *ast_sip_pjsip_uri_get_username(pjsip_uri *uri)
|
||||
{
|
||||
if (ast_sip_is_uri_sip_sips(uri)) {
|
||||
pjsip_sip_uri *sip_uri = pjsip_uri_get_uri(uri);
|
||||
if (!sip_uri) {
|
||||
return &AST_PJ_STR_EMPTY;
|
||||
}
|
||||
return &sip_uri->user;
|
||||
} else if (PJSIP_URI_SCHEME_IS_TEL(uri)) {
|
||||
pjsip_tel_uri *tel_uri = pjsip_uri_get_uri(uri);
|
||||
if (!tel_uri) {
|
||||
return &AST_PJ_STR_EMPTY;
|
||||
}
|
||||
return &tel_uri->number;
|
||||
}
|
||||
|
||||
return &AST_PJ_STR_EMPTY;
|
||||
}
|
||||
|
||||
const pj_str_t *ast_sip_pjsip_uri_get_hostname(pjsip_uri *uri)
|
||||
{
|
||||
if (ast_sip_is_uri_sip_sips(uri)) {
|
||||
pjsip_sip_uri *sip_uri = pjsip_uri_get_uri(uri);
|
||||
if (!sip_uri) {
|
||||
return &AST_PJ_STR_EMPTY;
|
||||
}
|
||||
return &sip_uri->host;
|
||||
} else if (PJSIP_URI_SCHEME_IS_TEL(uri)) {
|
||||
return &AST_PJ_STR_EMPTY;
|
||||
}
|
||||
|
||||
return &AST_PJ_STR_EMPTY;
|
||||
}
|
||||
|
||||
struct pjsip_param *ast_sip_pjsip_uri_get_other_param(pjsip_uri *uri, const pj_str_t *param_str)
|
||||
{
|
||||
if (ast_sip_is_uri_sip_sips(uri)) {
|
||||
pjsip_sip_uri *sip_uri = pjsip_uri_get_uri(uri);
|
||||
if (!sip_uri) {
|
||||
return NULL;
|
||||
}
|
||||
return pjsip_param_find(&sip_uri->other_param, param_str);
|
||||
} else if (PJSIP_URI_SCHEME_IS_TEL(uri)) {
|
||||
pjsip_tel_uri *tel_uri = pjsip_uri_get_uri(uri);
|
||||
if (!tel_uri) {
|
||||
return NULL;
|
||||
}
|
||||
return pjsip_param_find(&tel_uri->other_param, param_str);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef TEST_FRAMEWORK
|
||||
AST_TEST_DEFINE(xml_sanitization_end_null)
|
||||
{
|
||||
|
Reference in New Issue
Block a user