[Home]

Summary:ASTERISK-15306: [patch] Background() when called from AGI script no longer gives digit code when interrupted
Reporter:Richard Wilkinson (rickead2000)Labels:
Date Opened:2009-12-12 12:41:16.000-0600Date Closed:2010-01-05 09:04:21.000-0600
Priority:MajorRegression?Yes
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20091217__issue16434.diff.txt
( 1) 20091222__issue16434__1.6.1.diff.txt
Description:When calling the Background application from within an AGI script, asterisk no longer returns the character value of a digit pressed while the audio file is still being played.

This means if a user does not wait for the audio file to finish before pressing a digit, it's impossible to find out what was pressed.

****** ADDITIONAL INFORMATION ******

Behaviour in asterisk 1.6.1.1.  The '9' key is pressed during playback of "agent-user"

<SIP/test-112-b7c9de80> Playing 'agent-user.slin' (language 'en')
<SIP/test-112-b7c9de80>AGI Tx >> 200 result=57

Behaviour in asterisk 1.6.1.10.  9 key is pressed at exactly the same time as above

<SIP/test-112-00000000> Playing 'agent-user.slin' (language 'en')
<SIP/test-112-00000000>AGI Tx >> 200 result=0

The result is now always 0 instead of the character value.

Command being run from the AGI script is:-

EXEC Background agent-user
Comments:By: Russell Bryant (russell) 2009-12-14 15:19:51.000-0600

I have narrowed this down to a change that went into 1.6.1.5.  As of 1.6.1.5, the only time the proper result is provided is when the digit matches the first digit of a valid extension.  If it is not the first digit of a valid extension, the result of 0 will be returned.

By: Tilghman Lesher (tilghman) 2009-12-14 15:32:17.000-0600

One wonders why you aren't using the builtin AGI command "GET DATA" for this operation.

By: Russell Bryant (russell) 2009-12-15 04:00:54.000-0600

That may be a potential workaround, but obviously EXEC Background should work, too.

By: Tilghman Lesher (tilghman) 2009-12-15 09:08:33.000-0600

The issue isn't whether the command works; it does.  The issue is the undocumented return code.

By: Tilghman Lesher (tilghman) 2009-12-17 12:24:16.000-0600

I have a potential patch.  Note that you'll need to upgrade to the latest SVN to apply it, as it depends upon a patch that just went in today.

By: Richard Wilkinson (rickead2000) 2009-12-17 13:51:26.000-0600

I'll get that patch tested first thing tomorrow when I have access to a testing box.

By: Richard Wilkinson (rickead2000) 2009-12-22 06:03:14.000-0600

I'm having a few issues getting the patch to apply to the latest SVN.

patching file include/asterisk/channel.h
Hunk #1 FAILED at 517.
1 out of 1 hunk FAILED -- saving rejects to file include/asterisk/channel.h.rej
patching file main/pbx.c
Hunk #1 succeeded at 9193 (offset 3417 lines).
patching file res/res_agi.c
Hunk #1 FAILED at 1125.
Hunk #2 FAILED at 1140.
2 out of 2 hunks FAILED -- saving rejects to file res/res_agi.c.rej

A subsequent make then fails.

By: Tilghman Lesher (tilghman) 2009-12-22 09:15:45.000-0600

Are you applying to SVN trunk or SVN 1.6.1?  The patch is modeled for SVN 1.6.1.

By: Tilghman Lesher (tilghman) 2009-12-22 13:11:49.000-0600

Oops, sorry!  That patch was modeled on 1.4.  I have just uploaded a new patch modeled for 1.6.1.

By: Tilghman Lesher (tilghman) 2009-12-29 17:12:51.000-0600

rickead2000:  Have you been able to test the most recent patch?

By: Richard Wilkinson (rickead2000) 2010-01-03 12:47:44.000-0600

Been away over Xmas - sorry for delay in testing!

I can confirm that patch fixes my issue on SVN 1.6.1

By: Digium Subversion (svnbot) 2010-01-04 12:19:03.000-0600

Repository: asterisk
Revision: 237405

U   branches/1.4/include/asterisk/channel.h
U   branches/1.4/main/pbx.c
U   branches/1.4/res/res_agi.c

------------------------------------------------------------------------
r237405 | tilghman | 2010-01-04 12:19:00 -0600 (Mon, 04 Jan 2010) | 16 lines

Add a flag to disable the Background behavior, for AGI users.
This is in a section of code that relates to two other issues, namely
issue ASTERISK-13159 and issue ASTERISK-13929), one of which was the behavior of
Background when called with a context argument that matched the current
context.  This fix broke FreePBX, however, in a post-Dial situation.
Needless to say, this is an extremely difficult collision of several
different issues.  While the use of an exception flag is ugly, fixing all
of the issues linked is rather difficult (although if someone would like
to propose a better solution, we're happy to entertain that suggestion).
(closes issue ASTERISK-15306)
Reported by: rickead2000
Patches:
      20091217__issue16434.diff.txt uploaded by tilghman (license 14)
      20091222__issue16434__1.6.1.diff.txt uploaded by tilghman (license 14)
Tested by: rickead2000

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=237405

By: Digium Subversion (svnbot) 2010-01-04 12:28:31.000-0600

Repository: asterisk
Revision: 237406

_U  trunk/
U   trunk/include/asterisk/channel.h
U   trunk/main/pbx.c
U   trunk/res/res_agi.c

------------------------------------------------------------------------
r237406 | tilghman | 2010-01-04 12:28:29 -0600 (Mon, 04 Jan 2010) | 23 lines

Merged revisions 237405 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
 r237405 | tilghman | 2010-01-04 12:19:00 -0600 (Mon, 04 Jan 2010) | 16 lines
 
 Add a flag to disable the Background behavior, for AGI users.
 This is in a section of code that relates to two other issues, namely
 issue ASTERISK-13159 and issue ASTERISK-13929), one of which was the behavior of
 Background when called with a context argument that matched the current
 context.  This fix broke FreePBX, however, in a post-Dial situation.
 Needless to say, this is an extremely difficult collision of several
 different issues.  While the use of an exception flag is ugly, fixing all
 of the issues linked is rather difficult (although if someone would like
 to propose a better solution, we're happy to entertain that suggestion).
 (closes issue ASTERISK-15306)
  Reported by: rickead2000
  Patches:
        20091217__issue16434.diff.txt uploaded by tilghman (license 14)
        20091222__issue16434__1.6.1.diff.txt uploaded by tilghman (license 14)
  Tested by: rickead2000
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=237406

By: Digium Subversion (svnbot) 2010-01-04 12:30:38.000-0600

Repository: asterisk
Revision: 237407

_U  branches/1.6.0/
U   branches/1.6.0/include/asterisk/channel.h
U   branches/1.6.0/main/pbx.c
U   branches/1.6.0/res/res_agi.c

------------------------------------------------------------------------
r237407 | tilghman | 2010-01-04 12:30:36 -0600 (Mon, 04 Jan 2010) | 30 lines

Merged revisions 237406 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
 r237406 | tilghman | 2010-01-04 12:28:28 -0600 (Mon, 04 Jan 2010) | 23 lines
 
 Merged revisions 237405 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r237405 | tilghman | 2010-01-04 12:19:00 -0600 (Mon, 04 Jan 2010) | 16 lines
   
   Add a flag to disable the Background behavior, for AGI users.
   This is in a section of code that relates to two other issues, namely
   issue ASTERISK-13159 and issue ASTERISK-13929), one of which was the behavior of
   Background when called with a context argument that matched the current
   context.  This fix broke FreePBX, however, in a post-Dial situation.
   Needless to say, this is an extremely difficult collision of several
   different issues.  While the use of an exception flag is ugly, fixing all
   of the issues linked is rather difficult (although if someone would like
   to propose a better solution, we're happy to entertain that suggestion).
   (closes issue ASTERISK-15306)
    Reported by: rickead2000
    Patches:
          20091217__issue16434.diff.txt uploaded by tilghman (license 14)
          20091222__issue16434__1.6.1.diff.txt uploaded by tilghman (license 14)
    Tested by: rickead2000
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=237407

By: Digium Subversion (svnbot) 2010-01-04 12:30:46.000-0600

Repository: asterisk
Revision: 237408

_U  branches/1.6.1/
U   branches/1.6.1/include/asterisk/channel.h
U   branches/1.6.1/main/pbx.c
U   branches/1.6.1/res/res_agi.c

------------------------------------------------------------------------
r237408 | tilghman | 2010-01-04 12:30:44 -0600 (Mon, 04 Jan 2010) | 30 lines

Merged revisions 237406 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
 r237406 | tilghman | 2010-01-04 12:28:28 -0600 (Mon, 04 Jan 2010) | 23 lines
 
 Merged revisions 237405 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r237405 | tilghman | 2010-01-04 12:19:00 -0600 (Mon, 04 Jan 2010) | 16 lines
   
   Add a flag to disable the Background behavior, for AGI users.
   This is in a section of code that relates to two other issues, namely
   issue ASTERISK-13159 and issue ASTERISK-13929), one of which was the behavior of
   Background when called with a context argument that matched the current
   context.  This fix broke FreePBX, however, in a post-Dial situation.
   Needless to say, this is an extremely difficult collision of several
   different issues.  While the use of an exception flag is ugly, fixing all
   of the issues linked is rather difficult (although if someone would like
   to propose a better solution, we're happy to entertain that suggestion).
   (closes issue ASTERISK-15306)
    Reported by: rickead2000
    Patches:
          20091217__issue16434.diff.txt uploaded by tilghman (license 14)
          20091222__issue16434__1.6.1.diff.txt uploaded by tilghman (license 14)
    Tested by: rickead2000
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=237408

By: Digium Subversion (svnbot) 2010-01-04 12:30:55.000-0600

Repository: asterisk
Revision: 237409

_U  branches/1.6.2/
U   branches/1.6.2/include/asterisk/channel.h
U   branches/1.6.2/main/pbx.c
U   branches/1.6.2/res/res_agi.c

------------------------------------------------------------------------
r237409 | tilghman | 2010-01-04 12:30:53 -0600 (Mon, 04 Jan 2010) | 30 lines

Merged revisions 237406 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
 r237406 | tilghman | 2010-01-04 12:28:28 -0600 (Mon, 04 Jan 2010) | 23 lines
 
 Merged revisions 237405 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r237405 | tilghman | 2010-01-04 12:19:00 -0600 (Mon, 04 Jan 2010) | 16 lines
   
   Add a flag to disable the Background behavior, for AGI users.
   This is in a section of code that relates to two other issues, namely
   issue ASTERISK-13159 and issue ASTERISK-13929), one of which was the behavior of
   Background when called with a context argument that matched the current
   context.  This fix broke FreePBX, however, in a post-Dial situation.
   Needless to say, this is an extremely difficult collision of several
   different issues.  While the use of an exception flag is ugly, fixing all
   of the issues linked is rather difficult (although if someone would like
   to propose a better solution, we're happy to entertain that suggestion).
   (closes issue ASTERISK-15306)
    Reported by: rickead2000
    Patches:
          20091217__issue16434.diff.txt uploaded by tilghman (license 14)
          20091222__issue16434__1.6.1.diff.txt uploaded by tilghman (license 14)
    Tested by: rickead2000
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=237409