[asterisk-commits] russell: branch 1.4 r190661 - /branches/1.4/res/res_smdi.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Apr 27 14:00:57 CDT 2009
Author: russell
Date: Mon Apr 27 14:00:54 2009
New Revision: 190661
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=190661
Log:
Resolve a crash in res_smdi when used with chan_dahdi.
When chan_dahdi goes to get an SMDI message, it provides no search criteria.
It just grabs the next message that arrives. This code was written with the
SMDI dialplan functions in mind, since that is now the preferred method of
using SMDI. However, this broke support of it being used from chan_dahdi.
(closes AST-212)
Modified:
branches/1.4/res/res_smdi.c
Modified: branches/1.4/res/res_smdi.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.4/res/res_smdi.c?view=diff&rev=190661&r1=190660&r2=190661
==============================================================================
--- branches/1.4/res/res_smdi.c (original)
+++ branches/1.4/res/res_smdi.c Mon Apr 27 14:00:54 2009
@@ -383,7 +383,18 @@
switch (type) {
case SMDI_MD:
- if (ast_test_flag(&options, OPT_SEARCH_TERMINAL)) {
+ if (ast_strlen_zero(search_key)) {
+ struct ast_smdi_md_message *md_msg = NULL;
+
+ /* No search key provided (the code from chan_dahdi does this).
+ * Just pop the top message off of the queue. */
+
+ ASTOBJ_CONTAINER_TRAVERSE(&iface->md_q, !md_msg, do {
+ md_msg = ASTOBJ_REF(iterator);
+ } while (0); );
+
+ msg = md_msg;
+ } else if (ast_test_flag(&options, OPT_SEARCH_TERMINAL)) {
struct ast_smdi_md_message *md_msg = NULL;
/* Searching by the message desk terminal */
@@ -411,7 +422,20 @@
}
break;
case SMDI_MWI:
- msg = ASTOBJ_CONTAINER_FIND(&iface->mwi_q, search_key);
+ if (ast_strlen_zero(search_key)) {
+ msg = ASTOBJ_CONTAINER_FIND(&iface->mwi_q, search_key);
+ } else {
+ struct ast_smdi_mwi_message *mwi_msg = NULL;
+
+ /* No search key provided (the code from chan_dahdi does this).
+ * Just pop the top message off of the queue. */
+
+ ASTOBJ_CONTAINER_TRAVERSE(&iface->mwi_q, !mwi_msg, do {
+ mwi_msg = ASTOBJ_REF(iterator);
+ } while (0); );
+
+ msg = mwi_msg;
+ }
break;
}
More information about the asterisk-commits
mailing list