outboundsocket.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:YouPBX 作者: JoneXiong 项目源码 文件源码
def wait_for_action(self, timeout=3600, raise_on_hangup=False):
        """
        Wait until an action is over
        and return action event.
        """
        self.log.debug("wait for action start")
        try:
            event = self._action_queue.get(timeout=timeout)
            self.log.debug("wait for action end %s" % str(event))
            if raise_on_hangup is True and self.has_hangup():
                self.log.warn("wait for action call hung up !")
                raise RESTHangup()
            return event
        except gevent.queue.Empty:
            if raise_on_hangup is True and self.has_hangup():
                self.log.warn("wait for action call hung up !")
                raise RESTHangup()
            self.log.warn("wait for action end timed out!")
            return Event()


    # In order to "block" the execution of our service until the
    # command is finished, we use a synchronized queue from gevent
    # and wait for such event to come. The on_channel_execute_complete
    # method will put that event in the queue, then we may continue working.
    # However, other events will still come, like for instance, DTMF.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号