mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
chan_pjsip: Add PJSIPHangup dialplan app and manager action
See UserNote below.
Exposed the existing Hangup AMI action in manager.c so we can use
all of it's channel search and AMI protocol handling without
duplicating that code in dialplan_functions.c.
Added a lookup function to res_pjsip.c that takes in the
string represenation of the pjsip_status_code enum and returns
the actual status code. I.E. ast_sip_str2rc("DECLINE") returns
603. This allows the caller to specify PJSIPHangup(decline) in
the dialplan, just like Hangup(call_rejected).
Also extracted the XML documentation to its own file since it was
almost as large as the code itself.
UserNote: A new dialplan app PJSIPHangup and AMI action allows you
to hang up an unanswered incoming PJSIP call with a specific SIP
response code in the 400 -> 699 range.
(cherry picked from commit af7e89ebf8
)
This commit is contained in:
committed by
Asterisk Development Team
parent
cd39daaed1
commit
c40496cb38
@@ -3266,6 +3266,8 @@ static struct ast_custom_function session_refresh_function = {
|
||||
.write = pjsip_acf_session_refresh_write,
|
||||
};
|
||||
|
||||
static char *app_pjsip_hangup = "PJSIPHangup";
|
||||
|
||||
/*!
|
||||
* \brief Load the module
|
||||
*
|
||||
@@ -3323,6 +3325,13 @@ static int load_module(void)
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (ast_register_application_xml(app_pjsip_hangup, pjsip_app_hangup)) {
|
||||
ast_log(LOG_WARNING, "Unable to register PJSIPHangup dialplan application\n");
|
||||
goto end;
|
||||
}
|
||||
ast_manager_register_xml(app_pjsip_hangup, EVENT_FLAG_SYSTEM | EVENT_FLAG_CALL, pjsip_action_hangup);
|
||||
|
||||
|
||||
ast_sip_register_service(&refer_callback_module);
|
||||
|
||||
ast_sip_session_register_supplement(&chan_pjsip_supplement);
|
||||
@@ -3370,6 +3379,9 @@ end:
|
||||
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_unregister_application(app_pjsip_hangup);
|
||||
ast_manager_unregister(app_pjsip_hangup);
|
||||
|
||||
ast_channel_unregister(&chan_pjsip_tech);
|
||||
ast_rtp_glue_unregister(&chan_pjsip_rtp_glue);
|
||||
|
||||
@@ -3399,6 +3411,8 @@ static int unload_module(void)
|
||||
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_unregister_application(app_pjsip_hangup);
|
||||
ast_manager_unregister(app_pjsip_hangup);
|
||||
|
||||
ast_channel_unregister(&chan_pjsip_tech);
|
||||
ao2_ref(chan_pjsip_tech.capabilities, -1);
|
||||
|
Reference in New Issue
Block a user