zaf / asterisk-googletts

Asterisk AGI script that uses Google's translate text to speech service.
GNU General Public License v2.0
214 stars 125 forks source link

Shouldn't answer call explicitly #36

Closed tvierling closed 6 years ago

tvierling commented 7 years ago

Before I send a pull request for this, it's probably better to ask how you'd like this to be handled.

AGI scripts shouldn't explicitly answer the line unless told to do so. This includes scripts like this, so that it's possible to send early audio (dialplan does Progress and then plays back audio).

My usecase, as an example: A line which plays back a "number has been changed" message. It should only answer the line if I did Answer in the dialplan, at least by default. So for the moment I've simply commented out the whole block which does CHANNEL STATUS ... ANSWER.

Since this script is already in wide use, its current default is already well known. So would it be better to add another optional parameter that can be set to noanswer as with the standard Playback application?

zaf commented 7 years ago

Hello,

thank your for the suggestion. I see your use case and I agree that answering should be handled more gracefully. But as you said the script has been avaolable for years with this behavior and I would like to avoid to change its defaults and surprise users.

tvierling commented 7 years ago

Right, that is what I thought.

What do you think of a special value "noanswer" in place of intkey, since non-answered trunks can't use interruption keys? This would make it look a little like Playback() which has the special argument "noanswer" to prevent answering a trunk. It also would avoid adding a 5th argument.

zaf commented 7 years ago

Mybe not very pretty but I think its better to add another option after 'speed' to handle that. I don't like the idea of having an option with 2 different functionalities. This will also make the update compatible with old dialplans: If its not set the script will answer the channel and behave in its old and expected way.