[asterisk-bugs] [Asterisk 0014011]: [patch] Incorrect jump to extension

Asterisk Bug Tracker noreply at bugs.digium.com
Wed Jan 14 19:04:49 CST 2009


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=14011 
====================================================================== 
Reported By:                dveiga
Assigned To:                file
====================================================================== 
Project:                    Asterisk
Issue ID:                   14011
Category:                   Applications/General
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     needs license
Asterisk Version:           1.6.1-beta3 
Regression:                 No 
SVN Branch (only for SVN checkouts, not tarball releases):  trunk 
SVN Revision (number only!): 160441 
Request Review:              
====================================================================== 
Date Submitted:             2008-12-02 20:46 CST
Last Modified:              2009-01-14 19:04 CST
====================================================================== 
Summary:                    [patch] Incorrect jump to extension
Description: 
When calling Background() application, function pbx_builtin_background() is
called. Inside it, I believe there's a bug when comparing the channel
context with the one used as a parameter. Where it says "if (args.context
!= chan->context && res)" it should say "if ( strcmp(args.context,
chan->context) && res)".
I just explained it because in this simple case I think its easier than
sending a patch, but I can send the patch file if it helps.
====================================================================== 

---------------------------------------------------------------------- 
 (0097855) dveiga (reporter) - 2009-01-14 19:04
 http://bugs.digium.com/view.php?id=14011#c97855 
---------------------------------------------------------------------- 
Ok, I understand that if NO context is passed, the comparison will be true.
The problem arrises when we do specify the context and it is the same as
the current context. I suppose your next question is obvious "Why are you
specifying the context if it is the same as the current one?" Well someone
changed the behavior of the Background() function some time ago. Before the
change, the extensions checked when the user dialed in some numbers where
ALWAYS in the current context. After that change, if the current context
was reached using a GoSub command, the extensions checked by default are
not in the current context but in the context the GoSub command was
executed. For example

[from-internal]
exten => s,1,GoSub(get-number,s,1)
....

[get-number]
exten => s,1,Set(GetNumberResult=0)
exten => s,n,Background(some-sound-file)
exten => s,n,Return()
exten => _X,1,Set(GetNumberResult=${EXTEN})
exten => _X,n,Return()

With the new behavior when the user presses a digit, it WILL NOT junp to
the _X extension because it will search the 'from-internal' context. To
make it work, you should replace the background like with this one:

exten => s,n,Background(some-sound-file,,,get-number)

There is a special comment about this change in the description of the
Background commnd at http://www.voip-info.org/wiki-Asterisk+cmd+Background.
Please check the 'Background() inside a macro' section.

This is why I had to specify the context even if its equal to the current
one, and I can´t make it work without the 'strcmp'. Note that the proposed
patch works in both situations (no context specified and same context
specified).

Thanks for your patience ...


                             Daniel 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2009-01-14 19:04 dveiga         Note Added: 0097855                          
======================================================================




More information about the asterisk-bugs mailing list