[asterisk-dev] [Code Review] 2930: pbx.c: eliminate confusion when matching caller id and prevent removal of extension entry still in hashtable

Scott Griepentrog reviewboard at asterisk.org
Fri Oct 18 12:15:03 CDT 2013


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2930/
-----------------------------------------------------------

Review request for Asterisk Developers and Guenther Kelleter.


Bugs: AST-1235
    https://issues.asterisk.org/jira/browse/AST-1235


Repository: Asterisk


Description
-------

This patch fixes a bug report where restarting Asterisk repeatedly would cause a crash due to accidentally deleting extensions that were still referenced in the context's root_table.  This occurred due to confusion over matching or not matching extensions based on callerid, which is also being cleared up via an enum'd third state.

There are two values in an extension entry:  matchcid which says whether cid should be matched, and cidmatch which is the string value to match.  The matchcid value was previously non-zero when cidmatch was signficant.  This is important since a null length callerid match must be kept distinct from a match-anything condition.

This patch adds an enum to define the MATCHCID_OFF (0) or MATCHCID_ON (1) behaviors, and adds MATCHCID_ANY (2) which allows matching to both exten->matchcid=0 and exten->matchcid=1 cases.  For example, all exten's with the same exten (number) can be deleted with ANY, but when looking for a dialplan match it must match to matchcid, and if set to ON, further match cidmatch.


Diffs
-----

  /branches/1.8/include/asterisk/pbx.h 400531 
  /branches/1.8/main/pbx.c 400531 

Diff: https://reviewboard.asterisk.org/r/2930/diff/


Testing
-------

This patch has been tested with the testsuite additions dialplan_reload and pbx/callerid_match (posted separately) to insure that the crash case has been resolved without any other unwanted changes in behavior.


Thanks,

Scott Griepentrog

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20131018/3f8a4fb1/attachment.html>


More information about the asterisk-dev mailing list