[Home]

Summary:ASTERISK-20182: Parsing a label beginning with a numeric character in all Goto/GotoIf/GotoIfTime application causes unexpected behavior
Reporter:Janu (janu1535)Labels:
Date Opened:2012-07-30 08:37:36Date Closed:2019-04-12 14:17:50
Priority:MajorRegression?
Status:Closed/CompleteComponents:PBX/General
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 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Debian 6.0 latest version Debian 5.0 latest versionAttachments:
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@test:1] NoOp("SIP/59-0001426c", "Dialed 6358") in new stack
-- Executing [6358@test:2] GotoIf("SIP/59-0001426c", "1?4secs") in new stack
-- Goto (test,6358,4)
-- Executing [6358@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!
Comments:By: Rusty Newton (rnewton) 2012-08-01 09:41:20.676-0500

This is funky behavior - passing into our internal development queue as well.  Thanks for the detail in your report Janu.

By: Friendly Automation (friendly-automation) 2019-04-12 14:17:51.414-0500

Change 11264 merged by George Joseph:
pbx.c: Properly parse labels with leading digits

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

By: Friendly Automation (friendly-automation) 2019-04-12 14:17:56.562-0500

Change 11265 merged by George Joseph:
pbx.c: Properly parse labels with leading digits

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

By: Friendly Automation (friendly-automation) 2019-04-12 14:18:00.766-0500

Change 11266 merged by George Joseph:
pbx.c: Properly parse labels with leading digits

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