diff --git a/channels/pjsip/dialplan_functions.c b/channels/pjsip/dialplan_functions.c index 721f47fae6d72830d1615a36a21c3ee41240c1f0..176bc496a8c5162eddcf41ee857857947f5b0fd4 100644 --- a/channels/pjsip/dialplan_functions.c +++ b/channels/pjsip/dialplan_functions.c @@ -1680,6 +1680,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 index 0000000000000000000000000000000000000000..0705c293d76ee6ba2de2fd5a4bcfbb275ff22dfb --- /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.