asterisk / ari-py

Library for accessing the Asterisk REST Interface
Other
149 stars 106 forks source link

stop a playback by id !? #21

Open rezatbaher opened 8 years ago

rezatbaher commented 8 years ago

hi thanks for your efforts i would like to stop a playback by id multiple channels in a single stasis app have playbacks which is generated by id . but on an event i want to stop a specific playback. how can i achieve that ? thanks

AlekseyLobanov commented 4 years ago

Works for me

def stop_playback_by_id(playback_id):
    try:
        playback = ari_client.playbacks.get(playbackId=playback_id)
    except requests.exceptions.HTTPError:
        logging.info(u"PlaybackID {} not found".format(playback_id))
        return False
    playback.stop()
    return True