[Home]

Summary:ASTERISK-01059: Asterisk segfault on extensions.conf when reloading
Reporter:geertn (geertn)Labels:
Date Opened:2004-02-20 10:23:43.000-0600Date Closed:2008-01-15 14:44:12.000-0600
Priority:CriticalRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) bt
Description:Asterisk segfauls when reloading with particular entries in extensions.conf.

I have in extensions.conf:
[enum-test]
;exten => _011X.,1,EnumLookup(${EXTEN:3})
;exten => _011X.,2,GotoIf($[$[${ENUM:0:3} = SIP] | $[${ENUM:0:3} = IAX]]?3:4)
;exten => _011X.,3,Dial(${ENUM})

;
; EnumLookup will result in success, which goes to n+1, or
;  if a tel: answer is provided, it jumps to n+51, and if
;  the lookup fails entirely it will jump to n+101.  The two
;  failure cases (n+51 and n+101) should just jump to the
;  pointer for normal case dialing out an analog or other
;  path, as no ENUM result was found.
;
exten => _011X.,52,Goto(normal-dial,${EXTEN},1)
exten => _011X.,102,Goto(normal-dial,${EXTEN},1)
exten => _011X.,4,Goto(normal-dial,${EXTEN},1)
exten => _011X.,104,Goto(normal-dial,${EXTEN},1)


When I reload:
reload
 == Parsing '/etc/asterisk/manager.conf': Found
 == Parsing '/etc/asterisk/enum.conf': Found
 == Parsing '/etc/asterisk/rtp.conf': Found
 == RTP Allocating from port range 10000 -> 20000
   -- Reloading module 'cdr_csv.so' (Comma Separated Values CDR Backend)
   -- Reloading module 'app_enumlookup.so' (ENUM Lookup)
 == Parsing '/etc/asterisk/enum.conf': Found
   -- Reloading module 'app_queue.so' (True Call Queueing)
 == Parsing '/etc/asterisk/queues.conf': Found
   -- Reloading module 'app_voicemail.so' (Comedian Mail (Voicemail System))
 == Parsing '/etc/asterisk/voicemail.conf': Found
   -- Reloading module 'pbx_config.so' (Text Extension Configuration)
 == Parsing '/etc/asterisk/extensions.conf': Found
Segmentation fault (core dumped)

Backtrace attached.
Comments:By: geertn (geertn) 2004-02-20 10:25:59.000-0600

I think it's in the
Goto(normal-dial,${EXTEN},1)

I do not have the normal-dial contex so it probably has to do with not existing context.

By: James Golovich (jamesgolovich) 2004-02-21 14:49:14.000-0600

This doesn't have anything to do with the missing context.  When the extension list is built it just inserts the apps in the list.  The real problem is when ast_add_extension2 inserts stuff into the exten list, and its not doing it in the right order for some reason.  If you reorder the extensions so they are ordered numericaly by priority then everything is fine.

Definitely a bug.  Hopefully its an easy one to find

By: Brian West (bkw918) 2004-02-21 20:43:15.000-0600

doesn't help that priority 1 thru 3 are commented out in his example does it?

By: James Golovich (jamesgolovich) 2004-02-21 20:45:51.000-0600

It doesn't matter, even if 1-3 were in there, a lower priority is defined after a higher priority which is whats causing the problem.  But that doesn't even matter because even user errors or misconfigurations should not cause segfault.  It's clear where the problem is and I have a fix, but I'm waiting for external confirmation before applying

By: James Golovich (jamesgolovich) 2004-02-22 22:01:19.000-0600

Ok this is now fixed in cvs (HEAD and -stable).

By: Digium Subversion (svnbot) 2008-01-15 14:44:11.000-0600

Repository: asterisk
Revision: 2215

U   trunk/pbx.c

------------------------------------------------------------------------
r2215 | citats | 2008-01-15 14:44:10 -0600 (Tue, 15 Jan 2008) | 3 lines

Fix ast_add_extension2 updating ast_exten correctly in certain cases
where extensions.conf is not ordered numerically by priority (bug ASTERISK-1059)

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

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

By: Digium Subversion (svnbot) 2008-01-15 14:44:12.000-0600

Repository: asterisk
Revision: 2216

U   branches/v1-0_stable/pbx.c

------------------------------------------------------------------------
r2216 | citats | 2008-01-15 14:44:11 -0600 (Tue, 15 Jan 2008) | 3 lines

Fix ast_add_extension2 updating ast_exten correctly in certain cases
where extensions.conf is not ordered numerically by priority (bug ASTERISK-1059)

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

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