aboutsummaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2009-04-27 19:11:10 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2009-04-27 19:11:10 +0000
commit5ec321eb94e981c5f081f65c414bf339050d247c (patch)
tree0ebca32db4bcde6ac7bd3ca7131c2d64609d7cac /res
parent5f2e950381978462f3829a84a436029714f44fdb (diff)
Merged revisions 190663 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r190663 | russell | 2009-04-27 14:08:12 -0500 (Mon, 27 Apr 2009) | 22 lines Merged revisions 190661-190662 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r190661 | russell | 2009-04-27 14:00:54 -0500 (Mon, 27 Apr 2009) | 9 lines 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) ........ r190662 | russell | 2009-04-27 14:03:59 -0500 (Mon, 27 Apr 2009) | 2 lines Fix a typo from 190661. ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.1@190665 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r--res/res_smdi.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/res/res_smdi.c b/res/res_smdi.c
index 56a32e8f1..76f61fc5b 100644
--- a/res/res_smdi.c
+++ b/res/res_smdi.c
@@ -378,7 +378,18 @@ static void *smdi_msg_find(struct ast_smdi_interface *iface,
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 */
@@ -406,7 +417,20 @@ static void *smdi_msg_find(struct ast_smdi_interface *iface,
}
break;
case SMDI_MWI:
- msg = ASTOBJ_CONTAINER_FIND(&iface->mwi_q, search_key);
+ if (ast_strlen_zero(search_key)) {
+ 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;
+ } else {
+ msg = ASTOBJ_CONTAINER_FIND(&iface->mwi_q, search_key);
+ }
break;
}