[Asterisk-code-review] chan_pjsip: disallow PJSIP_SEND_SESSION_REFRESH pre-answer execution (asterisk[13])
Friendly Automation
asteriskteam at digium.com
Fri Aug 28 12:24:12 CDT 2020
Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/14787 )
Change subject: chan_pjsip: disallow PJSIP_SEND_SESSION_REFRESH pre-answer execution
......................................................................
chan_pjsip: disallow PJSIP_SEND_SESSION_REFRESH pre-answer execution
This patch makes it so if the PJSIP_SEND_SESSION_REFRESH dialplan function
is called on a channel prior to answering a warning is issued and the
function returns unsuccessful.
ASTERISK-28878 #close
Change-Id: I053f767d10cf3b2b898fa9e3e7c35ff07e23c9bb
---
M channels/pjsip/dialplan_functions.c
A doc/CHANGES-staging/pjsip_send_session_refresh.txt
2 files changed, 9 insertions(+), 0 deletions(-)
Approvals:
Joshua Colp: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
diff --git a/channels/pjsip/dialplan_functions.c b/channels/pjsip/dialplan_functions.c
index 3a6f0a4..60be7c1 100644
--- a/channels/pjsip/dialplan_functions.c
+++ b/channels/pjsip/dialplan_functions.c
@@ -1532,6 +1532,11 @@
return -1;
}
+ if (ast_channel_state(chan) != AST_STATE_UP) {
+ ast_log(LOG_WARNING, "'%s' not allowed on unanswered channel '%s'.\n", cmd, ast_channel_name(chan));
+ return -1;
+ }
+
if (strcmp(ast_channel_tech(chan)->type, "PJSIP")) {
ast_log(LOG_WARNING, "Cannot call %s on a non-PJSIP channel\n", cmd);
return -1;
diff --git a/doc/CHANGES-staging/pjsip_send_session_refresh.txt b/doc/CHANGES-staging/pjsip_send_session_refresh.txt
new file mode 100644
index 0000000..0705c29
--- /dev/null
+++ b/doc/CHANGES-staging/pjsip_send_session_refresh.txt
@@ -0,0 +1,4 @@
+Subject: chan_pjsip
+
+The PJSIP_SEND_SESSION_REFRESH dialplan function now issues a warning, and
+returns unsuccessful if it's used on a channel prior to answering.
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/14787
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I053f767d10cf3b2b898fa9e3e7c35ff07e23c9bb
Gerrit-Change-Number: 14787
Gerrit-PatchSet: 3
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200828/21bbff91/attachment.html>
More information about the asterisk-code-review
mailing list