]> git.ipfire.org Git - thirdparty/asterisk.git/commit
pbx.c: Fix handling of '-' in extension name and callerid 65/3365/2
authorCorey Farrell <git@cfware.com>
Thu, 28 Jul 2016 19:10:04 +0000 (15:10 -0400)
committerCorey Farrell <git@cfware.com>
Fri, 29 Jul 2016 00:00:23 +0000 (20:00 -0400)
commit57e9c66819607fc8b391f7939a9b2487c032c11e
tree9815bd05a237c9f7a33f58deb2e885d917320d74
parent7883f128d54a52c65741c0e03e69ba0cf27a4743
pbx.c: Fix handling of '-' in extension name and callerid

This adds a two strings to ast_exten.  name to go with exten and
cidmatch_display to go with cidmatch.  The new fields contain input used
to add the extension in the first place.  The existing fields now
contain stripped input that excludes insignificant spaces and dashes.
These stripped fields should always be used for comparisons.  The
unstripped fields should normally be used for display, but displaying
stripped values will not cause runtime errors.

Note the actual string is only stored twice if it contains dashes.  If
no dashes are found then both 'char *' fields point to the same memory.
So this change has a minimum effect on memory usage.

The existing functions ast_get_extension_name and
ast_get_extension_cidmatch return unstripped values as they did before
this change.  Other similar bugs likely still exist where unstripped
extensions are saved outside pbx.c then passed back in.

ASTERISK-26233 #close

Change-Id: I6cd61ce57acc1570ca6cc14960c4c3b0a9eb837f
main/pbx.c