mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
pjsip: Add PJSIP_PARSE_URI_FROM dialplan function.
Various SIP headers permit a URI to be prefaced with a `display-name`
production that can include characters (like commas and parentheses)
that are problematic for Asterisk's dialplan parser and, specifically
in the case of this patch, the PJSIP_PARSE_URI function.
This patch introduces a new function - `PJSIP_PARSE_URI_FROM` - that
behaves identically to `PJSIP_PARSE_URI` except that the first
argument is now a variable name and not a literal URI.
Fixes #756
(cherry picked from commit 78d63bc11c
)
This commit is contained in:
committed by
Asterisk Development Team
parent
28c9d87837
commit
f88812ff86
@@ -3243,6 +3243,11 @@ static struct ast_custom_function chan_pjsip_parse_uri_function = {
|
||||
.read = pjsip_acf_parse_uri_read,
|
||||
};
|
||||
|
||||
static struct ast_custom_function chan_pjsip_parse_uri_from_function = {
|
||||
.name = "PJSIP_PARSE_URI_FROM",
|
||||
.read = pjsip_acf_parse_uri_read,
|
||||
};
|
||||
|
||||
static struct ast_custom_function media_offer_function = {
|
||||
.name = "PJSIP_MEDIA_OFFER",
|
||||
.read = pjsip_acf_media_offer_read,
|
||||
@@ -3305,6 +3310,11 @@ static int load_module(void)
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (ast_custom_function_register(&chan_pjsip_parse_uri_from_function)) {
|
||||
ast_log(LOG_ERROR, "Unable to register PJSIP_PARSE_URI_FROM dialplan function\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (ast_custom_function_register(&media_offer_function)) {
|
||||
ast_log(LOG_WARNING, "Unable to register PJSIP_MEDIA_OFFER dialplan function\n");
|
||||
goto end;
|
||||
@@ -3378,6 +3388,7 @@ end:
|
||||
ast_custom_function_unregister(&media_offer_function);
|
||||
ast_custom_function_unregister(&chan_pjsip_dial_contacts_function);
|
||||
ast_custom_function_unregister(&chan_pjsip_parse_uri_function);
|
||||
ast_custom_function_unregister(&chan_pjsip_parse_uri_from_function);
|
||||
ast_custom_function_unregister(&session_refresh_function);
|
||||
ast_unregister_application(app_pjsip_hangup);
|
||||
ast_manager_unregister(app_pjsip_hangup);
|
||||
@@ -3410,6 +3421,7 @@ static int unload_module(void)
|
||||
ast_custom_function_unregister(&media_offer_function);
|
||||
ast_custom_function_unregister(&chan_pjsip_dial_contacts_function);
|
||||
ast_custom_function_unregister(&chan_pjsip_parse_uri_function);
|
||||
ast_custom_function_unregister(&chan_pjsip_parse_uri_from_function);
|
||||
ast_custom_function_unregister(&session_refresh_function);
|
||||
ast_unregister_application(app_pjsip_hangup);
|
||||
ast_manager_unregister(app_pjsip_hangup);
|
||||
|
Reference in New Issue
Block a user