Example #1
0
 def call_progress_stop(self, application, call_id):
     try:
         channel = self._ari.channels.get(channelId=call_id)
         channel.ringStop()
         set_channel_var_sync(channel, 'WAZO_CALL_PROGRESS', '')
     except ARINotFound:
         raise NoSuchCall(call_id)
Example #2
0
    def call_unmute(self, application, call_id):
        try:
            channel = self._ari.channels.get(channelId=call_id)
            set_channel_var_sync(channel, 'WAZO_CALL_MUTED', '')
            channel.unmute(direction='in')
        except ARINotFound:
            raise NoSuchCall(call_id)

        formatter = CallFormatter(application, self._ari)
        call = formatter.from_channel(channel)
        self._notifier.call_updated(application, call)
Example #3
0
    def channel_moh_stopped(self, channel, event):
        application_uuid = AppNameHelper.to_uuid(event.get('application'))
        if not application_uuid:
            return

        application = self._service.get_application(application_uuid)

        set_channel_var_sync(channel, 'WAZO_MOH_UUID', '')
        formatter = CallFormatter(application, self._ari)
        call = formatter.from_channel(channel)
        self._notifier.call_updated(application, call)
Example #4
0
    def channel_moh_started(self, channel, event):
        application_uuid = AppNameHelper.to_uuid(event.get('application'))
        if not application_uuid:
            return

        application = self._service.get_application(application_uuid)

        moh = self._moh.find_by_name(event['moh_class'])
        if moh:
            set_channel_var_sync(channel, 'WAZO_MOH_UUID', str(moh['uuid']))

        formatter = CallFormatter(application, self._ari)
        call = formatter.from_channel(channel)
        self._notifier.call_updated(application, call)
Example #5
0
    def unmute(self, call_id):
        try:
            channel = self._ari.channels.get(channelId=call_id)
            set_channel_var_sync(channel,
                                 'WAZO_CALL_MUTED',
                                 '',
                                 bypass_stasis=True)
        except ARINotFound:
            raise NoSuchCall(call_id)

        ami.unmute(self._ami, call_id)

        # NOTE(fblackburn): asterisk should send back an event
        # instead of falsy pretend that channel is unmuted
        call = self.make_call_from_channel(self._ari, channel)
        self._notifier.call_updated(call)
Example #6
0
 def start_user_outgoing_call(self, application, channel):
     set_channel_var_sync(channel, 'WAZO_USER_OUTGOING_CALL', 'true')
     variables = self.get_channel_variables(channel)
     formatter = CallFormatter(application, self._ari)
     call = formatter.from_channel(channel, variables=variables)
     self._notifier.user_outgoing_call_created(application, call)