Maximum Channels on Trunk - Not Working

Hi

We are looking at moving to PJSIP trunks… and we are slowly moving through out list of issues…

One that has us stuck at the moment is that it doesn’t appear possible to count inbound calls towards the Maximum Channels

When using chan_sip, and using the custom context for inbound calls (from-trunk-sip-{trunk_name}) the maximum channel feature works for us.

However with PJSIP, this doesn’t work, and we end up trying to place calls on a congested trunk (as the total usage exceeds what is provisioned by the provider).

This wouldn’t be an issue, however our provider returns busy when the trunk is congested, as well as when the called party is busy.

Freepbx provides the function to continue when busy, the downside of this is that I will try and place the call 4 times to a number that is actually busy.

Any ideas are most welcome…

NOTE: additional testing found that this issue occurs for both PJSIP and chan_sip, see below for more details

Cheers

The dialplan around this feature is identical for both chan_sip and chan_pjsip, I don’t see any obvious reason why it doesn’t work. Can you post a call trace of a pjsip call?

Hi Lorne

I had a bit more of a look, and I suspect there is something funny with the counting going on.

I changed this in extensions_additional.conf…

[from-trunk-sip-12345678]
include => from-trunk-sip-12345678-custom
exten => _.,1,Set(GROUP()=OUT_6)
exten => _.,n,NoOp(>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>(Concurrent Calls: ${GROUP_COUNT(OUT_6)})
exten => _.,n,Goto(from-trunk,${EXTEN},1)

Then I added the following to [macro-dialout-trunk-predial-hook]

exten => s,n,NoOp(Concurrent Calls: ${GROUP_COUNT(OUT_${DIAL_TRUNK})}, Max: ${OUTMAXCHANS_${DIAL_TRUNK}})
exten => s,n,NoOp(>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>(Concurrent Calls: ${GROUP_COUNT(OUT_6)})

I have a call coming in, going through and IVR, then going back out again, on the same Trunk…

-- Executing [87654321@from-trunk-sip-12345678:1] Set("SIP/12345678-00009310", "GROUP()=OUT_6") in new stack
-- Executing [87654321@from-trunk-sip-12345678:2] NoOp("SIP12345678-00009310", ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>(Concurrent Calls: 1") in new stack
 ...
-- Executing [s@macro-dialout-trunk-predial-hook:2] NoOp("SIP/12345678-00009310", "Concurrent Calls: 0, Max: 12") in new stack
-- Executing [s@macro-dialout-trunk-predial-hook:3] NoOp("SIP/12345678-00009310", ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>(Concurrent Calls: 0") in new stack

There is one concurrent call… as I am on that call… so I’m at a loss to how this group_count reduces

Having done much more testing… I don’t actually think the counting of inbound calls is working for chan_sip either.

I placed the above into extensions_custom.conf

[from-pstn-custom]
exten => _X.,1,NoOp(>>>>>>>>>>>>>>>>>>>> Trunk Group             : ${GROUP()})
exten => _X.,n,NoOp(>>>>>>>>>>>>>>>>>>>> Number of Calls on Trunk: ${GROUP_COUNT()})

Then placed multiple calls to the DDI number…

asterisk -rvvvvvvvvvvvvvvvvvvvvv | grep ‘>>>>>>>>>>>>>>>>>>’

-- Executing [66555555@from-trunk:1] NoOp("SIP/66555555-000094fb", ">>>>>>>>>>>>>>>>>>>> Trunk Group             : OUT_6") in new stack
-- Executing [66555555@from-trunk:2] NoOp("SIP/66555555-000094fb", ">>>>>>>>>>>>>>>>>>>> Number of Calls on Trunk: 1") in new stack
-- Executing [66555555@from-trunk:1] NoOp("SIP/66555555-000094fc", ">>>>>>>>>>>>>>>>>>>> Trunk Group             : OUT_6") in new stack
-- Executing [66555555@from-trunk:2] NoOp("SIP/66555555-000094fc", ">>>>>>>>>>>>>>>>>>>> Number of Calls on Trunk: 1") in new stack
-- Executing [66555555@from-trunk:1] NoOp("SIP/66555555-000094fd", ">>>>>>>>>>>>>>>>>>>> Trunk Group             : OUT_6") in new stack
-- Executing [66555555@from-trunk:2] NoOp("SIP/66555555-000094fd", ">>>>>>>>>>>>>>>>>>>> Number of Calls on Trunk: 1") in new stack

As all of these calls were listening to our IVR at the same time, I expected that the call count should of increased.

I also tried ${GROUP_COUNT(OUT_6)}) - however the same result of 1 for each call.

I took your testing dialplan for from-pstn-custom (which you don’t want to leave in place after testing!) and placed several inbound calls to a chan_sip trunk and it worked as expected:

Inbound calls from outside:
[2018-05-03 08:39:38] VERBOSE[28603][C-00000020] pbx.c: Executing [9029200652@from-trunk:1] NoOp("SIP/fpbx-1-8CeeToemYCth-00000019", ">>>>>>>>>>>>>>>>>>>> Trunk Group             : OUT_3") in new stack
[2018-05-03 08:39:38] VERBOSE[28603][C-00000020] pbx.c: Executing [9029200652@from-trunk:2] NoOp("SIP/fpbx-1-8CeeToemYCth-00000019", ">>>>>>>>>>>>>>>>>>>> Number of Calls on Trunk: 1") in new stack
[2018-05-03 08:39:56] VERBOSE[28621][C-00000021] pbx.c: Executing [9029200652@from-trunk:1] NoOp("SIP/fpbx-1-8CeeToemYCth-0000001a", ">>>>>>>>>>>>>>>>>>>> Trunk Group             : OUT_3") in new stack
[2018-05-03 08:39:56] VERBOSE[28621][C-00000021] pbx.c: Executing [9029200652@from-trunk:2] NoOp("SIP/fpbx-1-8CeeToemYCth-0000001a", ">>>>>>>>>>>>>>>>>>>> Number of Calls on Trunk: 2") in new stack

inbound calls from inside (so count goes up by 2)
[2018-05-03 08:41:01] VERBOSE[28819][C-00000023] pbx.c: Executing [9029200652@from-trunk:1] NoOp("SIP/fpbx-1-8CeeToemYCth-0000001c", ">>>>>>>>>>>>>>>>>>>> Trunk Group             : OUT_3") in new stack
[2018-05-03 08:41:01] VERBOSE[28819][C-00000023] pbx.c: Executing [9029200652@from-trunk:2] NoOp("SIP/fpbx-1-8CeeToemYCth-0000001c", ">>>>>>>>>>>>>>>>>>>> Number of Calls on Trunk: 4") in new stack
[2018-05-03 08:41:15] VERBOSE[28940][C-00000025] pbx.c: Executing [9029200652@from-trunk:1] NoOp("SIP/fpbx-1-8CeeToemYCth-0000001f", ">>>>>>>>>>>>>>>>>>>> Trunk Group             : OUT_3") in new stack
[2018-05-03 08:41:15] VERBOSE[28940][C-00000025] pbx.c: Executing [9029200652@from-trunk:2] NoOp("SIP/fpbx-1-8CeeToemYCth-0000001f", ">>>>>>>>>>>>>>>>>>>> Number of Calls on Trunk: 6") in new stack

hung all up and one final test
[2018-05-03 08:41:46] VERBOSE[29207][C-00000026] pbx.c: Executing [9029200652@from-trunk:1] NoOp("SIP/fpbx-1-8CeeToemYCth-00000020", ">>>>>>>>>>>>>>>>>>>> Trunk Group             : OUT_3") in new stack
[2018-05-03 08:41:46] VERBOSE[29207][C-00000026] pbx.c: Executing [9029200652@from-trunk:2] NoOp("SIP/fpbx-1-8CeeToemYCth-00000020", ">>>>>>>>>>>>>>>>>>>> Number of Calls on Trunk: 1") in new stack

Testing with Asterisk 15.2.2 and FreePBX 14.

Thanks Lorne

We are using PBXAct 13, Asterisk 13.19.1, and at this stage I would be hesitant to upgrade.

I have created an issue for this, https://issues.freepbx.org/browse/FREEPBX-17420

Any advantage for us in logging a support call against it as well?

Thanks

I’ve redone my tests using pjsip trunks, and they continue to work as expected. Three inbound concurrent calls on a pjsip trunk, and I get this:

Trunk Group             : OUT_3
Number of Calls on Trunk: 1
Trunk Group             : OUT_3
Number of Calls on Trunk: 2
Trunk Group             : OUT_3
Number of Calls on Trunk: 3

I have, however, found what may be a bug when using max channels outbound with pjsip trunks. I believe the channel count is happening on the wrong leg of the outbound dial. I need to test a bit to be sure.

Edit - edited above to clarify potential bug is on outbound pjsip only. Inbound works fine.

Hi Lorne

Thanks for that. I’ve tried with both SIP and PJSIP… same result. All inbound calls go to a Custom Destination, then on to the required destination.

I just tried making a simple inbound DDI, that places the call directly to a IVR… and this worked as expected.

I’ll do some searching through the context used for the Custom Destination to see what is going on.

Apologies for the wild goose chase… appreciate your support.

Cheers

1 Like

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