[asterisk-dev] [0014275] Group does not count all channels
Marcin J. Kowalczyk
marcin.kowalczyk at ccig.pl
Tue Jan 20 12:16:35 CST 2009
I found issues with group function. I use following dialplan to count
connection on each trunk:
[pstn_out]
exten => _X.,1,Set(Proba=0)
exten => _X.,n,nocdr()
exten => _X.,n(start),GotoIf($[${GROUP_COUNT(pstn_TOTAL)} > 150]?full)
exten => _X.,n,GotoIf($[${Proba} = 20]?pelno)
exten => _X.,n,Set(losujTrunk=${RAND(1,6)})
exten => _X.,n,gosub(sprawdzTrunkpstn,${losujTrunk},1)
exten => _X.,n,GotoIf($[${TrunkOK} = 1]?trunkOK)
exten => _X.,n,set(Proba=$[${Proba} + 1])
exten => _X.,n,goto(start)
exten => _X.,n(trunkOK),GotoIf($[${GROUP_COUNT(pstn_T${losujTrunk})} <
$[${TrunkCap}+0] ]?traktPusty)
exten => _X.,n,set(Proba=$[${Proba} + 1])
exten => _X.,n,goto(start)
exten => _X.,n(traktPusty),Noop("Obecne liczba polaczen:
${GROUP_COUNT(pstn_TOTAL)} Trunk${losujTrunk}:
${GROUP_COUNT(pstn_T${losujTrunk})}")
exten => _X.,n,set(GROUP(pstn_T${losujTrunk})=pstn_T${losujTrunk})
exten => _X.,n,set(GROUP(pstn_TOTAL)=pstn_TOTAL)
exten => _X.,n,dial(${TrunkPeer}/${TrunkPrefix}${EXTEN})
;exten => _X.,n,dial(Local/${losujTrunk}123 at test)
exten => _X.,n,hangup(${HANGUPCAUSE})
exten => _X.,n(pelno),congestion
exten => h,1,hangup(16)
[sprawdzTrunkpstn]
exten => 1,1,set(TrunkOK=1)
exten => 1,n,set(TrunkCap=30)
exten => 1,n,set(TrunkPeer=SIP/mg0)
exten => 1,n,set(TrunkPrefix=1101)
exten => 1,n,return
exten => 2,1,set(TrunkOK=1)
exten => 2,n,set(TrunkCap=30)
exten => 2,n,set(TrunkPeer=SIP/mg0)
exten => 2,n,set(TrunkPrefix=1102)
exten => 2,n,return
exten => 3,1,set(TrunkOK=1)
exten => 3,n,set(TrunkCap=30)
exten => 3,n,set(TrunkPeer=SIP/mg0)
exten => 3,n,set(TrunkPrefix=1103)
exten => 3,n,return
exten => 4,1,set(TrunkOK=1)
exten => 4,n,set(TrunkCap=30)
exten => 4,n,set(TrunkPeer=SIP/mg0)
exten => 4,n,set(TrunkPrefix=1104)
exten => 4,n,return
exten => 5,1,set(TrunkOK=1)
exten => 5,n,set(TrunkCap=30)
exten => 5,n,set(TrunkPeer=SIP/mg1)
exten => 5,n,set(TrunkPrefix=1105)
exten => 5,n,return
exten => 6,1,set(TrunkOK=0)
exten => 6,n,set(TrunkCap=4)
exten => 6,n,set(TrunkPeer=SIP/192.168.0.20)
exten => 6,n,set(TrunkPrefix=16)
exten => 6,n,return
exten => i,1,set(TrunkOK=0)
exten => i,n,return
cals with prefix 1010 are routed to pstn_out context:
exten => _1010X.,1,nocdr()
exten => _1010X.,n,goto(pstn_out,${EXTEN:4},1)
exten => _1010X.,n,hangup(${HANGUPCAUSE})
and seems it works BUT:
Asterisk-node0:~# rasterisk -x "group show channels pstn"
Channel Group Category
Local/1010506017795 at mg-6e7a;2 pstn_T5 pstn_T5
Local/1010506017795 at mg-6e7a;2 pstn_TOTAL pstn_TOTAL
Local/1010509584481 at mg-4072;2 pstn_T3 pstn_T3
Local/1010509584481 at mg-4072;2 pstn_TOTAL pstn_TOTAL
Local/1010508539547 at mg-1830;2 pstn_T3 pstn_T3
Local/1010508539547 at mg-1830;2 pstn_TOTAL pstn_TOTAL
Local/1010507620141 at mg-656d;2 pstn_T5 pstn_T5
Local/1010507620141 at mg-656d;2 pstn_TOTAL pstn_TOTAL
Local/1010506123380 at mg-1df4;2 pstn_T2 pstn_T2
Local/1010506123380 at mg-1df4;2 pstn_TOTAL pstn_TOTAL
Local/105012501749256 at mg-cffa;2 pstn_T1 pstn_T1
Local/105012501749256 at mg-cffa;2 pstn_TOTAL pstn_TOTAL
12 active channels
shows that I have only 6 concurent connections but:
Asterisk-node0:~# rasterisk -x "core show channels" | grep 1010 | grep Up
SIP/3159-a512f478 03070601001620504061 Up Dial(Local/101050406 at mg,12
SIP/3129-a51ce5a0 03070208001728516081 Up Dial(Local/101051608 at mg,12
SIP/3117-a871dde8 03070102001257507984 Up Dial(Local/101050798 at mg,12
SIP/1208-a5158760 01070001001607516050 Up Dial(Local/101051605 at mg,12
SIP/2102-af8a71b0 02070005001167500139 Up Dial(Local/101050013 at mg,12
SIP/1069-a4d00018 01230101001103184456 Up Dial(Local/103018445 at mg,12
SIP/3131-a4d3bd38 03070205001782501038 Up Dial(Local/101050103 at mg,12
SIP/3166-a4f62970 03070601001523501765 Up Dial(Local/101050176 at mg,12
SIP/3192-a514d540 03070601001884503030 Up Dial(Local/101050303 at mg,12
SIP/3141-a8e95aa0 03070207001666509616 Up Dial(Local/101050961 at mg,12
SIP/1211-a4ff01d8 01070001001500502532 Up Dial(Local/101050253 at mg,12
SIP/1074-a8ebce30 01230101001135322384 Up Dial(Local/103032238 at mg,12
SIP/3133-a51c67c0 03070205001853501038 Up Dial(Local/101050103 at mg,12
SIP/3145-af8b27b8 03070205001872501222 Up Dial(Local/101050122 at mg,12
SIP/3136-a51aca80 03070208001833504166 Up Dial(Local/101050416 at mg,12
SIP/1221-a519bc10 01070001001352509222 Up Dial(Local/101050922 at mg,12
SIP/2130-a4fae368 02070004001188501418 Up Dial(Local/101050141 at mg,12
SIP/3194-a4576268 03070601001889506123 Up Dial(Local/101050612 at mg,12
SIP/3193-a8a83c68 03070102001820508539 Up Dial(Local/101050853 at mg,12
SIP/3164-a8a04000 03070601001812603663 Up Dial(Local/101060366 at mg,12
SIP/1076-a261c130 01230101001574713184 Up Dial(Local/103071318 at mg,12
SIP/3137-a264dbf0 03070205001684501038 Up Dial(Local/101050103 at mg,12
SIP/3142-ab809e18 03070205001642501038 Up Dial(Local/101050103 at mg,12
SIP/3143-a1f8b448 03070205001708509293 Up Dial(Local/101050929 at mg,12
SIP/3124-a204db98 03070102001593508480 Up Dial(Local/101050848 at mg,12
SIP/2106-a7b6fc70 02070003000550505157 Up Dial(Local/101050515 at mg,12
SIP/1072-a90e0880 01230101001335598612 Up Dial(Local/103059861 at mg,12
SIP/3130-a7acc388 03070205001843501037 Up Dial(Local/101050103 at mg,12
SIP/2133-a741c270 02070003000615502658 Up Dial(Local/101050265 at mg,12
SIP/3134-a7a54d20 03070205001911501036 Up Dial(Local/101050103 at mg,12
SIP/2123-a71eb930 02070003000661504268 Up Dial(Local/101050426 at mg,12
SIP/3176-a74e9648 03070601001714509150 Up Dial(Local/101050915 at mg,12
SIP/3162-a71aaea8 03070602001752508297 Up Dial(Local/101050829 at mg,12
SIP/1209-a9035fe0 01070001000472512093 Up Dial(Local/101051209 at mg,12
SIP/2107-a7aed6e8 02070003000558509376 Up Dial(Local/101050937 at mg,12
SIP/2101-a7aaba08 02070005001066506169 Up Dial(Local/101050616 at mg,12
SIP/2128-a7153fa8 02070003000811509023 Up Dial(Local/101050902 at mg,12
SIP/1068-a695c718 01070404001902502492 Up Dial(Local/101050249 at mg,12
SIP/3135-a6b7a340 03070205001644502313 Up Dial(Local/101050231 at mg,12
SIP/3156-a6d7a660 03070601001445505104 Up Dial(Local/101050510 at mg,12
SIP/3126-a9f3eb58 03070102001738508540 Up Dial(Local/101050854 at mg,12
SIP/3173-aac36b88 03070602001888509501 Up Dial(Local/101050950 at mg,12
SIP/3120-a87eff98 03070102001366507536 Up Dial(Local/101050753 at mg,12
SIP/2134-a30081e8 02070004001871500177 Up Dial(Local/101050017 at mg,12
Asterisk-node0:~#
SIP Agents dial number with special prefix and depending on that prefix
* decides if use LCR or not.
--
Pozdrawiam serdecznie
Marcin Kowalczyk
System Administrator
Call Center Inter Galactica
ul. Jana Kilinskiego 30, 50-264 Wroclaw, Poland
telefon: +48 71 722 72 91 e-mail: marcin.kowalczyk at ccig.pl
More information about the asterisk-dev
mailing list