In res_pjsip_header_funcs.c, every guard check that validates the channel is PJSIP logs at LOG_ERROR:
if (!channel || strncmp(ast_channel_name(chan), "PJSIP/", 6)) {
ast_log(LOG_ERROR, "This function requires a PJSIP channel.\n");
return -1;
}
This fires on any non-PJSIP leg — Local channels, and on a busy system it floods the log to the point where real errors get buried. It’s not really an error, it’s just the wrong channel type.
Seems like ast_debug(3, …) with the channel name included is the right fix:
ast_debug(3, "This function requires a PJSIP channel (got '%s').\n",
chan ? ast_channel_name(chan) : "NULL");
Anyone know if there was a reason this was set to LOG_ERROR originally? And is level 3 the right debug tier or should it be 1?
It can be an error, or maybe it isn’t. That’s the problem. If you’ve written dialplan with the expectation and logic that expects it to work and you then use channels where it doesn’t you can be caught by surprise. I expect that is why it is an error.
When it comes to changing non-debug log messages I don’t like doing it without trying to solicit input and feedback from the actual users.
the issue starts with the history of having 2 implementations and trying to keep each off from the other .
as of now you need to have a test before each time you want to do something with the the header
which is annoying and if you are lazy … you get the errors
how about having the function being able to execute also on local channels (did not do any research if this is anything plausible .)
ah
i see there is a new function [1] PJSIP_INHERITABLE_HEADER which solves this issue at large i think