Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

waitfor should unblock and raise an error on premature session hangup #12

Open
goodboy opened this issue Oct 16, 2017 · 0 comments
Open

Comments

@goodboy
Copy link
Member

goodboy commented Oct 16, 2017

Issue by tgoodlet
Thursday Aug 27, 2015 at 02:53 GMT
Originally opened as sangoma/switchy#12


Found an interesting isssue today where a test was waiting on the EventListener.waitfor call using the DtmfChecker app. The app in fact was not being invoked due to a failure with session-to-call association (due to the DUT not supporting x-header passthrough) and resulted in the waited on session actually being hungup much before the waitfor timeout. Really, if the session you're waiting on for a state change is hungup before any such change, an error should be raised immediately!

The solution will most likely include always setting events (if available) for waiters of a particular session on hangup here: https://github.com/sangoma/switchy/blob/master/switchy/observe.py#L586 by simply adding a second condtion:

if model.vars.get(varname) or model.hungup:
    map(Event.set, events)

In the latter case the waitfor logic will need to be adjusted to check for the hangup flag as well and raise an appropriate error in the calling thread somewhere here: https://github.com/sangoma/switchy/blob/master/switchy/observe.py#L633

My only concern would be for the case where some waiter is actually waiting for the hangup event itself. In that case I'm not sure exactly what to do... Maybe add a no_err_on_hangup flag to waitfor??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant