[Home]

Summary:ASTERISK-16766: [patch] dialgroup fills database with duplicates
Reporter:Bunny Evans (bunny)Labels:
Date Opened:2010-10-04 20:37:07Date Closed:2010-12-16 02:57:01.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Functions/func_dialgroup
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20101006__issue18091.diff.txt
Description:every time a dialgroup is called, it appends to the astdb resulting in a ridiculous number of repeats. It is, however, sorting the duplicates.

example usage:
http://www.asterisk.org/docs/asterisk/trunk/functions/dialgroup
http://www.voip-info.org/wiki/view/Asterisk+func+dialgroup

Either the way to use dialgroup is violently wrong or there is a bug in how stuff works.

After a while, you end up with:

/dialgroup/5f                                     : SIP/500@phone-521.office&SIP/500@phone-521.office&SIP/500@phone-521.office
&SIP/500@phone-521.office&SIP/500@phone-521.office&SIP/500@phone-521.office
&SIP/500@phone-521.office&SIP/500@phone-521.office&SIP/500@phone-521.office
&SIP/500@phone-521.office&SIP/500@phone-521.office&SIP/500@phone-521.office
&SIP/500@phone-521.office&SIP/500@phone-521.office&SIP/500@phone-521.office
&SIP/500@phone-521.office&SIP/500@phone-521.office&SIP/500@phone-521.office
...
&SIP/500@phone-521.office&SIP/500@phone-521.office&SIP/500@phone-521.office
&SIP/500@phone-521.office&SIP/500@phone-521.office&SIP/500@phone-521.office
&SIP/500@phone-521.office&SIP/500@phone-521.office&SIP/500@phone-512.office
&SIP/500@phone-513.office&SIP/500@phone-512.office&SIP/500@phon...


database deltree dialgroup/5f also lies about its success.


****** ADDITIONAL INFORMATION ******

To reproduce:

; silent ring these extensions on call to 5f
exten = 500,1,NoOp(5f)
exten = 500,n,Set(DIALGROUP(5f,add)=SIP/500@phone-512.office)
exten = 500,n,Set(DIALGROUP(5f,add)=SIP/500@phone-513.office)
exten = 500,n,Set(DIALGROUP(5f,add)=SIP/500@phone-521.office)
exten = 500,n,Set(DIALGROUP(5f,add)=SIP/500@phone-522.office)
exten = 500,n,Dial(${DIALGROUP(5f)},,ikKtT)
exten = 500,n,Hangup

dial extension 500,
database show dialgroup/5f
dial extension 500,
database show dialgroup/5f
etc.

--------------------------
atomic*CLI> database showkey dialgroup/5f
/dialgroup/5f                                     : SIP/500@phone-521.office&SIP/500@phone-521.office&SIP/500@phone-521.office&
...
atomic*CLI> database deltree dialgroup/5f
1 database entries removed.
atomic*CLI> database deltree dialgroup/5f
1 database entries removed.
Comments:By: Tilghman Lesher (tilghman) 2010-10-06 08:54:31

Yeah, you're not supposed to add to the dialgroup each time on a dial.  Think of a dialgroup as something that a phone logs into and out of.  Nevertheless, this should not result in duplicates, so I'll look at removing those.

By: Tilghman Lesher (tilghman) 2010-10-06 09:06:47

I see that the documentation also needs to be updated, but let's ensure this patch fixes your duplicates, first.

By: Bunny Evans (bunny) 2010-10-06 22:08:11

I guess my understanding of it was wrong.
I thought it was a less error prone way (than say, 20 SIP/500@phone-XXX.office& on one line) to build up the actual Dial( STUFF ) line.
As the Dial( all these phones ) soon becomes unmanageable.

Perhaps if there was a place to define and fill up the DIALGROUPS outside the
extension stuff, that would make more sense and that is likely what I am doing wrong. Our dialgroups don't change much, just some people want to know when calls are coming in for other groups...

Database delete appears to lie, but that might be pilot error.

installed patch
removed astdb from /var/opt/asterisk
restarted asterisk
called 500

/dialgroup/5f                                     : SIP/500@phone-521.office&SIP/500@phone-512.office&SIP/500@phone-513.office&SIP/500@phone-522.office

called again.
/dialgroup/5f                                     : SIP/500@phone-521.office&SIP/500@phone-512.office&SIP/500@phone-513.office&SIP/500@phone-522.office


So this fix appears to work.

Thank you very much.

By: Tilghman Lesher (tilghman) 2010-10-11 11:32:38

<i>As the Dial( all these phones ) soon becomes unmanageable.</i>

An alternate method of doing that would be to define a variable in the [globals] section of extensions.conf, then reference that variable anytime you need a particular set of phones.  For that matter, you can still use DIALGROUP() in this way, but think of the set of phones as a set of dynamic items that individuals can remove themselves from (or add themselves to) as the situation warrants.

By: Digium Subversion (svnbot) 2010-12-16 02:54:24.000-0600

Repository: asterisk
Revision: 298477

U   branches/1.6.2/funcs/func_dialgroup.c

------------------------------------------------------------------------
r298477 | tilghman | 2010-12-16 02:54:23 -0600 (Thu, 16 Dec 2010) | 8 lines

Eliminate duplicates from container.

(closes issue ASTERISK-16766)
Reported by: bunny
Patches:
      20101006__issue18091.diff.txt uploaded by tilghman (license 14)
Tested by: bunny

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

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

By: Digium Subversion (svnbot) 2010-12-16 02:56:14.000-0600

Repository: asterisk
Revision: 298478

_U  branches/1.8/
U   branches/1.8/funcs/func_dialgroup.c

------------------------------------------------------------------------
r298478 | tilghman | 2010-12-16 02:56:13 -0600 (Thu, 16 Dec 2010) | 15 lines

Merged revisions 298477 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2

........
 r298477 | tilghman | 2010-12-16 02:54:23 -0600 (Thu, 16 Dec 2010) | 8 lines
 
 Eliminate duplicates from container.
 
 (closes issue ASTERISK-16766)
  Reported by: bunny
  Patches:
        20101006__issue18091.diff.txt uploaded by tilghman (license 14)
  Tested by: bunny
........

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

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

By: Digium Subversion (svnbot) 2010-12-16 02:57:00.000-0600

Repository: asterisk
Revision: 298479

_U  trunk/
U   trunk/funcs/func_dialgroup.c

------------------------------------------------------------------------
r298479 | tilghman | 2010-12-16 02:57:00 -0600 (Thu, 16 Dec 2010) | 22 lines

Merged revisions 298478 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
 r298478 | tilghman | 2010-12-16 02:56:13 -0600 (Thu, 16 Dec 2010) | 15 lines
 
 Merged revisions 298477 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.6.2
 
 ........
   r298477 | tilghman | 2010-12-16 02:54:23 -0600 (Thu, 16 Dec 2010) | 8 lines
   
   Eliminate duplicates from container.
   
   (closes issue ASTERISK-16766)
    Reported by: bunny
    Patches:
          20101006__issue18091.diff.txt uploaded by tilghman (license 14)
    Tested by: bunny
 ........
................

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

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