pysipp icon indicating copy to clipboard operation
pysipp copied to clipboard

launch multiple scenarios with a context manager

Open goodboy opened this issue 9 years ago • 0 comments

Ended up using something similar for some FreeSWITCH cluster testing and figured it might as well be part of the pysipp API:

from contextlib import contextmanager

@contextmanager
def multicall(dialers):
    finalizers = []
    for for dialer in dialers:
        finalizers.append(dialer(block=False))

    yield dialers

    for finalize in finalizers:
        finalize()

It basically wraps the async usage from the README.

goodboy avatar Aug 22 '16 15:08 goodboy