[Home]

Summary:ASTERISK-05589: Passing variables using originate command in Asterisk Manager Interface causes seg fault
Reporter:nords (nords)Labels:
Date Opened:2005-11-13 22:55:07.000-0600Date Closed:2011-06-07 14:00:52
Priority:CriticalRegression?No
Status:Closed/CompleteComponents:Core/ManagerInterface
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) manager.patch
Description:If you pass a variable when using the originate command Asterisk will dump core.

I have been following CVS HEAD for a while now and this started happening around 11/08/05.  This is the last version I have working (using a date range):

Asterisk CVS-D2005.11.07.16.27.51-11/08/05-22:34:15

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

when doing a backtrace:

(gdb) bt
#0  0x080a8e7c in astman_get_variables (m=0x0) at manager.c:328


I can reproduce it.  If I use the originate without any variables it works great, but with variables it will always core dump.

I am using IAX for my outgoing calls.

Comments:By: nords (nords) 2005-11-14 00:57:49.000-0600

This is the command I am using to originate:

Action: Originate
Channel: Local/91XXXXXXXX@outbound/n
Context: internal
Exten: 8888
Async:
Priority: 1
Variable: var=123
Variable: var2=1245.23435232135.124.697.
ActionID: 1081


I tried it in some different orders and removing the async flag, but it still doesn't work.

By: BJ Weschke (bweschke) 2005-11-14 07:12:49.000-0600

please upgrade to rc2 and see if the problem is still happening. there have been numerous bug fixes since 11/8's version.

By: nords (nords) 2005-11-14 08:51:36.000-0600

It still happens on RC2.  I noticed that global variables were added to the manager interface on the 7th, which is interesting since the last CVS day to work is the 7th.

By: BJ Weschke (bweschke) 2005-11-14 08:56:32.000-0600

ok. will check this one out a little later today in the booth @ IP4IT if I can.

By: Dmitry (dortik) 2005-11-14 09:07:34.000-0600

I've replaced "astman_get_variables" function by the version from beta1 and now it works fine:

---------
//version from beta1
struct ast_variable *astman_get_variables(struct message *m)
{
int varlen, x;
struct ast_variable *head = NULL, *cur;
char *var, *val;

varlen = strlen("Variable: ");

for (x = 0; x < m->hdrcount; x++) {
if (!strncasecmp("Variable: ", m->headers[x], varlen)) {
var = val = ast_strdupa(m->headers[x] + varlen);
if (!var)
return head;
strsep(&val, "=");
if (!val || ast_strlen_zero(var))
continue;
cur = ast_variable_new(var, val);
if (head) {
cur->next = head;
head = cur;
} else
head = cur;
}
}

return head;
}
---------

The problem is somewhere in the function "ast_app_separate_args"

By: BJ Weschke (bweschke) 2005-11-14 09:31:57.000-0600

try this patch. let me know if it fixes the segfault condition.

By: BJ Weschke (bweschke) 2005-11-14 09:38:02.000-0600

still segfaulting here with that patch. hmmmmm.. back to the drawing board. :(

By: BJ Weschke (bweschke) 2005-11-14 09:38:40.000-0600

segfault reproduced with rc2

By: Dmitry (dortik) 2005-11-14 10:36:45.000-0600

Just replace "astman_get_variables" by the old one from my previous post and it will work fine.

By: BJ Weschke (bweschke) 2005-11-14 11:36:27.000-0600

That may fix the crash, but it also eliminates the ability to pass multiple variables on one line separated by the pipe which is the original reason for the patch.

By: BJ Weschke (bweschke) 2005-11-14 16:28:36.000-0600

corrected patch uploaded. This should kill this one.

By: twisted (twisted) 2005-11-14 20:43:40.000-0600

Fixed in CVS Head

By: nords (nords) 2005-11-14 22:36:04.000-0600

Just tested CVS-HEAD and it didn't core dump.

By: Digium Subversion (svnbot) 2008-01-15 15:56:04.000-0600

Repository: asterisk
Revision: 7097

U   trunk/ChangeLog
U   trunk/manager.c

------------------------------------------------------------------------
r7097 | twisted | 2008-01-15 15:56:03 -0600 (Tue, 15 Jan 2008) | 2 lines

Issue ASTERISK-5589

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

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

By: Digium Subversion (svnbot) 2008-01-15 15:56:05.000-0600

Repository: asterisk
Revision: 7098

U   trunk/ChangeLog
U   trunk/doc/README.variables

------------------------------------------------------------------------
r7098 | russell | 2008-01-15 15:56:04 -0600 (Tue, 15 Jan 2008) | 2 lines

add app exit status vars (issue ASTERISK-5589)

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

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