]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
chan_pjsip: disallow PJSIP_SEND_SESSION_REFRESH pre-answer execution
authorKevin Harwell <kharwell@digium.com>
Mon, 24 Aug 2020 21:26:23 +0000 (16:26 -0500)
committerFriendly Automation <jenkins2@gerrit.asterisk.org>
Fri, 28 Aug 2020 17:24:10 +0000 (12:24 -0500)
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

channels/pjsip/dialplan_functions.c
doc/CHANGES-staging/pjsip_send_session_refresh.txt [new file with mode: 0644]

index 3a6f0a4cb7104d104e05bf37ed7b1bb9869fafa9..60be7c11993bf66450f947e0a8d05386c1a054d8 100644 (file)
@@ -1532,6 +1532,11 @@ int pjsip_acf_session_refresh_write(struct ast_channel *chan, const char *cmd, c
                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 (file)
index 0000000..0705c29
--- /dev/null
@@ -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.