[Home]

Summary:ASTERISK-28955: "setvar" doesn't work properly in dahdi-channels.conf
Reporter:Marin Odrljin (modrljin)Labels:fax
Date Opened:2020-06-18 04:19:10Date Closed:2020-06-19 09:13:59
Priority:MinorRegression?Yes
Status:Closed/CompleteComponents:Core/Configuration
Versions:16.11.0 Frequency of
Occurrence
Constant
Related
Issues:
is related toASTERISK-23756 setvar directive when used in template and a child of said template, results in duplicate variable names
Environment:Attachments:
Description:"setvar" works differently than in previous Asterisk versions, e.g. 16.4.1 or 13.11.2.

I have following dahdi-channels.conf:

{code}
; Span 1: TE8/0/1 "T8XXP (PCI) Card 0 Span 1" (MASTER)
; Server X IN channels
group = 11
setvar = GROUP_NR=11
context = from-pri
switchtype = euroisdn
signalling = pri_net
channel => 1-15,17-21

; Server X OUT channels
group = 12
setvar = GROUP_NR=12
context = from-pri
switchtype = euroisdn
signalling = pri_net
channel => 22-31

; Span 2: TE8/0/2 "T8XXP (PCI) Card 0 Span 2"
; Asterisk .98
group = 2
setvar = GROUP_NR=2
context = from-pri
switchtype = euroisdn
signalling = pri_net
channel => 32-46,48-62

; ... other spans

; Span 8: TE8/0/8 "T8XXP (PCI) Card 0 Span 8"
; Panasonic PBX
group = 8
setvar = GROUP_NR=8
context = from-pri
switchtype = euroisdn
signalling = pri_net
channel => 218-232,234-248
{code}

And extensions.conf:

{code}
[from-pri]
exten => _X!,1,Stasis(AriStart,SPAN=${CHANNEL(dahdi_span)},CHANNEL=${CHANNEL(dahdi_channel)},GROUP=${GROUP_NR}, ...other parameters)
{code}

In every group I have "setvar = GROUP_NR=X". This is a convenient way how I can have only one entry in dialplan for context "from-pri" and to know from which group a call came in. In Asterisk 13 that works fine, but we have decided to slowly move toward newer Asterisk version 16 because of new features and LTS. We have started to test with Asterisk 16.4.1 when it came out and this part with "setvar" was working fine, but now we took a latest one for production server and "setvar" is not working properly anymore. In version 16.11 if call comes at span 8, variable GROUP_NR is set to value 11 (1st group and setvar from our config) and not to value 8 as defined in that group. It looks like either parsing of the config file has changed and it takes now the "setvar" entry from the first group where it occurs. If I remove all "setvar=GROUP_NR=..." except in the last group 8 then it is fine. In previous versions and the same config files GROUP_NR variable was always set to the value according to "setvar" directive from that group.
Comments:By: Asterisk Team (asteriskteam) 2020-06-18 04:19:11.786-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

By: Guido Falsi (madpilot) 2020-06-18 05:38:18.434-0500

Hi, I filed a patch which could fix this, but I am unable to properly test it, since I don't have dahdi hardware.

Marin, are you able to test my patch?

Also, could you send here the output of "dahdi show channel" for one of the affected channels without the patch? that could help better diagnose this.

By: Marin Odrljin (modrljin) 2020-06-18 05:57:42.376-0500

Yes we will test your patch soon.

Here is the output of  dahdi show channel 248:

{code}
Channel: 248
Description:
File Descriptor: 257
Span: 8
Extension: 42999101
Dialing: no
Context: from-pri
Caller ID: 42999104
Calling TON: 1
Caller ID subaddress:
Caller ID name:
Mailbox: none
Variables:
      GROUP_NR = 11
Destroy: 0
InAlarm: 0
Signalling Type: ISDN PRI
Radio: 0
Owner: DAHDI/i8/42999104-2
Real: DAHDI/i8/42999104-2
Callwait: <None>
Threeway: <None>
Confno: -1
Propagated Conference: -1
Real in conference: 0
DSP: yes
Busy Detection: no
TDD: no
Relax DTMF: no
Dialing/CallwaitCAS: 0/0
Default law: alaw
Fax Handled: no
Pulse phone: no
HW Gains (RX/TX): Disabled/Disabled
SW Gains (RX/TX): 0.00/0.00
Dynamic Range Compression (RX/TX): 0.00/0.00
DND: no
Echo Cancellation:
       1 taps
       (unless TDM bridged) currently OFF
Wait for dialtone: 0ms
Master Channel: 218
PRI Flags: Call
PRI Logical Span: Implicit
Actual Confinfo: Num/218, Mode/0x0009
Actual Confmute: No
Hookstate (FXS only): Onhook
{code}

By: Marin Odrljin (modrljin) 2020-06-18 07:29:17.156-0500

Hi Guido, your patch is working fine, thanks a lot!

We have tested it only on Asterisk 16.11. Here is new "dahdi show channel" output:

{code}
...
Variables:
      GROUP_NR = 8
Destroy: 0
...
{code}

By: Friendly Automation (friendly-automation) 2020-06-19 09:14:01.299-0500

Change 14568 merged by Joshua Colp:
chan_dadhi: Fix setvar in dahdi channels

[https://gerrit.asterisk.org/c/asterisk/+/14568|https://gerrit.asterisk.org/c/asterisk/+/14568]

By: Friendly Automation (friendly-automation) 2020-06-19 09:14:17.342-0500

Change 14595 merged by Joshua Colp:
chan_dadhi: Fix setvar in dahdi channels

[https://gerrit.asterisk.org/c/asterisk/+/14595|https://gerrit.asterisk.org/c/asterisk/+/14595]

By: Friendly Automation (friendly-automation) 2020-06-19 09:19:15.577-0500

Change 14594 merged by Friendly Automation:
chan_dadhi: Fix setvar in dahdi channels

[https://gerrit.asterisk.org/c/asterisk/+/14594|https://gerrit.asterisk.org/c/asterisk/+/14594]

By: Friendly Automation (friendly-automation) 2020-06-19 09:22:25.559-0500

Change 14593 merged by Kevin Harwell:
chan_dadhi: Fix setvar in dahdi channels

[https://gerrit.asterisk.org/c/asterisk/+/14593|https://gerrit.asterisk.org/c/asterisk/+/14593]