mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-16 23:08:32 +00:00
pjsip: New function PJSIP_PARSE_URI to parse URI and return part of URI
New dialplan function PJSIP_PARSE_URI added to parse an URI and return
a specified part of the URI.
This is useful when need to get part of the URI instead of cutting it
using a CUT function.
For example to get 'user' part of Remote URI
${PJSIP_PARSE_URI(${CHANNEL(pjsip,remote_uri)},user)}
ASTERISK-28144 #close
Change-Id: I5d828fb87f6803b6c1152bb7b44835f027bb9d5a
This commit is contained in:
committed by
George Joseph
parent
6dcbbdec9b
commit
b6d0fbda9d
@@ -2774,6 +2774,11 @@ static struct ast_custom_function chan_pjsip_dial_contacts_function = {
|
||||
.read = pjsip_acf_dial_contacts_read,
|
||||
};
|
||||
|
||||
static struct ast_custom_function chan_pjsip_parse_uri_function = {
|
||||
.name = "PJSIP_PARSE_URI",
|
||||
.read = pjsip_acf_parse_uri_read,
|
||||
};
|
||||
|
||||
static struct ast_custom_function media_offer_function = {
|
||||
.name = "PJSIP_MEDIA_OFFER",
|
||||
.read = pjsip_acf_media_offer_read,
|
||||
@@ -2825,6 +2830,11 @@ static int load_module(void)
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (ast_custom_function_register(&chan_pjsip_parse_uri_function)) {
|
||||
ast_log(LOG_ERROR, "Unable to register PJSIP_PARSE_URI 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;
|
||||
@@ -2897,6 +2907,7 @@ end:
|
||||
ast_custom_function_unregister(&dtmf_mode_function);
|
||||
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(&session_refresh_function);
|
||||
ast_channel_unregister(&chan_pjsip_tech);
|
||||
ast_rtp_glue_unregister(&chan_pjsip_rtp_glue);
|
||||
@@ -2921,6 +2932,7 @@ static int unload_module(void)
|
||||
ast_custom_function_unregister(&dtmf_mode_function);
|
||||
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(&session_refresh_function);
|
||||
|
||||
ast_channel_unregister(&chan_pjsip_tech);
|
||||
|
||||
Reference in New Issue
Block a user