[asterisk-dev] wrong usage of AST_FLAG_END_DTMF_ONLY in
ast_senddigit()?
Michael Neuhauser
mike at firmix.at
Tue May 8 13:14:12 MST 2007
Hello!
I think that there is something wrong how ast_senddigit() uses
AST_FLAG_END_DTMF_ONLY (head of 1.4, r63286): ast_senddigit_begin() is
only called if AST_FLAG_END_DTMF_ONLY is not set.
This flag is only set in ast_channel_bridge():
if (!c0->tech->send_digit_begin)
ast_set_flag(c1, AST_FLAG_END_DTMF_ONLY);
if (!c1->tech->send_digit_begin)
ast_set_flag(c0, AST_FLAG_END_DTMF_ONLY);
>From this code and how AST_FLAG_END_DTMF_ONLY is used elsewhere, I
conclude that it is set iff the *OTHER* channel's tech has no
send_digit_begin function (not the channel that holds the flag).
So why is a property of another channel (the bridged one) checked when
the digit is send to the "own" channel? Shouldn't ast_senddigit() look
something like this
int ast_senddigit(struct ast_channel *chan, char digit)
{
/* original: if (!ast_test_flag(chan, AST_FLAG_END_DTMF_ONLY)) { */
if (chan->tech->send_digit_begin) {
ast_senddigit_begin(chan, digit);
ast_safe_sleep(chan, 100); /* XXX 100ms ... probably should be configurable */
}
return ast_senddigit_end(chan, digit, 100);
}
i.e., send a begin only if the channel's tech wants it?
Another thing is, that ast_senddigit_begin() will use playtones to fake
the digit when called for a channel that has a tech with
send_digit_begin == NULL (e.g., SIP with INFO). Is this a desired
behaviour? I can't think of any reason why it should behave that way.
Maybe it makes sense if the tech has both send_digit_begin and
send_digit_end set to NULL.
Regards,
Mike
--
Dr. Michael Neuhauser mailto:mike at firmix.at
Firmix Software GmbH sip:mike at firmix.at
Vienna/Austria/Europe tel:+43-1-7890849-30
Linux Development and Services http://www.firmix.at/
AST_FLAG_END_DTMF_ONLY
More information about the asterisk-dev
mailing list