[asterisk-bugs] [JIRA] (ASTERISK-23133) Possible documentation fix - MASTER_CHANNEL Unexpected Behaviour
dovid (JIRA)
noreply at issues.asterisk.org
Wed Dec 27 04:10:42 CST 2017
[ https://issues.asterisk.org/jira/browse/ASTERISK-23133?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=241149#comment-241149 ]
dovid commented on ASTERISK-23133:
----------------------------------
@ Shane Mitchell I had this exact issue and from the docs understood it the way you did. I agree such functionality would help. For now what you can is pass the channel as an arg and then use the SHARED function.
> Possible documentation fix - MASTER_CHANNEL Unexpected Behaviour
> ----------------------------------------------------------------
>
> Key: ASTERISK-23133
> URL: https://issues.asterisk.org/jira/browse/ASTERISK-23133
> Project: Asterisk
> Issue Type: Bug
> Security Level: None
> Components: Functions/General
> Affects Versions: 1.8.25.0, 11.7.0, 13.18.4
> Environment: n/a
> Reporter: Shane Mitchell
> Severity: Minor
>
> MASTER_CHANNEL() should behave, as per documentation: Allows access to the channel which created the current channel, if any. If the channel is already a master channel, then accesses local channel variables.
> MASTER_CHANNEL() actually accesses the local variables of the initial/first channel and not the parent channel. Hence, either the behaviour of MASTER_CHANNEL is incorrect or the documentation is incorrect.
> This behaviour is experienced every way you can spawn a channel, including but not limited to local channels, the U option in Dial, etc.
> {noformat}
> [channel1]
> exten => s,1,Set(CHANLEVEL=1)
> same => n,NoOp(${CHANLEVEL}) ; OUTPUT IS: 1
> same => n,NoOp(${MASTER_CHANNEL(CHANLEVEL)}) ; OUTPUT IS: 1 (OK)
> same => n,Dial(Local/s at channel2)
> [channel2]
> exten => s,1,Set(CHANLEVEL=2)
> same => n,NoOp(${CHANLEVEL}) ; OUTPUT IS: 2
> same => n,NoOp(${MASTER_CHANNEL(CHANLEVEL)}) ; OUTPUT IS: 1 (OK)
> same => n,Dial(Local/s at channel3)
> [channel3]
> exten => s,1,Set(CHANLEVEL=3)
> same => n,NoOp(${CHANLEVEL}) ; OUTPUT IS: 3
> same => n,NoOp(${MASTER_CHANNEL(CHANLEVEL)}) ; OUTPUT IS: 1 (UNEXPECTED)
> {noformat}
> I would posit from the naming of the MASTER_CHANNEL function that its behaviour is correct and the documentation is incorrect.
> However, it is important to be able to access the 'channel which created the current channel' as well - and this functionality is missing.
> Deviating from the Asterisk issue guidelines slightly, in addition to correcting the documentation, it would be of huge value to have a function similarly named to PARENT_CHANNEL() which behaves as per the documentation pasted above (accessing the channel which created the current channel / the parent channel).
--
This message was sent by Atlassian JIRA
(v6.2#6252)
More information about the asterisk-bugs
mailing list