Summary:ASTERISK-06926: [patch][post 1.4] Remove chan->language from ast_stream_and_wait call
Reporter:Andrey S Pankov (casper)Labels:
Date Opened:2006-05-08 13:38:51Date Closed:2006-11-17 17:36:09.000-0600
Versions:Frequency of
Environment:Attachments:( 0) Ast_stream_and_wait.r26593.diff
Description:Currently ast_stream_and_wait takes four args. Can it be
simplified to take only three of them?

-ast_stream_and_wait(chan, "beep", chan->language, "")
+ast_stream_and_wait(chan, "beep", "")

The only question why we use another language in the lines below:

res/res_features.c:603: if (ast_stream_and_wait(transferer, xferfailsound, transferee->language, AST_DIGIT_ANY) < 0 ) {
res/res_features.c:1648:                                error = ast_stream_and_wait(peer, courtesytone, chan->language, "");


I failed to get answer on the dev@, that's why I post this here.

Comments:By: Andrey S Pankov (casper) 2006-05-08 13:44:39

To answer my own questions:
- in the first case I assume it to be just a copy&paste bug
- in the second case I'm unsure a bit about whether peer->language is set.
 Anyway this is not to ast_stream_and_wait to handle this. Lower-level
 routines should assume "default" or "en" in the cases c->language is NULL.

By: Serge Vecher (serge-v) 2006-05-08 13:49:28

makes sense, however, as a side commentary: it was not even 24 hrs since you've posted the message on the list...

By: Jeffrey C. Ollie (jcollie) 2006-05-08 13:58:25

Makes sense to me as well.  The two uses that you list in res_features look like bugs to me.  We may want to commit this patch in two phases... first fix the "bugs" in res_features without the API change, then change the API globally.

By: Andrey S Pankov (casper) 2006-05-08 14:16:00

I don't see the need to do it "in two phases". 1.2 needs its own fix anyway
if those two lines are real bugs.

By: Andrey S Pankov (casper) 2006-05-08 14:20:24

Uploaded patch for 1.2 :)

By: Andrey S Pankov (casper) 2006-05-08 14:23:10

vechers: as a side commentary :) I used to the fact rfc's are silently ignored there...

By: Andrey S Pankov (casper) 2006-05-10 13:51:19

Patch updated. Please delete the old one... thanks!

By: Leif Madsen (lmadsen) 2006-05-10 14:05:14

Old patch deleted as per request

By: Andrey S Pankov (casper) 2006-05-10 14:40:26

blitzrage: thanks, but why did you delete the patch for 1.2 branch? :(

By: Andrey S Pankov (casper) 2006-05-15 13:36:34

Moreover, app_dictate already uses its own modified ast_stream_and_wait without
language parameter. And there is very similar ast_play_and_wait(struct ast_channel *,
const char *), but it is in app.c, not in file.c

By: Joshua C. Colp (jcolp) 2006-05-22 15:21:38

The bugfix is in 1.2 and trunk now... as for the rest, continue discussion.

By: Serge Vecher (serge-v) 2006-06-05 20:53:28

casper, need an update here ....

By: Andrey S Pankov (casper) 2006-06-06 13:11:00

There will be an update only if there is clear indication that this will go into
1.4. If not please mark it post-1.4 and I'll update it when 1.5 is branched.

By: Steve Murphy (murf) 2006-10-17 18:19:28

casper, 1.4 is forked. Now is the time. How might I help?

By: Steve Murphy (murf) 2006-11-07 18:01:21.000-0600

Casper-- on bug 7109, the chan->language arg in stream_and_wait issue, how would you like to proceed?

By: Steve Murphy (murf) 2006-11-17 16:17:59.000-0600

After thinking this over a bit, I've determined that when someone is right, he is right. In 99% of all usage, that language argument is redundant. And in the few places where it wasn't redundant, there's a good possibility that it was wrong. And if by some miracle, it wasn't wrong, then the best thing to do would be to change the channel's language setting before calling the stream_and_wait.

So, I'm doing it, and that's that.

By: Steve Murphy (murf) 2006-11-17 17:34:42.000-0600

I committed these changes (and a few of my own to cover new code since the patch was submitted) via 47821. The few cases where chan->language wasn't passed in, will be covered on a case-by-case basis in the future, if any probs arise.

By: Steve Murphy (murf) 2006-11-17 17:36:08.000-0600

with this issue resolved, this bug can be closed.