Calls being disconnected: res_pjsip_header_funcs.c

I am running Freepbx v17.0.19.32 and setup a new PJSIP Trunk using IP authentication. This appeared to be working fine but have noticed that outgoing calls keep being disconnected.

When I look in the logs the only error I am seeing at about the time the call is disconnected is:

2025-10-18 12:30:54] ERROR[263326] res_pjsip_header_funcs.c: No headers had been previously added to this session.

I have no idea what to do about it. The previous trunks all worked fine and I haven’t changed anything other than created the new trunk for inbound and outbound calls with a new provider, so am not clear how this issue could have been introduced.

I have read this post on Freepbs v15 from 2021: Error in log because PJSIP removing header when none exist

But it is a little too complex for me to follow and, given this was a reported as a bug would have thought it would have been fixed in four years.

Any ideas on how to sort this would be appreciated.

This is not why the call is being disconnected. That’s not fatal.

You would need to provide logs[1].

[1] Support Services - Providing Great Debug - Support Services - Sangoma Documentation

Thanks for the response.

I guess I need to look elsewhere, since it is the only error in the logs around the time that the call is disconnected.

I’ll talk the the service provider and see if they have any ideas.

When do calls get disconnected (immediately, after 32 seconds, after 15 minutes, etc.)?
Are all calls affected? If not, approximate percentage? Is there an obvious pattern, such as calls to a particular carrier are dropped?

Please post the last two seconds of log preceding the error you posted.

Hi Stewart,

Usually it disconnects after about 15 to 30 minutes, the actual time varies. Short calls seem to be okay. It doesnt seem to matter who I call, we only have one provider for our SIP Trunk.

I will capture the logs next time it happens and post the appropriate lines here. I seem to remember there were no other errors in the log, just security nofications about extensions registering etc. This particular error occurred 3 times in the last call. The previous call also had the same error around when it disconnected.

Unless you went out of the way to destroy them, the log for the call discussed should still be there.
The current log is in /var/log/asterisk/full and logs for previous days (a week’s worth by default) should be in /var/log/asterisk/full-202510xx .

Here is a copy of the log entries prior to the call being disconnected. The error is line at the bottom when the call disconnected.

Thanks

It’s a purely cosmetic error, and one that will not be noticed in normal use. My experience of how product managers work, in other organisations, is such errors never get prioritised for fixing by the programmers. FreePBX has quite a few of these.