Open Source Training Seminar FreePBX Paid Support

Ticket #2715 (closed Bugs: invalid)

Opened 6 months ago

Last modified 2 months ago

Order by Flags causing incorrect ordering in conf files

Reported by: robmac Assigned to: p_lindheimer
Priority: major Milestone: 2.5
Component: Core Version: 2.4-branch
Keywords: context extensions trunks Cc:
Confirmation: Need Feedback SVN Revision (if applicable):
Backend Engine: All Backend Engine Version:

Description

Because of the order by flags statements in /var/www/html/admin/modules/core/inc.functions.php (and possibly others) the entries in the conf files are not written in an appropriate order for all scenarios. This is most apparent when using either custom trunks (or my earlier patch for adding OOH323, MGCP & Skinny support) and the protocol in question uses line statements (which depend on context) where context appears after the line definitions and is therefore those extensions/trunks try to use the "Default" context. This would also cause problems on multiline endpoints where different parameters applied to different lines.

This would also be a serious issue for any context sensitive value on a trunk which did not appear after context= when reverse alpha sorted

The order values are entered into the FreePBX GUI therefore needs to be preserved

An example of a skinny_additional.conf generated by FreePBX would be

[1004]
version=P03-08-02
secret=1004
record_out=Adhoc
record_in=Adhoc
pickupgroup=
model=7985
mailbox=1004@device
linelabel1=1004
linelabel2=Helpdesk
line=1
line=2
host=192.168.1.253
disallow=all
dial=Skinny/1@1004
device=SEP000F6644F5A6
context=from-internal
context=from-internal
callgroup=
callerid=device <1004>
callerid=Helpdesk
allow=ulaw
accountcode=

When what was actually desired and entered in the GUI was

[1004]
version=P03-08-02
secret=1004
record_out=Adhoc
record_in=Adhoc
model=7985
host=192.168.1.253
disallow=all
device=SEP000F6644F5A6

context=from-internal
line=1
linelabel1=1004
callerid=device <1004>
dial=Skinny/1@1004
pickupgroup=
callgroup=
callerid=device <1004>
allow=ulaw
accountcode=
mailbox=1004@device

context=from-helpdesk
line=2
linelabel2=Helpdesk
dial=Skinny/2@1004
pickupgroup=
callerid=Helpdesk
allow=ulaw
accountcode=
mailbox=1004@device

Disregarding the multi-line issues an issue still remains where context is defined before context sensitive values

Change History

02/27/08 07:08:52 changed by robmac

Actually I think it may be order by keyword DESC that is causing the problem rather than Order By Flags however the issue remains regardless of the code that is the cause

03/06/08 03:49:12 changed by robmac

A further issue identified is that this prevents specifying the preferred codec order

03/06/08 06:48:07 changed by p_lindheimer

  • confirmation changed from Unreviewed to Need Feedback.
  • milestone changed from Cut Line to 3.0.

robmac, can you try to dig through and be more specific on the issue? In the past it would always order DESC which did break somethings. At least for trunks, I modified things in 2.4 and hijacked the flags field to create a sequence so that the order would remain as you put it in:

  foreach($confitem as $k=>$v) {
    $seq = ($disable_flag == 1) ? 1 : $seq+1;
    $dbconfitem[]=array($k,$v,$seq);
  }
  $compiled = $db->prepare("INSERT INTO $table (id, keyword, data, flags) values ('9999$trunknum',?,?,?)");
  $result = $db->executeMultiple($compiled,$dbconfitem);

Is the issue with extensions and manifested uniquely with the codecs since it is treated a little differently with the codec=ulaw&gsm&g729 format in one text box?

03/06/08 08:48:18 changed by robmac

Hi Philippe,

Trunk settings are written to file in the order entered, but extensions are sorted in reverse alpha order.

Removing "order by keyword DESC" causes the entries to be written in ascending order so "order by keyword DESC" is not the cause and it doesn't matter whether the entries are in ascending or descdening order as in both cases it is wrong !

For IAX & SIP I believe that the only thing currently affected is codecs although this could easily change with the addition of new values in 1.6 or the addition of any of the existing values to the subset currently being specified.

For H323, MGCP & Skinny it is reaking havoc with numerous settings, the order that the entries are in the code (and the gui) need to be preserved.

My PHP is not yet good enough to deal with this so I am hoping one of the official developers can address this.

Thanks Rob

03/06/08 09:26:38 changed by p_lindheimer

Rob, it does not surprise me that the Device settings have an issue. The trunks were only fixed in 2.4. Everything used to be ordered DESC. This was a hack someone did a long time ago so that 'disallow=all' , 'allow=codecs' would work. It broke deny/permit in iax, #2062, which the new sequencing fixed.

I'll leave the ticket open. I suspect it will not be hard to modify the device code to simply apply the sequence numbering to the flags as they are listed. It just needs to be assured that the options are presented in the proper order. The 'safest' change would be to hard code the sequence on existing sip and iax technologies for these fields to DESC order so that they will continue to be generated as they have been and not cause other anomalies, but allow new ordering to be applied.

In the case of your new code, there is nothing stopping you from applying sequence numbers to the flags to assure that your stuff gets generated in the proper order.

06/21/08 15:41:04 changed by p_lindheimer

  • status changed from new to closed.
  • resolution set to invalid.

closing this bug. All of the generation sorts on the flags, then DESC and prior to the flag being used, it always sorted on DESC. If there is an issue with the order, then a bugs should be filed against the code that is storing any particular device information since the order it is output can be controlled through the 'flag' seq number as with trunks.

Donate



Support
Download
Develop
Forums
News
Documentation
Paid Support
About

Paid Ads