Summary:ASTERISK-12342: [patch] Zaptel/DAHDI channel name don't change after a hookflash event
Reporter:Daniel Ferrer (dferrer)Labels:
Date Opened:2008-07-08 15:02:32Date Closed:2008-08-14 11:38:45
Versions:Frequency of
Environment:Attachments:( 0) chan_dahdi-trunk_fix2.patch
( 1) chan_zap-
( 2) chan_zap-
( 3) cli_debug3.txt
( 4) svndiff_66312_66602.txt
Description:During a conversation using Zaptel/DAHDI channels, pressing flash on Zap/1-1 creates a new channel named Zap/1-1 instead of Zap/1-2 like previous asterisk versions, so there are 2 active channels with same name.
Looking further in SVN tree, seems that this is broken since Asterisk 1.4.5. exactly is broken between releases 66312 and 66602 when changed function asprintf to ast_safe_string_alloc inside func zt_new. It compares channel names 'Zap/1-1' with content of var 'b2' that has the remaining part of the string, '1-1' instead of the full channel name string.
(see diff http://svn.digium.com/view/asterisk/tags/1.4.5/channels/chan_zap.c?r1=66312&r2=66602 or attached svn diff)
I don't think that is a new convention for names, seems like a bug to me introduced when wanted to correct ASTERISK-9537.


The bug applies to all revisions > 66602, particulary discovered for chan_zap in release, but also also on chan_dahdi.c on SVN trunk.
I'm attaching 2 posible patches for to correct this situation, first one changes 3 lines of code and only changes asprintf to ast_safe_string_alloc, and leaves the full name of the channel in var 'b2' (ex 'Zap/1-1').
The second one only changes 1 line of code and leaves only the string after he '/' in var 'b2' (ex '1-1').
Also attached a patch to chan_dahdi in SVN trunk.
Comments:By: Digium Subversion (svnbot) 2008-08-14 11:38:43

Repository: asterisk
Revision: 137847

U   branches/1.4/channels/chan_dahdi.c

r137847 | tilghman | 2008-08-14 11:38:43 -0500 (Thu, 14 Aug 2008) | 9 lines

When creating the secondary subchannel name, it is necessary to compare to
the existing channel name without the "Zap/" or "DAHDI/" prefix, since our
test string is also without that prefix.
(closes issue ASTERISK-12342)
Reported by: dferrer
      chan_zap- uploaded by dferrer (license 525)
      (Slightly modified by me, to compensate for both names)