]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
extract a common condition.
authorLuigi Rizzo <rizzo@icir.org>
Wed, 19 Apr 2006 15:15:03 +0000 (15:15 +0000)
committerLuigi Rizzo <rizzo@icir.org>
Wed, 19 Apr 2006 15:15:03 +0000 (15:15 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@21508 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_dial.c

index c1a790b66063b7fc0ebb12f94d94602649d7b014..c6e2c64113d0f490ecda47697ffacaf52bbe0ad7 100644 (file)
@@ -608,21 +608,21 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct dial_l
                                        if (option_debug)
                                                ast_log(LOG_DEBUG, "Dunno what to do with control type %d\n", f->subclass);
                                }
-                       } else if (single && (f->frametype == AST_FRAME_VOICE) && 
-                                               !(ast_test_flag(outgoing, OPT_RINGBACK|OPT_MUSICBACK))) {
-                               if (ast_write(in, f)) 
-                                       ast_log(LOG_WARNING, "Unable to forward voice frame\n");
-                       } else if (single && (f->frametype == AST_FRAME_IMAGE) && 
-                                               !(ast_test_flag(outgoing, OPT_RINGBACK|OPT_MUSICBACK))) {
-                               if (ast_write(in, f))
-                                       ast_log(LOG_WARNING, "Unable to forward image\n");
-                       } else if (single && (f->frametype == AST_FRAME_TEXT) && 
-                                               !(ast_test_flag(outgoing, OPT_RINGBACK|OPT_MUSICBACK))) {
-                               if (ast_write(in, f))
-                                       ast_log(LOG_WARNING, "Unable to send text\n");
-                       } else if (single && (f->frametype == AST_FRAME_HTML) && !ast_test_flag(outgoing, DIAL_NOFORWARDHTML)) {
-                               if(ast_channel_sendhtml(in, f->subclass, f->data, f->datalen) == -1)
-                                       ast_log(LOG_WARNING, "Unable to send URL\n");
+                       } else if (single) {
+                               /* XXX are we sure the logic is correct ? or we should just switch on f->frametype ? */
+                               if (f->frametype == AST_FRAME_VOICE && !ast_test_flag(outgoing, OPT_RINGBACK|OPT_MUSICBACK)) {
+                                       if (ast_write(in, f)) 
+                                               ast_log(LOG_WARNING, "Unable to forward voice frame\n");
+                               } else if (f->frametype == AST_FRAME_IMAGE && !ast_test_flag(outgoing, OPT_RINGBACK|OPT_MUSICBACK)) {
+                                       if (ast_write(in, f))
+                                               ast_log(LOG_WARNING, "Unable to forward image\n");
+                               } else if (f->frametype == AST_FRAME_TEXT && !ast_test_flag(outgoing, OPT_RINGBACK|OPT_MUSICBACK)) {
+                                       if (ast_write(in, f))
+                                               ast_log(LOG_WARNING, "Unable to send text\n");
+                               } else if (f->frametype == AST_FRAME_HTML && !ast_test_flag(outgoing, DIAL_NOFORWARDHTML)) {
+                                       if (ast_channel_sendhtml(in, f->subclass, f->data, f->datalen) == -1)
+                                               ast_log(LOG_WARNING, "Unable to send URL\n");
+                               }
                        }
                        ast_frfree(f);
                } /* end for */