PJSIP Problem Channel not closing

Hello Folks,

i am facing a strange Situation and i am wondering if i am missing something.
Freshly installed FreePBX Distro (FreePBX with Asterisk 16.6.2, all modules upgraded)
I’ve created two chan_pjsip Extensions, 11 and 17, they can call each other but when i hangup the call, the channel won’t be closed. I have to manually close the channel with “channel request hangup PJSIP/[CALL_ID]”
First i thought i did something wrong with the install, so i reinstalled the whole system with a freshly downloaded iso, installed everything as usual, did not configure anything else then the two extensions and voila: Same behaviour.
Can someone give me a hint for what i have to look for? I tried with Sangoma Phones, Yealink Phones and with a SIP Softphone from Grandstream, so it can’t be a wrongly configured telephone.

Then i created two SIP extensions and registered them on Port 5160, to test the old chan_sip. Here the channel will be closed after i hangup the phone, so it is a chan_pjsip only issue.
I can provide PJSIP Debug Logs if needed, but i am wondering if i need to configure something?
Just for information: I only created the two pjsip Extensions, i did not configure anything else on freepbx for this test.

Cann someone point me to the right Direction please?

Best Regards,

Does something go wrong with the first call, e.g. when the caller hangs up, the callee’s phone doesn’t immediately disconnect, or vice versa? Or, does it prevent a second call from being established? Or, is this just a resource leak which you noticed while looking at internals, or which caused a failure after hundreds of test calls?

Are the phones on the same LAN subnet as the PBX, which has only one network interface? If not, please describe the network paths in detail, including make/model of any routers or firewalls in the path, any VLANs or VPNs, etc. If the PBX is on a virtual machine using other than bridged networking, provide details.

Confirm that Rewrite Contacts is Yes for both extensions, and that External Address and Local Networks are correctly set in Asterisk SIP Settings.

Does *65 (speak extension number) work correctly? *43 (echo test)?

If you still have trouble, at the Asterisk command prompt type
pjsip set logger on
make a failing test call, paste the Asterisk log at https://pastebin.freepbx.org and post the link here.

Hey Stewart,
indeed when one of the two extensions hangup, the other extension stays in the call.
Ressource is not an issue, i use a APU2E4 for my test scenario, this should be more then enough to handle some calls.
The phones and the pbx are all in the same subnet, so there is noe routing or natting going on.
Rewrite Contacts is set to Yes for both extensions, external address is not set (because it is a lan only scenario)
The *65 does work, i receive my extension number, but the echo test is strange, i get the instructions which tell me everything i say will be repeated and so on, but when i say something it won’t be repeated. And the echo test does not clear the channel too, when i hangup the phone.
Here is the log of a test call:
I am calling from extension 11 (yealink t46s, IP: to extension 17 (yealink t46s, IP: the pbx is
After i hangup the phones i did a
freepbx*CLI> pjsip show channels

  Channel:  <ChannelId........................................>  <State.....>  <Time.....>
      Exten: <DialedExten.............>  CLCID: <ConnectedLineCID.......>

  Channel: PJSIP/11-0000000a/Dial                                Up            00:04:00
      Exten: s                           CLCID: "Empfang OG2 Stand2" <17>

  Channel: PJSIP/17-0000000b/AppDial                             Up            00:04:00
      Exten:                             CLCID: "Empfang OG2 Stand1" <11>

Objects found: 2

So the channel is still there.
What am i missing?
Best Regards

Among other anomalies, line 305 of the log
Contact: <sip:[email protected]:5060>
is the PBX telling the called phone to respond to a public IP address, obviously not correct.
Confirm that in Asterisk SIP Settings, Local Networks is set to / 24, and that External Address is correct (whatever the Mikrotik has on its WAN interface, or whatever the Detect button shows). Also, in the chan_pjsip settings, External IP Address and Local Network should be blank (or correctly set). If you change any of these, you must restart (not just reload) Asterisk.

Also, where are you? appears to be in the Toronto area, but the phone names are in German?

Hello Stewart,
i can’t explain where this IP ( came from. You were right, it was the external IP. I’ve fixed the settings and now the echo test works (i can hear myself) but the channel closing Problem still exists.
I am wondering, since this is fresh installed FreePBX that there are other anomalies you mentioned…
Best Regards

Try posting another log. Get it from Reports -> Asterisk Logfiles or directly from /var/log/asterisk/full .
This will have timestamps. Also, post the time when you hung up one of the phones, so we can see what, if anything, was logged at that time.

Thanks in advance. I rebooted the pbx once again. Now the channel is closing correctly.
I will reinstall the pbx once more now to test this behaviour again.
But for now everything seems to work like a charm.
Thank you for your help!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.