[Asterisk-code-review] chan_pjsip: disallow PJSIP_SEND_SESSION_REFRESH pre-answer execution (asterisk[16])

Kevin Harwell asteriskteam at digium.com
Mon Aug 24 16:30:12 CDT 2020


Kevin Harwell has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/14809 )


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
1 file changed, 5 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/09/14809/1

diff --git a/channels/pjsip/dialplan_functions.c b/channels/pjsip/dialplan_functions.c
index 721f47f..176bc49 100644
--- a/channels/pjsip/dialplan_functions.c
+++ b/channels/pjsip/dialplan_functions.c
@@ -1680,6 +1680,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;

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/14809
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I053f767d10cf3b2b898fa9e3e7c35ff07e23c9bb
Gerrit-Change-Number: 14809
Gerrit-PatchSet: 1
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200824/795082b3/attachment.html>


More information about the asterisk-code-review mailing list