[Home]

Summary:ASTERISK-13397: [patch] Group does not count all channels
Reporter:Marcin Kowalczyk (kowalma)Labels:
Date Opened:2009-01-19 08:51:33.000-0600Date Closed:2009-02-17 15:23:12.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Functions/func_groupcount
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20090216__bug14275.diff.txt
Description: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@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@mg-6e7a;2  pstn_T5             pstn_T5
Local/1010506017795@mg-6e7a;2  pstn_TOTAL          pstn_TOTAL
Local/1010509584481@mg-4072;2  pstn_T3             pstn_T3
Local/1010509584481@mg-4072;2  pstn_TOTAL          pstn_TOTAL
Local/1010508539547@mg-1830;2  pstn_T3             pstn_T3
Local/1010508539547@mg-1830;2  pstn_TOTAL          pstn_TOTAL
Local/1010507620141@mg-656d;2  pstn_T5             pstn_T5
Local/1010507620141@mg-656d;2  pstn_TOTAL          pstn_TOTAL
Local/1010506123380@mg-1df4;2  pstn_T2             pstn_T2
Local/1010506123380@mg-1df4;2  pstn_TOTAL          pstn_TOTAL
Local/105012501749256@mg-cffa;2  pstn_T1             pstn_T1
Local/105012501749256@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@mg,12
SIP/3129-a51ce5a0    03070208001728516081 Up      Dial(Local/101051608@mg,12
SIP/3117-a871dde8    03070102001257507984 Up      Dial(Local/101050798@mg,12
SIP/1208-a5158760    01070001001607516050 Up      Dial(Local/101051605@mg,12
SIP/2102-af8a71b0    02070005001167500139 Up      Dial(Local/101050013@mg,12
SIP/1069-a4d00018    01230101001103184456 Up      Dial(Local/103018445@mg,12
SIP/3131-a4d3bd38    03070205001782501038 Up      Dial(Local/101050103@mg,12
SIP/3166-a4f62970    03070601001523501765 Up      Dial(Local/101050176@mg,12
SIP/3192-a514d540    03070601001884503030 Up      Dial(Local/101050303@mg,12
SIP/3141-a8e95aa0    03070207001666509616 Up      Dial(Local/101050961@mg,12
SIP/1211-a4ff01d8    01070001001500502532 Up      Dial(Local/101050253@mg,12
SIP/1074-a8ebce30    01230101001135322384 Up      Dial(Local/103032238@mg,12
SIP/3133-a51c67c0    03070205001853501038 Up      Dial(Local/101050103@mg,12
SIP/3145-af8b27b8    03070205001872501222 Up      Dial(Local/101050122@mg,12
SIP/3136-a51aca80    03070208001833504166 Up      Dial(Local/101050416@mg,12
SIP/1221-a519bc10    01070001001352509222 Up      Dial(Local/101050922@mg,12
SIP/2130-a4fae368    02070004001188501418 Up      Dial(Local/101050141@mg,12
SIP/3194-a4576268    03070601001889506123 Up      Dial(Local/101050612@mg,12
SIP/3193-a8a83c68    03070102001820508539 Up      Dial(Local/101050853@mg,12
SIP/3164-a8a04000    03070601001812603663 Up      Dial(Local/101060366@mg,12
SIP/1076-a261c130    01230101001574713184 Up      Dial(Local/103071318@mg,12
SIP/3137-a264dbf0    03070205001684501038 Up      Dial(Local/101050103@mg,12
SIP/3142-ab809e18    03070205001642501038 Up      Dial(Local/101050103@mg,12
SIP/3143-a1f8b448    03070205001708509293 Up      Dial(Local/101050929@mg,12
SIP/3124-a204db98    03070102001593508480 Up      Dial(Local/101050848@mg,12
SIP/2106-a7b6fc70    02070003000550505157 Up      Dial(Local/101050515@mg,12
SIP/1072-a90e0880    01230101001335598612 Up      Dial(Local/103059861@mg,12
SIP/3130-a7acc388    03070205001843501037 Up      Dial(Local/101050103@mg,12
SIP/2133-a741c270    02070003000615502658 Up      Dial(Local/101050265@mg,12
SIP/3134-a7a54d20    03070205001911501036 Up      Dial(Local/101050103@mg,12
SIP/2123-a71eb930    02070003000661504268 Up      Dial(Local/101050426@mg,12
SIP/3176-a74e9648    03070601001714509150 Up      Dial(Local/101050915@mg,12
SIP/3162-a71aaea8    03070602001752508297 Up      Dial(Local/101050829@mg,12
SIP/1209-a9035fe0    01070001000472512093 Up      Dial(Local/101051209@mg,12
SIP/2107-a7aed6e8    02070003000558509376 Up      Dial(Local/101050937@mg,12
SIP/2101-a7aaba08    02070005001066506169 Up      Dial(Local/101050616@mg,12
SIP/2128-a7153fa8    02070003000811509023 Up      Dial(Local/101050902@mg,12
SIP/1068-a695c718    01070404001902502492 Up      Dial(Local/101050249@mg,12
SIP/3135-a6b7a340    03070205001644502313 Up      Dial(Local/101050231@mg,12
SIP/3156-a6d7a660    03070601001445505104 Up      Dial(Local/101050510@mg,12
SIP/3126-a9f3eb58    03070102001738508540 Up      Dial(Local/101050854@mg,12
SIP/3173-aac36b88    03070602001888509501 Up      Dial(Local/101050950@mg,12
SIP/3120-a87eff98    03070102001366507536 Up      Dial(Local/101050753@mg,12
SIP/2134-a30081e8    02070004001871500177 Up      Dial(Local/101050017@mg,12
Asterisk-node0:~#


SIP Agents dial number with special prefix and depending on that prefix * decides if use LCR or not.
Comments:By: Leif Madsen (lmadsen) 2009-01-20 14:36:55.000-0600

Assigning to myself to verify this issue. If the reporter determines this is no longer an issue before I get to it, please request this issue to be closed. Or provide any additional information which may be useful. Thanks!

By: Marcin Kowalczyk (kowalma) 2009-01-20 14:44:05.000-0600

Durring weekend I will upgrade box to 1.6.0.3 and I will update ticket.

By: Marcin Kowalczyk (kowalma) 2009-01-20 14:45:42.000-0600

One more thing... What I noticed is group show channels shows most recent ones added to group.

By: Leif Madsen (lmadsen) 2009-01-28 15:30:57.000-0600

kowalma:  did you happen to do an update over the weekend?

By: Marcin Kowalczyk (kowalma) 2009-01-28 15:52:20.000-0600

Box was upgraded to 1.6.0.5, tomorrow I will ask my colleuges to check if problem still persists.

By: Marcin Kowalczyk (kowalma) 2009-01-29 02:58:08.000-0600

1.6.0.5 did not solve issue.

By: Tilghman Lesher (tilghman) 2009-02-12 13:02:17.000-0600

kowalma:  are you using the /n flag on the Local channels to prevent Local channel optimization?

By: Marcin Kowalczyk (kowalma) 2009-02-12 13:19:43.000-0600

Hi,

My dialplan is more less following

[out]
<cut>
exten => _XXXXXXXXXXXXXXXXXXXXXX.,n,Dial(Local/${gw}${prefix}${number}@mg,120)

[mg]
exten => _1010X.,1,nocdr()
exten => _1010X.,n,goto(E1_out,${EXTEN:4},1)
exten => _1010X.,n,hangup(${HANGUPCAUSE})

should I use sth like: Dial(Local/${gw}${prefix}${number}@mg,120,n) ?

This is odd for me as according to voipinfo:


"n: (Asterisk 1.1 and later) July 2005 bug 752 was included in CVS (Asterisk 1.1) and enhances the privacy manager considerably. As part of this patch, the 'n' flag to Dial got changed to be used as part of the privacy features, instead of being the 'dont jump to +101' flag. That flag is now 'j'. "



By: Leif Madsen (lmadsen) 2009-02-12 15:40:23.000-0600

The format would be more like this:

exten => _XXXXXXXXXXXXXXXXXXXXXX.,n,Dial(Local/${gw}${prefix}${number}@mg/n,120)

By: Marcin Kowalczyk (kowalma) 2009-02-12 15:50:30.000-0600

I've added /n to dialplan.

As now at my place is 2300 so I will update ticket tomorrow durring workday.

By: Tilghman Lesher (tilghman) 2009-02-12 15:58:29.000-0600

My working theory, to be confirmed or not, is that optimization is causing the channel to go away and the replacement is not inheriting the group definition.

By: Marcin Kowalczyk (kowalma) 2009-02-13 02:37:39.000-0600

Seems adding /n to dialplan solved problem.

By: Marcin Kowalczyk (kowalma) 2009-02-13 05:37:54.000-0600

Adding /n causes very high loads on the box.
Without /n box loads are ~0.3 with loads go up to 12 and call processing is interupted.
I have approx 150 concurent calls.

By: Marcin Kowalczyk (kowalma) 2009-02-13 14:20:10.000-0600

I've changed Dial(Local/xxxxx@mg/n,120) to goto(mg,xxxx,1) and seems that group counts connections as expected.
But I think when inital connection is setup by Local channels should be counted.

By: Tilghman Lesher (tilghman) 2009-02-16 15:27:30.000-0600

This should get the group definition inherited across the channels properly.

By: Marcin Kowalczyk (kowalma) 2009-02-16 16:26:57.000-0600

Patch applied against 1.6.0.5. In few hours I will provide results.



By: Marcin Kowalczyk (kowalma) 2009-02-17 11:16:29.000-0600

Provided patch solved problem.

By: Digium Subversion (svnbot) 2009-02-17 15:14:19.000-0600

Repository: asterisk
Revision: 176642

U   trunk/channels/chan_local.c

------------------------------------------------------------------------
r176642 | tilghman | 2009-02-17 15:14:19 -0600 (Tue, 17 Feb 2009) | 8 lines

Prior to masquerade, move the group definitions to the channel performing the
masq, so that the group count lingers past the bridge.
(closes issue ASTERISK-13397)
Reported by: kowalma
Patches:
      20090216__bug14275.diff.txt uploaded by Corydon76 (license 14)
Tested by: kowalma

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=176642

By: Digium Subversion (svnbot) 2009-02-17 15:15:10.000-0600

Repository: asterisk
Revision: 176643

_U  branches/1.6.0/
U   branches/1.6.0/channels/chan_local.c

------------------------------------------------------------------------
r176643 | tilghman | 2009-02-17 15:15:10 -0600 (Tue, 17 Feb 2009) | 15 lines

Merged revisions 176642 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r176642 | tilghman | 2009-02-17 15:14:18 -0600 (Tue, 17 Feb 2009) | 8 lines
 
 Prior to masquerade, move the group definitions to the channel performing the
 masq, so that the group count lingers past the bridge.
 (closes issue ASTERISK-13397)
  Reported by: kowalma
  Patches:
        20090216__bug14275.diff.txt uploaded by Corydon76 (license 14)
  Tested by: kowalma
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=176643

By: Digium Subversion (svnbot) 2009-02-17 15:16:54.000-0600

Repository: asterisk
Revision: 176644

_U  branches/1.6.1/
U   branches/1.6.1/channels/chan_local.c
U   branches/1.6.1/res/res_odbc.c

------------------------------------------------------------------------
r176644 | tilghman | 2009-02-17 15:16:53 -0600 (Tue, 17 Feb 2009) | 21 lines

Merged revisions 176592,176642 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r176592 | tilghman | 2009-02-17 12:49:20 -0600 (Tue, 17 Feb 2009) | 4 lines
 
 Add assertions in the quest to track down a refcount leak.
 (closes issue ASTERISK-13589)
  Reported by: davevg
........
 r176642 | tilghman | 2009-02-17 15:14:18 -0600 (Tue, 17 Feb 2009) | 8 lines
 
 Prior to masquerade, move the group definitions to the channel performing the
 masq, so that the group count lingers past the bridge.
 (closes issue ASTERISK-13397)
  Reported by: kowalma
  Patches:
        20090216__bug14275.diff.txt uploaded by Corydon76 (license 14)
  Tested by: kowalma
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=176644

By: Digium Subversion (svnbot) 2009-02-17 15:22:04.000-0600

Repository: asterisk
Revision: 176661

U   branches/1.4/channels/chan_local.c

------------------------------------------------------------------------
r176661 | tilghman | 2009-02-17 15:22:04 -0600 (Tue, 17 Feb 2009) | 9 lines

Backport change to 1.4:
 Prior to masquerade, move the group definitions to the channel performing the
 masq, so that the group count lingers past the bridge.
 (closes issue ASTERISK-13397)
  Reported by: kowalma
  Patches:
        20090216__bug14275.diff.txt uploaded by Corydon76 (license 14)
  Tested by: kowalma

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=176661

By: Digium Subversion (svnbot) 2009-02-17 15:23:12.000-0600

Repository: asterisk
Revision: 176669

_U  trunk/

------------------------------------------------------------------------
r176669 | tilghman | 2009-02-17 15:23:11 -0600 (Tue, 17 Feb 2009) | 16 lines

Recorded merge of revisions 176661 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
 r176661 | tilghman | 2009-02-17 15:21:41 -0600 (Tue, 17 Feb 2009) | 9 lines
 
 Backport change to 1.4:
   Prior to masquerade, move the group definitions to the channel performing the
   masq, so that the group count lingers past the bridge.
   (closes issue ASTERISK-13397)
    Reported by: kowalma
    Patches:
          20090216__bug14275.diff.txt uploaded by Corydon76 (license 14)
    Tested by: kowalma
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=176669