[Asterisk-Dev] say.c cleanup, request for clarification

Luigi Rizzo rizzo at icir.org
Wed Nov 9 09:02:07 MST 2005


in the say.c cleanup i am doing, i notice that the original code
basically uses the 4 different methods below to stream an audio
file.  I do not see any eplaination in the code for using this
or that method, other than the cut&paste source,

So i have two questions:

**  what is the role of the final ast_stopstream() ?
    Do we really need it ?

**  does it make any sense, in methods 3 and 4, to
    call ast_waitstream_full() or ast_waitstream()
    depending on the arguments ? Shouldn't
    ast_waitstream_full() already do the right thing ?

cheers
luigi

    ---  method #1: ---
        res = ast_streamfile(chan, fn, language);
        if (!res)
	    res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
        ast_stopstream(chan);
  
    ---  method 2 ---
        res = ast_streamfile(chan, fn, lang);
        if (!res)
	    res = ast_waitstream(chan, ints);

    --- method 3 --- 
        res = ast_streamfile(chan, fn, language);
        if (!res) {
	    if (audiofd  > -1 && ctrlfd > -1)
		res = ast_waitstream_full(chan, ints, audiofd, ctrlfd)
	    else
		res = ast_waitstream(chan, ints);
        }

    --- method 4 --- (basically method 3 followed by ast_stopstream())
        res = ast_streamfile(chan, fn, language);
        if (!res) {
	    if (audiofd  > -1 && ctrlfd > -1)
		res = ast_waitstream_full(chan, ints, audiofd, ctrlfd)
	    else
		res = ast_waitstream(chan, ints);
        }
        ast_stopstream(a->chan);

-------------------



More information about the asterisk-dev mailing list