[asterisk-bugs] [JIRA] (ASTERISK-20182) Parsing a label beginning with a numeric character in all Goto/GotoIf/GotoIfTime application causes unexpected behavior

Sean Bright (JIRA) noreply at issues.asterisk.org
Thu Apr 11 12:45:48 CDT 2019


     [ https://issues.asterisk.org/jira/browse/ASTERISK-20182?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sean Bright updated ASTERISK-20182:
-----------------------------------

    Description: 
Hello everyone,

While programming some parts of my asterisk dialplan, I've noticed thant in some cases, all GoTo aplications fail jumping into certain labels.

When I set a label starting with a number (like "4secs"), The GoTo statement jumps to priority number 4 instead of jumping into priority "4secs".

He're you have the dialplan explained above:

{noformat}
[test]
exten => _63XX,1,NoOP(Dialed ${EXTEN})
exten => _63XX,n,GotoIf($["${EXTEN}"= "6358"]?4secs)
exten => _63XX,n,Wait(1)
exten => _63XX,n,Dial(SIP/${EXTEN:2},10)
exten => _63XX,n(4secs),Dial(SIP/58,4)
exten => _63XX,n,Hangup
{noformat}

And the execution tests:

{noformat}
-- Executing [6358 at test:1] NoOp("SIP/59-0001426c", "Dialed 6358") in new stack
-- Executing [6358 at test:2] GotoIf("SIP/59-0001426c", "1?4secs") in new stack
-- Goto (test,6358,4)
-- Executing [6358 at test:4] Dial("SIP/59-0001426c", "SIP/58|10") in new stack
-- Called 58
-- SIP/58-0001426d is ringing
== Spawn extension (test, 6358, 4) exited non-zero on 'SIP/59-0001426c'
{noformat}

After some research, I found the problem in the code files:

FILE:
main/pbx.c

FUNCTION:
static int pbx_parseable_goto(struct ast_channel *chan, const char *goto_string, int async)

LINE:
if (sscanf(pri, "%30d", &ipri) != 1) {   

In this Statement, if we have som digits at the start of a label. The return of sscanf is equal to 1, and We fail for labels like (4secs)

Thanks for your support!

  was:
Hello everyone,

While programming some parts of my asterisk dialplan, I've noticed thant in some cases, all GoTo aplications fail jumping into certain labels.

When I set a label starting with a number (like "4secs"), The GoTo statement jumps to priority number 4 instead of jumping into priority "4secs".

He're you have the dialplan explained above:

[test]
exten => _63XX,1,NoOP(Dialed ${EXTEN})
exten => _63XX,n,GotoIf($["${EXTEN}"= "6358"]?4secs)
exten => _63XX,n,Wait(1)
exten => _63XX,n,Dial(SIP/${EXTEN:2},10)
exten => _63XX,n(4secs),Dial(SIP/58,4)
exten => _63XX,n,Hangup

And the execution tests:

-- Executing [6358 at test:1] NoOp("SIP/59-0001426c", "Dialed 6358") in new stack
-- Executing [6358 at test:2] GotoIf("SIP/59-0001426c", "1?4secs") in new stack
-- Goto (test,6358,4)
-- Executing [6358 at test:4] Dial("SIP/59-0001426c", "SIP/58|10") in new stack
-- Called 58
-- SIP/58-0001426d is ringing
== Spawn extension (test, 6358, 4) exited non-zero on 'SIP/59-0001426c'

After some research, I found the problem in the code files:

FILE:
main/pbx.c

FUNCTION:
static int pbx_parseable_goto(struct ast_channel *chan, const char *goto_string, int async)

LINE:
if (sscanf(pri, "%30d", &ipri) != 1) {   

In this Statement, if we have som digits at the start of a label. The return of sscanf is equal to 1, and We fail for labels like (4secs)

Thanks for your support!


> Parsing a label beginning with a numeric character in all Goto/GotoIf/GotoIfTime application causes unexpected behavior
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: ASTERISK-20182
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-20182
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: PBX/General
>    Affects Versions: 1.8.8.2, 1.8.9.3, 1.8.10.1, 1.8.11.1, 1.8.12.0, 1.8.12.1, 1.8.12.2, 1.8.13.0, 1.8.13.1, 1.8.14.0, 1.8.14.1, 13.18.4
>         Environment: Debian 6.0 latest version
> Debian 5.0 latest version
>            Reporter: Janu
>
> Hello everyone,
> While programming some parts of my asterisk dialplan, I've noticed thant in some cases, all GoTo aplications fail jumping into certain labels.
> When I set a label starting with a number (like "4secs"), The GoTo statement jumps to priority number 4 instead of jumping into priority "4secs".
> He're you have the dialplan explained above:
> {noformat}
> [test]
> exten => _63XX,1,NoOP(Dialed ${EXTEN})
> exten => _63XX,n,GotoIf($["${EXTEN}"= "6358"]?4secs)
> exten => _63XX,n,Wait(1)
> exten => _63XX,n,Dial(SIP/${EXTEN:2},10)
> exten => _63XX,n(4secs),Dial(SIP/58,4)
> exten => _63XX,n,Hangup
> {noformat}
> And the execution tests:
> {noformat}
> -- Executing [6358 at test:1] NoOp("SIP/59-0001426c", "Dialed 6358") in new stack
> -- Executing [6358 at test:2] GotoIf("SIP/59-0001426c", "1?4secs") in new stack
> -- Goto (test,6358,4)
> -- Executing [6358 at test:4] Dial("SIP/59-0001426c", "SIP/58|10") in new stack
> -- Called 58
> -- SIP/58-0001426d is ringing
> == Spawn extension (test, 6358, 4) exited non-zero on 'SIP/59-0001426c'
> {noformat}
> After some research, I found the problem in the code files:
> FILE:
> main/pbx.c
> FUNCTION:
> static int pbx_parseable_goto(struct ast_channel *chan, const char *goto_string, int async)
> LINE:
> if (sscanf(pri, "%30d", &ipri) != 1) {   
> In this Statement, if we have som digits at the start of a label. The return of sscanf is equal to 1, and We fail for labels like (4secs)
> Thanks for your support!



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list