[Home]

Summary:ASTERISK-13386: [patch] Global variables only allow values less than 255 characters
Reporter:markd (markd)Labels:
Date Opened:2009-01-16 18:02:57.000-0600Date Closed:2009-01-22 11:21:20.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20090120__bug14263.diff.txt
Description:When using a dial string larger than 255 characters, the dial string becomes automatically truncated to 255 characters.

The problem exists in the latest 1.4.22.1

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

Contra to what is documented here:

http://www.voip-info.org/wiki-Asterisk+cmd+Dial
Comments:By: Tilghman Lesher (tilghman) 2009-01-16 18:18:14.000-0600

Are you running on a platform with LOW_MEMORY defined?  If so, that would be a prime reason why the arguments are restricted to 255 characters.

By: tomsullivan (tomsullivan) 2009-01-19 18:27:49.000-0600

On version 1.4.23-rc4, the following compiler flags are set:

DONT_OPTIMIZE
DEBUG_CHANNEL_LOCKS
DEBUG_THREADS
MALLOC_DEBUG
LOADABLE_MODULES

This behaviour still occurs, and not only for the Dial app. NoOp also shows the truncated string, which seems to indicate a problem with the variable expansion / evaluation.

By: James Golovich (jamesgolovich) 2009-01-19 19:41:04.000-0600

I can't reproduce this on 1.4 or 1.6 with Dial, NoOp, or any other application.  Can you provide the extensions.conf entry and the console output?

By: tomsullivan (tomsullivan) 2009-01-19 19:59:16.000-0600

Below are the entries from extensions.conf:

exten => _[s*0-9]!,n,NoOp(${HGRP_${EXTEN}_CHANS})
exten => _[s*0-9]!,n,Dial(${HGRP_${EXTEN}_CHANS}&LOCAL/s@ivr-wait|${HGRP_${EXTEN}_TIMEOUT}|${HGRP_${EXTEN}_OPTS})

which are operating from the following variable:

HGRP_900_CHANS=LOCAL/203@dial-sip-huntgroup/n&LOCAL/678@dial-sip-huntgroup/n&LOCAL/100@dial-sip-huntgroup/n&LOCAL/55446@dial-sip-huntgroup/n&LOCAL/201@dial-sip-huntgroup/n&LOCAL/0299999999@match-all/n&LOCAL/0419999999@match-all/n&LOCAL/0899999994@match-all/n&LOCAL/0899999993@match-all/n&LOCAL/0899999999@match-all/n&LOCAL/0899999991@match-all/n

and result in the following console output:

   -- Executing [900@dial-huntgroup:3] NoOp("SIP/55446-0081aa00", "LOCAL/203@dial-sip-huntgroup/n&LOCAL/678@dial-sip-huntgroup/n&LOCAL/100@dial-sip-huntgroup/n&LOCAL/55446@dial-sip-huntgroup/n&LOCAL/201@dial-sip-huntgroup/n&LOCAL/0299999999@match-all/n&LOCAL/0419999999@match-all/n&LOCAL/0899999994@match-all/n&LOCAL/08999") in new stack
   -- Executing [900@dial-huntgroup:4] Dial("SIP/55446-0081aa00", "LOCAL/203@dial-sip-huntgroup/n&LOCAL/678@dial-sip-huntgroup/n&LOCAL/100@dial-sip-huntgroup/n&LOCAL/55446@dial-sip-huntgroup/n&LOCAL/201@dial-sip-huntgroup/n&LOCAL/0299999999@match-all/n&LOCAL/0419999999@match-all/n&LOCAL/0899999994@match-all/n&LOCAL/08999&LOCAL/s@ivr-wait|5|ir") in new stack

As shown, NoOp shows only the first 256 characters of the variable, whereas Dial is able to concatenate the additional destination (&LOCAL/s@ivr-wait) and dial the result. I would suspect that this indicates the variable expansion / evaluation is limiting the result.

By: James Golovich (jamesgolovich) 2009-01-19 23:53:41.000-0600

Now we're getting somewhere, the value is limited because its a global variable.  The problem here is in pbx.c:pbx_load_config: char realvalue[256]

We can increase the length to some larger value or switch to ast_str or a ptr.  It looks like only globals, include contexts, ignore pat, and switches are affected by this.

I'll wait till the morning to talk to Tilghman or Russell to see what they would want to do, but it is pretty trivial to resolve this issue.

By: Tilghman Lesher (tilghman) 2009-01-20 16:53:04.000-0600

After discussing this with James, I'm going to make the value the same length as in other substitutions, 8192, but only for systems which don't have LOW_MEMORY defined (same condition as the main substitution loop in main/pbx.c).

By: Digium Subversion (svnbot) 2009-01-22 11:17:46.000-0600

Repository: asterisk
Revision: 170158

U   branches/1.4/pbx/pbx_config.c

------------------------------------------------------------------------
r170158 | tilghman | 2009-01-22 11:17:46 -0600 (Thu, 22 Jan 2009) | 6 lines

Allow global variables after substitution to be as long as other variables.
(closes issue ASTERISK-13386)
Reported by: markd
Patches:
      20090120__bug14263.diff.txt uploaded by Corydon76 (license 14)

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

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

By: Digium Subversion (svnbot) 2009-01-22 11:19:09.000-0600

Repository: asterisk
Revision: 170165

_U  trunk/
U   trunk/pbx/pbx_config.c

------------------------------------------------------------------------
r170165 | tilghman | 2009-01-22 11:19:09 -0600 (Thu, 22 Jan 2009) | 13 lines

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

........
 r170158 | tilghman | 2009-01-22 11:18:07 -0600 (Thu, 22 Jan 2009) | 6 lines
 
 Allow global variables after substitution to be as long as other variables.
 (closes issue ASTERISK-13386)
  Reported by: markd
  Patches:
        20090120__bug14263.diff.txt uploaded by Corydon76 (license 14)
........

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

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

By: Digium Subversion (svnbot) 2009-01-22 11:20:26.000-0600

Repository: asterisk
Revision: 170172

_U  branches/1.6.0/
U   branches/1.6.0/pbx/pbx_config.c

------------------------------------------------------------------------
r170172 | tilghman | 2009-01-22 11:20:26 -0600 (Thu, 22 Jan 2009) | 20 lines

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

................
 r170165 | tilghman | 2009-01-22 11:19:28 -0600 (Thu, 22 Jan 2009) | 13 lines
 
 Merged revisions 170158 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r170158 | tilghman | 2009-01-22 11:18:07 -0600 (Thu, 22 Jan 2009) | 6 lines
   
   Allow global variables after substitution to be as long as other variables.
   (closes issue ASTERISK-13386)
    Reported by: markd
    Patches:
          20090120__bug14263.diff.txt uploaded by Corydon76 (license 14)
 ........
................

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

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

By: Digium Subversion (svnbot) 2009-01-22 11:21:20.000-0600

Repository: asterisk
Revision: 170178

_U  branches/1.6.1/
U   branches/1.6.1/pbx/pbx_config.c

------------------------------------------------------------------------
r170178 | tilghman | 2009-01-22 11:21:19 -0600 (Thu, 22 Jan 2009) | 20 lines

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

................
 r170165 | tilghman | 2009-01-22 11:19:28 -0600 (Thu, 22 Jan 2009) | 13 lines
 
 Merged revisions 170158 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r170158 | tilghman | 2009-01-22 11:18:07 -0600 (Thu, 22 Jan 2009) | 6 lines
   
   Allow global variables after substitution to be as long as other variables.
   (closes issue ASTERISK-13386)
    Reported by: markd
    Patches:
          20090120__bug14263.diff.txt uploaded by Corydon76 (license 14)
 ........
................

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

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