Maximum channels not working with sip trunk

I have a two-satellite link that with an FreePBX running version 2.3.1 and Asterisk 1.4
I have configured my outbound trunk with Maximum channels set to 2 but I can make as many calls as I want through that trunk.

I have dedicated bandwidth for voip that only allows me to use 2 channels. I must be able to restrict asterisk to allow only 2 channels out and if someone else tries to dial then they get a busy signal.

How do I do this?

If you set max channels to 2 then after 2 is should skip that trunk. It will not count inbound calls against that trunk unless you specifically configure your trunk to use a special from-trunk-trunkname context that gets generated starting in 2.3.1 - hover over the max channels option to see the tooltip which describes this.

Philippe Lindheimer - FreePBX Project Lead
http//freepbx.org - IRC #freepbx

I am not using an inbound trunk at this point. I have set the outbound to 1 channel and I can make 3 calls and probably more but 3 at a time is all I have tested.

what version of asterisk?

Also - set it to 1, then make 2 or 3 calls as you mentioned and while the calls are active, type “group show channels” at the CLI and then paste the results here.

Philippe Lindheimer - FreePBX Project Lead
http//freepbx.org - IRC #freepbx

Using Asterisk 1.4, FreePBX 2.3.1

I have only one outbound channel and have that set to 1 channel in the freepbx trunk setup.

I was able to dial out.

Channel Group Category
SIP/525-08cf4be0 OUT_1 (default)
SIP/203-08ca4ba0 OUT_1 (default)
SIP/530-08d17048 OUT_1 (default)

Here is the full log. I dialed out on two extensions with the max channels set to 1

[Oct 23 08:24:31] VERBOSE[9052] logger.c: – Executing [818003473288@from-internal:1] Macro(“SIP/525-097d9d70”, “pinsets|1|1”) in new stack
[Oct 23 08:24:31] VERBOSE[9052] logger.c: – Executing [s@macro-pinsets:1] GotoIf(“SIP/525-097d9d70”, “1 = 1?cdr|1”) in new stack
[Oct 23 08:24:31] VERBOSE[9052] logger.c: – Goto (macro-pinsets,cdr,1)
[Oct 23 08:24:31] DEBUG[9052] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:31] VERBOSE[9052] logger.c: – Executing [cdr@macro-pinsets:1] Authenticate(“SIP/525-097d9d70”, “/etc/asterisk/pinset_1|a”) in new stack
[Oct 23 08:24:31] VERBOSE[9052] logger.c: – <SIP/525-097d9d70> Playing ‘agent-pass’ (language ‘en’)
[Oct 23 08:24:35] VERBOSE[9052] logger.c: – <SIP/525-097d9d70> Playing ‘auth-thankyou’ (language ‘en’)
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: Authenticate
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [818003473288@from-internal:2] Macro(“SIP/525-097d9d70”, “dialout-trunk|1|18003473288||”) in new stack
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-dialout-trunk:1] Set(“SIP/525-097d9d70”, “DIAL_TRUNK=1”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: Set
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-dialout-trunk:2] Set(“SIP/525-097d9d70”, “DIAL_NUMBER=18003473288”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: Set
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-dialout-trunk:3] Set(“SIP/525-097d9d70”, “ROUTE_PASSWD=”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: Set
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-dialout-trunk:4] GotoIf(“SIP/525-097d9d70”, “1?noauth”) in new stack
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Goto (macro-dialout-trunk,s,6)
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-dialout-trunk:6] GotoIf(“SIP/525-097d9d70”, “0?disabletrunk|1”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-dialout-trunk:7] Set(“SIP/525-097d9d70”, “_NODEST=”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: Set
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-dialout-trunk:8] Set(“SIP/525-097d9d70”, “DIAL_TRUNK_OPTIONS=tr”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: Set
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-dialout-trunk:9] Set(“SIP/525-097d9d70”, “GROUP()=OUT_1”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: Set
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-dialout-trunk:10] Macro(“SIP/525-097d9d70”, “user-callerid|SKIPTTL”) in new stack
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-user-callerid:1] NoOp(“SIP/525-097d9d70”, “user-callerid: device 525”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: Noop
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-user-callerid:2] Set(“SIP/525-097d9d70”, “AMPUSER=525”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: Set
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-user-callerid:3] GotoIf(“SIP/525-097d9d70”, “0?report”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-user-callerid:4] GotoIf(“SIP/525-097d9d70”, “0?start”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-user-callerid:5] Set(“SIP/525-097d9d70”, “REALCALLERIDNUM=525”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: Set
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-user-callerid:6] NoOp(“SIP/525-097d9d70”, “REALCALLERIDNUM is 525”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: NoOp
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-user-callerid:7] Set(“SIP/525-097d9d70”, “AMPUSER=525”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: Set
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-user-callerid:8] Set(“SIP/525-097d9d70”, “AMPUSERCIDNAME=525 Kenton”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: Set
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-user-callerid:9] GotoIf(“SIP/525-097d9d70”, “0?report”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-user-callerid:10] Set(“SIP/525-097d9d70”, “AMPUSERCID=525”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: Set
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-user-callerid:11] Set(“SIP/525-097d9d70”, “CALLERID(all)=“525 Kenton” <525>”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: Set
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-user-callerid:12] Set(“SIP/525-097d9d70”, “REALCALLERIDNUM=525”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: Set
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-user-callerid:13] NoOp(“SIP/525-097d9d70”, “TTL: ARG1: SKIPTTL”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: Noop
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-user-callerid:14] GotoIf(“SIP/525-097d9d70”, “1?continue”) in new stack
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Goto (macro-user-callerid,s,23)
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-user-callerid:23] NoOp(“SIP/525-097d9d70”, “Using CallerID “525 Kenton” <525>”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: NoOp
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: Macro
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-dialout-trunk:11] Macro(“SIP/525-097d9d70”, “record-enable|525|OUT”) in new stack
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-record-enable:1] GotoIf(“SIP/525-097d9d70”, “0?2:4”) in new stack
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Goto (macro-record-enable,s,4)
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-record-enable:4] AGI(“SIP/525-097d9d70”, “recordingcheck|20071023-082436|1193149471.13”) in new stack
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Launched AGI Script /var/lib/asterisk/agi-bin/recordingcheck
[Oct 23 08:24:36] VERBOSE[9052] logger.c: recordingcheck|20071023-082436|1193149471.13: Outbound recording not enabled
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – AGI Script recordingcheck completed, returning 0
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: AGI
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-record-enable:5] NoOp(“SIP/525-097d9d70”, “No recording needed”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: Noop
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: Macro
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-dialout-trunk:12] GotoIf(“SIP/525-097d9d70”, “0?skipoutcid”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-dialout-trunk:13] Set(“SIP/525-097d9d70”, “DIAL_TRUNK_OPTIONS=”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: Set
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-dialout-trunk:14] Macro(“SIP/525-097d9d70”, “outbound-callerid|1”) in new stack
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-outbound-callerid:1] GotoIf(“SIP/525-097d9d70”, “1?start”) in new stack
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Goto (macro-outbound-callerid,s,3)
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-outbound-callerid:3] NoOp(“SIP/525-097d9d70”, “REALCALLERIDNUM is 525”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: NoOp
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-outbound-callerid:4] GotoIf(“SIP/525-097d9d70”, “1?normcid”) in new stack
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Goto (macro-outbound-callerid,s,9)
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-outbound-callerid:9] Set(“SIP/525-097d9d70”, “USEROUTCID=”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: Set
[Oct 23 08:24:36] DEBUG[9052] db.c: Unable to find key ‘525/emergency_cid’ in family ‘DEVICE’
[Oct 23 08:24:36] DEBUG[9052] func_db.c: DB: DEVICE/525/emergency_cid not found in database.
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-outbound-callerid:10] Set(“SIP/525-097d9d70”, “EMERGENCYCID=”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: Set
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-outbound-callerid:11] Set(“SIP/525-097d9d70”, “TRUNKOUTCID=2282064501”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: Set
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-outbound-callerid:12] GotoIf(“SIP/525-097d9d70”, “1?trunkcid”) in new stack
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Goto (macro-outbound-callerid,s,16)
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-outbound-callerid:16] GotoIf(“SIP/525-097d9d70”, “0?usercid”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-outbound-callerid:17] Set(“SIP/525-097d9d70”, “CALLERID(all)=2282064501”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: Set
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-outbound-callerid:18] GotoIf(“SIP/525-097d9d70”, “1?report”) in new stack
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Goto (macro-outbound-callerid,s,22)
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-outbound-callerid:22] NoOp(“SIP/525-097d9d70”, "CallerID set to “2282064501” ") in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: NoOp
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: Macro
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-dialout-trunk:15] GotoIf(“SIP/525-097d9d70”, “0?nomax”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-dialout-trunk:16] GotoIf(“SIP/525-097d9d70”, “0?chanfull”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-dialout-trunk:17] AGI(“SIP/525-097d9d70”, “fixlocalprefix”) in new stack
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Launched AGI Script /var/lib/asterisk/agi-bin/fixlocalprefix
[Oct 23 08:24:36] VERBOSE[9052] logger.c: > fixlocalprefix: Using pattern 81NXXNXXXXXX
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – AGI Script fixlocalprefix completed, returning 0
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: AGI
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-dialout-trunk:18] Set(“SIP/525-097d9d70”, “OUTNUM=18003473288”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: Set
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-dialout-trunk:19] Set(“SIP/525-097d9d70”, “custom=SIP/vitel-outbound”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: Set
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-dialout-trunk:20] GotoIf(“SIP/525-097d9d70”, “1?gocall”) in new stack
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Goto (macro-dialout-trunk,s,24)
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-dialout-trunk:24] GotoIf(“SIP/525-097d9d70”, “0?customtrunk”) in new stack
[Oct 23 08:24:36] DEBUG[9052] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Executing [s@macro-dialout-trunk:25] Dial(“SIP/525-097d9d70”, “SIP/vitel-outbound/18003473288|300|”) in new stack
[Oct 23 08:24:36] VERBOSE[9052] logger.c: – Called vitel-outbound/18003473288
[Oct 23 08:24:38] VERBOSE[9052] logger.c: – SIP/vitel-outbound-097bc0a0 answered SIP/525-097d9d70
[Oct 23 08:24:38] VERBOSE[9052] logger.c: – Packet2Packet bridging SIP/525-097d9d70 and SIP/vitel-outbound-097bc0a0
[Oct 23 08:24:40] VERBOSE[9061] logger.c: – Executing [818003473288@from-internal:1] Macro(“SIP/203-097c9f50”, “pinsets|1|1”) in new stack
[Oct 23 08:24:40] VERBOSE[9061] logger.c: – Executing [s@macro-pinsets:1] GotoIf(“SIP/203-097c9f50”, “1 = 1?cdr|1”) in new stack
[Oct 23 08:24:40] VERBOSE[9061] logger.c: – Goto (macro-pinsets,cdr,1)
[Oct 23 08:24:40] DEBUG[9061] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:40] VERBOSE[9061] logger.c: – Executing [cdr@macro-pinsets:1] Authenticate(“SIP/203-097c9f50”, “/etc/asterisk/pinset_1|a”) in new stack
[Oct 23 08:24:40] VERBOSE[9061] logger.c: – <SIP/203-097c9f50> Playing ‘agent-pass’ (language ‘en’)
[Oct 23 08:24:46] VERBOSE[9061] logger.c: – <SIP/203-097c9f50> Playing ‘auth-thankyou’ (language ‘en’)
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: Authenticate
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [818003473288@from-internal:2] Macro(“SIP/203-097c9f50”, “dialout-trunk|1|18003473288||”) in new stack
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-dialout-trunk:1] Set(“SIP/203-097c9f50”, “DIAL_TRUNK=1”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: Set
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-dialout-trunk:2] Set(“SIP/203-097c9f50”, “DIAL_NUMBER=18003473288”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: Set
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-dialout-trunk:3] Set(“SIP/203-097c9f50”, “ROUTE_PASSWD=”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: Set
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-dialout-trunk:4] GotoIf(“SIP/203-097c9f50”, “1?noauth”) in new stack
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Goto (macro-dialout-trunk,s,6)
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-dialout-trunk:6] GotoIf(“SIP/203-097c9f50”, “0?disabletrunk|1”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-dialout-trunk:7] Set(“SIP/203-097c9f50”, “_NODEST=”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: Set
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-dialout-trunk:8] Set(“SIP/203-097c9f50”, “DIAL_TRUNK_OPTIONS=tr”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: Set
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-dialout-trunk:9] Set(“SIP/203-097c9f50”, “GROUP()=OUT_1”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: Set
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-dialout-trunk:10] Macro(“SIP/203-097c9f50”, “user-callerid|SKIPTTL”) in new stack
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-user-callerid:1] NoOp(“SIP/203-097c9f50”, “user-callerid: device 203”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: Noop
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-user-callerid:2] Set(“SIP/203-097c9f50”, “AMPUSER=203”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: Set
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-user-callerid:3] GotoIf(“SIP/203-097c9f50”, “0?report”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-user-callerid:4] GotoIf(“SIP/203-097c9f50”, “0?start”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-user-callerid:5] Set(“SIP/203-097c9f50”, “REALCALLERIDNUM=203”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: Set
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-user-callerid:6] NoOp(“SIP/203-097c9f50”, “REALCALLERIDNUM is 203”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: NoOp
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-user-callerid:7] Set(“SIP/203-097c9f50”, “AMPUSER=203”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: Set
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-user-callerid:8] Set(“SIP/203-097c9f50”, “AMPUSERCIDNAME=Kenton Softphone”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: Set
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-user-callerid:9] GotoIf(“SIP/203-097c9f50”, “0?report”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-user-callerid:10] Set(“SIP/203-097c9f50”, “AMPUSERCID=203”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: Set
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-user-callerid:11] Set(“SIP/203-097c9f50”, “CALLERID(all)=“Kenton Softphone” <203>”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: Set
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-user-callerid:12] Set(“SIP/203-097c9f50”, “REALCALLERIDNUM=203”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: Set
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-user-callerid:13] NoOp(“SIP/203-097c9f50”, “TTL: ARG1: SKIPTTL”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: Noop
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-user-callerid:14] GotoIf(“SIP/203-097c9f50”, “1?continue”) in new stack
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Goto (macro-user-callerid,s,23)
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-user-callerid:23] NoOp(“SIP/203-097c9f50”, “Using CallerID “Kenton Softphone” <203>”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: NoOp
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: Macro
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-dialout-trunk:11] Macro(“SIP/203-097c9f50”, “record-enable|203|OUT”) in new stack
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-record-enable:1] GotoIf(“SIP/203-097c9f50”, “0?2:4”) in new stack
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Goto (macro-record-enable,s,4)
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-record-enable:4] AGI(“SIP/203-097c9f50”, “recordingcheck|20071023-082447|1193149480.15”) in new stack
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Launched AGI Script /var/lib/asterisk/agi-bin/recordingcheck
[Oct 23 08:24:47] VERBOSE[9061] logger.c: recordingcheck|20071023-082447|1193149480.15: Outbound recording not enabled
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – AGI Script recordingcheck completed, returning 0
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: AGI
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-record-enable:5] NoOp(“SIP/203-097c9f50”, “No recording needed”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: Noop
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: Macro
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-dialout-trunk:12] GotoIf(“SIP/203-097c9f50”, “0?skipoutcid”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-dialout-trunk:13] Set(“SIP/203-097c9f50”, “DIAL_TRUNK_OPTIONS=”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: Set
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-dialout-trunk:14] Macro(“SIP/203-097c9f50”, “outbound-callerid|1”) in new stack
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-outbound-callerid:1] GotoIf(“SIP/203-097c9f50”, “1?start”) in new stack
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Goto (macro-outbound-callerid,s,3)
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-outbound-callerid:3] NoOp(“SIP/203-097c9f50”, “REALCALLERIDNUM is 203”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: NoOp
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-outbound-callerid:4] GotoIf(“SIP/203-097c9f50”, “1?normcid”) in new stack
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Goto (macro-outbound-callerid,s,9)
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-outbound-callerid:9] Set(“SIP/203-097c9f50”, “USEROUTCID=”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: Set
[Oct 23 08:24:47] DEBUG[9061] db.c: Unable to find key ‘203/emergency_cid’ in family ‘DEVICE’
[Oct 23 08:24:47] DEBUG[9061] func_db.c: DB: DEVICE/203/emergency_cid not found in database.
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-outbound-callerid:10] Set(“SIP/203-097c9f50”, “EMERGENCYCID=”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: Set
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-outbound-callerid:11] Set(“SIP/203-097c9f50”, “TRUNKOUTCID=2282064501”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: Set
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-outbound-callerid:12] GotoIf(“SIP/203-097c9f50”, “1?trunkcid”) in new stack
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Goto (macro-outbound-callerid,s,16)
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-outbound-callerid:16] GotoIf(“SIP/203-097c9f50”, “0?usercid”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-outbound-callerid:17] Set(“SIP/203-097c9f50”, “CALLERID(all)=2282064501”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: Set
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-outbound-callerid:18] GotoIf(“SIP/203-097c9f50”, “1?report”) in new stack
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Goto (macro-outbound-callerid,s,22)
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-outbound-callerid:22] NoOp(“SIP/203-097c9f50”, "CallerID set to “2282064501” ") in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: NoOp
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: Macro
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-dialout-trunk:15] GotoIf(“SIP/203-097c9f50”, “0?nomax”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-dialout-trunk:16] GotoIf(“SIP/203-097c9f50”, “0?chanfull”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-dialout-trunk:17] AGI(“SIP/203-097c9f50”, “fixlocalprefix”) in new stack
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Launched AGI Script /var/lib/asterisk/agi-bin/fixlocalprefix
[Oct 23 08:24:47] VERBOSE[9061] logger.c: > fixlocalprefix: Using pattern 81NXXNXXXXXX
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – AGI Script fixlocalprefix completed, returning 0
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: AGI
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-dialout-trunk:18] Set(“SIP/203-097c9f50”, “OUTNUM=18003473288”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: Set
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-dialout-trunk:19] Set(“SIP/203-097c9f50”, “custom=SIP/vitel-outbound”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: Set
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-dialout-trunk:20] GotoIf(“SIP/203-097c9f50”, “1?gocall”) in new stack
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Goto (macro-dialout-trunk,s,24)
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-dialout-trunk:24] GotoIf(“SIP/203-097c9f50”, “0?customtrunk”) in new stack
[Oct 23 08:24:47] DEBUG[9061] app_macro.c: Executed application: GotoIf
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Executing [s@macro-dialout-trunk:25] Dial(“SIP/203-097c9f50”, “SIP/vitel-outbound/18003473288|300|”) in new stack
[Oct 23 08:24:47] VERBOSE[9061] logger.c: – Called vitel-outbound/18003473288
[Oct 23 08:24:49] VERBOSE[9061] logger.c: – SIP/vitel-outbound-0976add8 answered SIP/203-097c9f50
[Oct 23 08:24:49] VERBOSE[9061] logger.c: – Packet2Packet bridging SIP/203-097c9f50 and SIP/vitel-outbound-0976add8
[Oct 23 08:24:56] VERBOSE[8959] logger.c: – Remote UNIX connection disconnected
[Oct 23 08:25:08] VERBOSE[9052] logger.c: == Spawn extension (macro-dialout-trunk, s, 25) exited non-zero on ‘SIP/525-097d9d70’ in macro ‘dialout-trunk’
[Oct 23 08:25:08] VERBOSE[9052] logger.c: == Spawn extension (macro-dialout-trunk, s, 25) exited non-zero on ‘SIP/525-097d9d70’
[Oct 23 08:25:08] VERBOSE[9052] logger.c: – Executing [h@macro-dialout-trunk:1] Macro(“SIP/525-097d9d70”, “hangupcall”) in new stack
[Oct 23 08:25:08] VERBOSE[9052] logger.c: – Executing [s@macro-hangupcall:1] ResetCDR(“SIP/525-097d9d70”, “w”) in new stack
[Oct 23 08:25:08] ERROR[9052] cdr_addon_mysql.c: cdr_mysql: cannot connect to database server localhost. CDR will not be spooled.
[Oct 23 08:25:08] DEBUG[9052] cdr_addon_mysql.c: cdr_mysql: inserting a CDR record.
[Oct 23 08:25:08] DEBUG[9052] cdr_addon_mysql.c: cdr_mysql: SQL command as follows: INSERT INTO cdr (calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid) VALUES (‘2007-10-23 08:24:31’,’“2282064501” ‘,‘HospitalLomadeLuz’,‘818003473288’,‘from-internal’, ‘SIP/525-097d9d70’,‘SIP/vitel-outbound-097bc0a0’,‘Dial’,‘SIP/vitel-outbound/18003473288|300|’,37,37,‘ANSWERED’,3,‘1234’,‘1193149471.13’)
[Oct 23 08:25:08] DEBUG[9052] app_macro.c: Executed application: ResetCDR
[Oct 23 08:25:08] VERBOSE[9052] logger.c: – Executing [s@macro-hangupcall:2] NoCDR(“SIP/525-097d9d70”, “”) in new stack
[Oct 23 08:25:08] DEBUG[9052] app_macro.c: Executed application: NoCDR
[Oct 23 08:25:08] VERBOSE[9052] logger.c: – Executing [s@macro-hangupcall:3] GotoIf(“SIP/525-097d9d70”, “1?skiprg”) in new stack
[Oct 23 08:25:08] VERBOSE[9052] logger.c: – Goto (macro-hangupcall,s,6)
[Oct 23 08:25:08] DEBUG[9052] app_macro.c: Executed application: GotoIf
[Oct 23 08:25:08] VERBOSE[9052] logger.c: – Executing [s@macro-hangupcall:6] GotoIf(“SIP/525-097d9d70”, “1?skipblkvm”) in new stack
[Oct 23 08:25:08] VERBOSE[9052] logger.c: – Goto (macro-hangupcall,s,9)
[Oct 23 08:25:08] DEBUG[9052] app_macro.c: Executed application: GotoIf
[Oct 23 08:25:08] VERBOSE[9052] logger.c: – Executing [s@macro-hangupcall:9] GotoIf(“SIP/525-097d9d70”, “1?theend”) in new stack
[Oct 23 08:25:08] VERBOSE[9052] logger.c: – Goto (macro-hangupcall,s,11)
[Oct 23 08:25:08] DEBUG[9052] app_macro.c: Executed application: GotoIf
[Oct 23 08:25:08] VERBOSE[9052] logger.c: – Executing [s@macro-hangupcall:11] Hangup(“SIP/525-097d9d70”, “”) in new stack
[Oct 23 08:25:08] VERBOSE[9052] logger.c: == Spawn extension (macro-hangupcall, s, 11) exited non-zero on ‘SIP/525-097d9d70’ in macro ‘hangupcall’
[Oct 23 08:25:08] VERBOSE[9052] logger.c: == Spawn extension (macro-hangupcall, s, 11) exited non-zero on ‘SIP/525-097d9d70’
[Oct 23 08:25:09] VERBOSE[9061] logger.c: == Spawn extension (macro-dialout-trunk, s, 25) exited non-zero on ‘SIP/203-097c9f50’ in macro ‘dialout-trunk’
[Oct 23 08:25:09] VERBOSE[9061] logger.c: == Spawn extension (macro-dialout-trunk, s, 25) exited non-zero on ‘SIP/203-097c9f50’
[Oct 23 08:25:09] VERBOSE[9061] logger.c: – Executing [h@macro-dialout-trunk:1] Macro(“SIP/203-097c9f50”, “hangupcall”) in new stack
[Oct 23 08:25:09] VERBOSE[9061] logger.c: – Executing [s@macro-hangupcall:1] ResetCDR(“SIP/203-097c9f50”, “w”) in new stack
[Oct 23 08:25:09] ERROR[9061] cdr_addon_mysql.c: cdr_mysql: cannot connect to database server localhost. CDR will not be spooled.
[Oct 23 08:25:09] DEBUG[9061] cdr_addon_mysql.c: cdr_mysql: inserting a CDR record.
[Oct 23 08:25:09] DEBUG[9061] cdr_addon_mysql.c: cdr_mysql: SQL command as follows: INSERT INTO cdr (calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid) VALUES (‘2007-10-23 08:24:40’,’“2282064501” ',‘HospitalLomadeLuz’,‘818003473288’,‘from-internal’, ‘SIP/203-097c9f50’,‘SIP/vitel-outbound-0976add8’,‘Dial’,‘SIP/vitel-outbound/18003473288|300|’,29,29,‘ANSWERED’,3,‘1234’,‘1193149480.15’)
[Oct 23 08:25:09] DEBUG[9061] app_macro.c: Executed application: ResetCDR
[Oct 23 08:25:09] VERBOSE[9061] logger.c: – Executing [s@macro-hangupcall:2] NoCDR(“SIP/203-097c9f50”, “”) in new stack
[Oct 23 08:25:09] DEBUG[9061] app_macro.c: Executed application: NoCDR
[Oct 23 08:25:09] VERBOSE[9061] logger.c: – Executing [s@macro-hangupcall:3] GotoIf(“SIP/203-097c9f50”, “1?skiprg”) in new stack
[Oct 23 08:25:09] VERBOSE[9061] logger.c: – Goto (macro-hangupcall,s,6)
[Oct 23 08:25:09] DEBUG[9061] app_macro.c: Executed application: GotoIf
[Oct 23 08:25:09] VERBOSE[9061] logger.c: – Executing [s@macro-hangupcall:6] GotoIf(“SIP/203-097c9f50”, “1?skipblkvm”) in new stack
[Oct 23 08:25:09] VERBOSE[9061] logger.c: – Goto (macro-hangupcall,s,9)
[Oct 23 08:25:09] DEBUG[9061] app_macro.c: Executed application: GotoIf
[Oct 23 08:25:09] VERBOSE[9061] logger.c: – Executing [s@macro-hangupcall:9] GotoIf(“SIP/203-097c9f50”, “1?theend”) in new stack
[Oct 23 08:25:09] VERBOSE[9061] logger.c: – Goto (macro-hangupcall,s,11)
[Oct 23 08:25:09] DEBUG[9061] app_macro.c: Executed application: GotoIf
[Oct 23 08:25:09] VERBOSE[9061] logger.c: – Executing [s@macro-hangupcall:11] Hangup(“SIP/203-097c9f50”, “”) in new stack
[Oct 23 08:25:09] VERBOSE[9061] logger.c: == Spawn extension (macro-hangupcall, s, 11) exited non-zero on ‘SIP/203-097c9f50’ in macro ‘hangupcall’
[Oct 23 08:25:09] VERBOSE[9061] logger.c: == Spawn extension (macro-hangupcall, s, 11) exited non-zero on ‘SIP/203-097c9f50’

Either your max channel is set higher than 3 or the version of Asterisk you are running has a bug in it. Check what the global variable: OUTMAXCHANS_1 is set to in your extensions_additional.conf. If you want you can apply the patch below to your extensions_addtional.conf file as well to display the debug message in the CLI. But the logic that is being executed is correct and according to your trace, the reported number of channels in use is less than the max count, neither of which can be seen in the trace though.

Index: extensions.conf
===================================================================
--- extensions.conf     (revision 5137)
+++ extensions.conf     (working copy)
@@ -675,6 +675,7 @@
 exten => s,n,Set(DIAL_TRUNK_OPTIONS=${TRUNK_OPTIONS})
 exten => s,n,Macro(outbound-callerid,${DIAL_TRUNK})
 exten => s,n(skipoutcid),GotoIf($["${OUTMAXCHANS_${DIAL_TRUNK}}foo" = "foo"]?nomax)
+exten => s,n,Noop(Channel Count is: ${GROUP_COUNT()} Max Set is:  ${OUTMAXCHANS_${DIAL_TRUNK}})
 exten => s,n(checkmax),GotoIf($[ ${GROUP_COUNT()} > ${OUTMAXCHANS_${DIAL_TRUNK}} ]?chanfull)
 exten => s,n(nomax),AGI(fixlocalprefix) ; this sets DIAL_NUMBER to the proper dial string for this trunk
 exten => s,n,Set(OUTNUM=${OUTPREFIX_${DIAL_TRUNK}}${DIAL_NUMBER}) ; OUTNUM is the final dial number

Philippe Lindheimer - FreePBX Project Lead
http//freepbx.org - IRC #freepbx

Executing [s@macro-dialout-trunk:20] NoOp(“SIP/203-09208ab0”, “Channel Count is: 0 Max Set is: 1”) in new stack
Executing [s@macro-dialout-trunk:20] NoOp(“SIP/525-0920a508”, “Channel Count is: 0 Max Set is: 1”) in new stack

I get the same for both calls.

Looks like an Asterisk bug to me then, what specific version of Asterisk are you running?

Philippe Lindheimer - FreePBX Project Lead
http//freepbx.org - IRC #freepbx

I am using Asterisk 1.4.10.1

Description
GROUP_COUNT([groupname][@category])
Calculates the group count for the specified group, or uses the channel’s current group if not specifed (and non-empty).

Is the channels current group set by FreePbx script?

I changed your line of
exten => s,n,Noop(Channel Count is: ${GROUP_COUNT()} Max Set is: ${OUTMAXCHANS_${DIAL_TRUNK}})
to
exten => s,n,Noop(Channel Count is: ${GROUP_COUNT(OUT_1)} Max Set is: ${OUTMAXCHANS_${DIAL_TRUNK}})

and the line returns:

Channel Count is: 1 Max Set is: 1
Channel Count is: 2 Max Set is: 1

“, or uses the channel’s current group if not specifed” - it defaults to the current group which is set earlier in the macro. This code runs on almost all versions of Asterisk. It sure sounds like 1.4.10.1 has something broken in it. Try the newest 1.4 release (1.4.13) to see if they fixed it. If not, try switching to Asterisk 1.2 until they fix it. But it is clearly an asterisk bug.

Philippe Lindheimer - FreePBX Project Lead
http//freepbx.org - IRC #freepbx

I upgraded to 1.4.13 and it does the same. I have searched for a bug report and have not found one.

any chance of trying it on 1.2 to do a sanity check that there is not something else weird going on? I can look at changing the code similar to what you did above but fundamentally the bug needs fixing in Asterisk.

Philippe Lindheimer - FreePBX Project Lead
http//freepbx.org - IRC #freepbx

Try applying this to your original extensions.conf and let me know if it works, then I’ll consider putting it in but would still like to see Asterisk fixed:

Index: extensions.conf
===================================================================
--- extensions.conf     (revision 5137)
+++ extensions.conf     (working copy)
@@ -675,7 +675,7 @@
 exten => s,n,Set(DIAL_TRUNK_OPTIONS=${TRUNK_OPTIONS})
 exten => s,n,Macro(outbound-callerid,${DIAL_TRUNK})
 exten => s,n(skipoutcid),GotoIf($["${OUTMAXCHANS_${DIAL_TRUNK}}foo" = "foo"]?nomax)
-exten => s,n(checkmax),GotoIf($[ ${GROUP_COUNT()} > ${OUTMAXCHANS_${DIAL_TRUNK}} ]?chanfull)
+exten => s,n(checkmax),GotoIf($[ ${GROUP_COUNT(OUT_${DIAL_TRUNK})} > ${OUTMAXCHANS_${DIAL_TRUNK}} ]?chanfull)
 exten => s,n(nomax),AGI(fixlocalprefix) ; this sets DIAL_NUMBER to the proper dial string for this trunk
 exten => s,n,Set(OUTNUM=${OUTPREFIX_${DIAL_TRUNK}}${DIAL_NUMBER}) ; OUTNUM is the final dial number
 exten => s,n,Set(custom=${CUT(OUT_${DIAL_TRUNK},:,1)}) ; Custom trunks are prefixed with "AMP:"
@@ -767,7 +767,7 @@
 exten => s,n,Macro(outbound-callerid,${ARG1})
 exten => s,n,Set(GROUP()=OUT_${ARG1})
 exten => s,n,GotoIf($["${OUTMAXCHANS_${ARG1}}foo" = "foo"]?nomax)
-exten => s,n,GotoIf($[ ${GROUP_COUNT()} > ${OUTMAXCHANS_${ARG1}} ]?nochans)
+exten => s,n,GotoIf($[ ${GROUP_COUNT(OUT_${DIAL_TRUNK})} > ${OUTMAXCHANS_${ARG1}} ]?nochans)
 exten => s,n(nomax),Set(DIAL_NUMBER=${ARG2})
 exten => s,n,Set(DIAL_TRUNK=${ARG1})
 exten => s,n,AGI(fixlocalprefix)  ; this sets DIAL_NUMBER to the proper dial string for this trunk

Philippe Lindheimer - FreePBX Project Lead
http//freepbx.org - IRC #freepbx

The patch works fine. Thank you very much for the 1.4 bug workaround!

Is there a way to change the message that the busy trunk gives?

The person you are calling is not available does not make sense for trunk busy or not available.

Is this being posted to bugs.digium.com?

mustardman,
you are welcome to make the report to the digium bug tracker if it is not there, and it would be a good idea for it to be posted.

Philippe Lindheimer - FreePBX Project Lead
http//freepbx.org - IRC #freepbx

When I have a problem I do just that. In this case I don’t even fully understand the problem or your solution.

mustardman,
it is your problem as it is ‘yours’ as much as the rest of the community’s software - after all it is open source. But feel free to look into it or not. Someone will eventually.

Philippe Lindheimer - FreePBX Project Lead
http//freepbx.org - IRC #freepbx

I registered a bug at bugs.digium.com and they asked: Do you have a group specified in the channel config?

I do not know how FreePBX formats then channel. The answer to this question is yes as the channel group is OUT_1, correct?