[Home]

Summary:ASTERISK-30480: dialplan reload warning refers to wrong priorities in dialplan
Reporter:David Middleton (dave-midd)Labels:
Date Opened:2023-03-28 08:37:08Date Closed:2023-03-29 05:22:59
Priority:MinorRegression?
Status:Closed/CompleteComponents:Functions/func_dialplan
Versions:18.14.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Attachments:
Description:When reloading the dialplan, the following warning is shown:
{code}
WARNING[1613512]: pbx.c:7126 add_priority: Extension 'start' priority 21 in 'fhn-block-huntgrp-seq', label 'exit_ok' already in use at priority 17
{code}

However, the dialplan references the labels in priorities 16 and 20:
{code}
CLI> dialplan show fhn-block-huntgrp-seq
[ Context 'fhn-block-huntgrp-seq' created by 'pbx_config' ]
 'start' =>        1. Verbose(1,Starting HUNT-GROUP block sequential config:) [extensions.conf:0]
                   2. Verbose(1,Members: ${ARG1})                [extensions.conf:0]
                   3. Verbose(1,Timeout: ${ARG2})                [extensions.conf:0]
                   4. Set(MEMBERS=${ARG1})                       [extensions.conf:0]
                   5. Set(TIMEOUT=${ARG2})                       [extensions.conf:0]
                   6. Set(FIELD=1)                               [extensions.conf:0]
                   7. Set(MEMBER=${CUT(MEMBERS,\;,${FIELD})})    [extensions.conf:0]
                   8. While($[${EXISTS(${MEMBER})}])             [extensions.conf:0]
                   9. Set(INTERNAL=${REGEX("^(.*)-(.*)$" ${MEMBER})}) [extensions.conf:0]
                   10. GotoIf($["${INTERNAL}" = "0"]?member_out:member_in) [extensions.conf:0]
    [member_in]    11. GotoIf($[ $[!${EXISTS(${DEVICE_STATE(Custom:${MEMBER})})}] || $["${DEVICE_STATE(Custom:${MEMBER})}" = "UNAVAILABLE"]]?exit_nok) [extensions.conf:0]
                   12. AGI(agi://${FASTAGISERVER}/getVariable,FHN/${TENANT}/${CUT(MEMBER,-,1)}/MAXCALLS,MAXCALLS) [extensions.conf:0]
                   13. Gosub(check-call-limit,start,1(${MEMBER},${MAXCALLS},in)) [extensions.conf:0]
                   14. ExecIf($[${GOSUB_RETVAL} < 0]?exit_nok)   [extensions.conf:0]
                   15. Gosub(dial,s,1(Local/${MEMBER}@fhn-block-to-extension-call,${TIMEOUT},${OPTIONS})) [extensions.conf:0]
                   16. GotoIf($["${DIALSTATUS}" != "ANSWER"]?exit_nok:exit_ok) [extensions.conf:0]
    [exit_ok]      17. Set(RESULT=-1)                            [extensions.conf:0]
                   18. ExitWhile()                               [extensions.conf:0]
    [member_out]   19. Gosub(dial,s,1(Local/${MEMBER}@fhn-dialout,${TIMEOUT},${OPTIONS})) [extensions.conf:0]
                   20. GotoIf($["${DIALSTATUS}" != "ANSWER"]?exit_nok:exit_ok) [extensions.conf:0]
                   21. Set(RESULT=-1)                            [extensions.conf:0]
                   22. ExitWhile()                               [extensions.conf:0]
    [exit_nok]     23. Set(RESULT=1)                             [extensions.conf:0]
                   24. Set(FIELD=$[${FIELD} + 1])                [extensions.conf:0]
                   25. Set(MEMBER=${CUT(MEMBERS,\;,${FIELD})})   [extensions.conf:0]
                   26. EndWhile()                                [extensions.conf:0]
                   27. Return(${RESULT})                         [extensions.conf:0]

-= 1 extension (27 priorities) in 1 context. =-
{code}
Comments:By: Asterisk Team (asteriskteam) 2023-03-28 08:37:10.988-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. Please note that log messages and other files should not be sent to the Sangoma Asterisk Team unless explicitly asked for. All files should be placed on this issue in a sanitized fashion as needed.

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.

Please note that by submitting data, code, or documentation to Sangoma through JIRA, you accept the Terms of Use present at [https://www.asterisk.org/terms-of-use/|https://www.asterisk.org/terms-of-use/].

By: Joshua C. Colp (jcolp) 2023-03-28 08:45:54.164-0500

The output of "dialplan show" is after the dialplan has been processed, interpreted, and put into memory. What is the actual underlying dialplan file that causes this?

By: David Middleton (dave-midd) 2023-03-28 08:51:22.872-0500

This is the context:
{code}
[fhn-block-huntgrp-seq]

exten => start,1,Verbose(1,Starting HUNT-GROUP block sequential config:)
 same => n,Verbose(1,Members: ${ARG1})
 same => n,Verbose(1,Timeout: ${ARG2})
 same => n,Set(MEMBERS=${ARG1})
 same => n,Set(TIMEOUT=${ARG2})
 same => n,Set(FIELD=1)
 same => n,Set(MEMBER=${CUT(MEMBERS,\;,${FIELD})})

 same => n,While($[${EXISTS(${MEMBER})}])

 ;; Check if internal or outbound
 same => n,Set(INTERNAL=${REGEX("^(.*)-(.*)$" ${MEMBER})})
 same => n,GotoIf($["${INTERNAL}" = "0"]?member_out:member_in)

 ; INTERNAL
 same => n(member_in),GotoIf($[ $[!${EXISTS(${DEVICE_STATE(Custom:${MEMBER})})}] || $["${DEVICE_STATE(Custom:${MEMBER})}" = "UNAVAILABLE"]]?exit_nok)
 ;; Check max numbers of the member of the huntgroup
 same => n,AGI(agi://${FASTAGISERVER}/getVariable,FHN/${TENANT}/${CUT(MEMBER,-,1)}/MAXCALLS,MAXCALLS)
 same => n,Gosub(check-call-limit,start,1(${MEMBER},${MAXCALLS},in))
 same => n,ExecIf($[${GOSUB_RETVAL} < 0]?exit_nok)
 same => n,Gosub(dial,s,1(Local/${MEMBER}@fhn-block-to-extension-call,${TIMEOUT},${OPTIONS}))
 same => n,GotoIf($["${DIALSTATUS}" != "ANSWER"]?exit_nok:exit_ok)
 same => n(exit_ok),Set(RESULT=-1)
 same => n,ExitWhile()

 ;; OUTBOUND
 same => n(member_out),Gosub(dial,s,1(Local/${MEMBER}@fhn-dialout,${TIMEOUT},${OPTIONS}))
 same => n,GotoIf($["${DIALSTATUS}" != "ANSWER"]?exit_nok:exit_ok)
 same => n(exit_ok),Set(RESULT=-1)
 same => n,ExitWhile()

 same => n(exit_nok),Set(RESULT=1)
 same => n,Set(FIELD=$[${FIELD} + 1])
 same => n,Set(MEMBER=${CUT(MEMBERS,\;,${FIELD})})

 same => n,EndWhile()

 same => n,Return(${RESULT})
{code}

By: Michael Bradeen (mbradeen) 2023-03-28 16:19:42.185-0500

The duplicate 'exit_ok' labels are on 17 and 21, the goto references in 16 and 20 are not the source of the warning.

By: David Middleton (dave-midd) 2023-03-29 05:09:43.078-0500

Thanks Michael.
Maybe I can't count, but I see an exit_ok label on 17 (and an exit_nok label on 23).
Then there's the goto references (to these labels) on 16 and 20.

So I don't follow the first part of the warning: Extension 'start' priority 21 in 'fhn-block-huntgrp-seq....'
when 21 is 'Set(RESULT=-1)',

I get the second part of the warning: ...label 'exit_ok' already in use at priority 17
as 17 does have that label.

Maybe I'm misunderstanding the warning? (Also not sure why the warning is only about the label 'exit_ok' and not also about 'exit_nok'?)

By: Joshua C. Colp (jcolp) 2023-03-29 05:14:19.169-0500

The second one is in this block:

{noformat}
;; OUTBOUND
 same => n(member_out),Gosub(dial,s,1(Local/${MEMBER}@fhn-dialout,${TIMEOUT},${OPTIONS}))
 same => n,GotoIf($["${DIALSTATUS}" != "ANSWER"]?exit_nok:exit_ok)
 same => n(exit_ok),Set(RESULT=-1)
 same => n,ExitWhile()
{noformat}

The label is here:

{noformat}
 same => n(exit_ok),Set(RESULT=-1)
{noformat}

There is only a single exit_nok in the given dialplan.

You MUST look at the actual dialplan and not the output of "dialplan show". If errors/issues are encountered then "dialplan show" will NOT reflect the actual source dialplan.

By: David Middleton (dave-midd) 2023-03-29 05:21:41.998-0500

Gah, you're right, of course and you even said before to look at the actual dialplan file!
It's clear to see the duplicate now.
Thanks for the advice and apologies for the time waste.
I'll close this one down.
Cheers.