[Asterisk-Dev] proper use of ast_streamfile + ast_waitstream ?

Luigi Rizzo rizzo at icir.org
Fri Dec 30 08:36:26 MST 2005


While trying to figure out how much duplicated code there is
in res_features.c (blind and attended transfer), i notice the following
common pattern in using ast_streamfile() and ast_waitstream()
that i don't totally understand:

                if (!ast_streamfile(caller_chan, courtesytone, caller_chan->language)) {
                        if (ast_waitstream(caller_chan, "") < 0) {
                                ast_log(LOG_WARNING, "Failed to play courtesy tone!\n");
			}
		}

I thought the error message should be printed also if
ast_streamfile() fails. So i'd rather write

                if (ast_streamfile(caller_chan, courtesytone, caller_chan->language) ||
				ast_waitstream(caller_chan, "") < 0) {
			ast_log(LOG_WARNING, "Failed to play courtesy tone!\n");
		}

am i correct ?

	cheers
	luigi



More information about the asterisk-dev mailing list