Reputation: 500
I am trying to make a function mute / un mute microphone and also speakers for my program softphone on pyt4 and using library PJSIP
I found this in the code pjsip
def conf_set_tx_level(self, slot, level): """Adjust the signal level to be transmitted from the bridge to the specified port by making it louder or quieter. Keyword arguments: slot -- integer to identify the conference slot number. level -- Signal level adjustment. Value 1.0 means no level adjustment, while value 0 means to mute the port. """ lck = self.auto_lock() err = _pjsua.conf_set_tx_level(slot, level) self._err_check("conf_set_tx_level()", self, err) def conf_set_rx_level(self, slot, level): """Adjust the signal level to be received from the specified port (to the bridge) by making it louder or quieter. Keyword arguments: slot -- integer to identify the conference slot number. level -- Signal level adjustment. Value 1.0 means no level adjustment, while value 0 means to mute the port. """ lck = self.auto_lock() err = _pjsua.conf_set_rx_level(slot, level) self._err_check("conf_set_rx_level()", self, err)
well I understand I need to send a parameter 0, but how to do?
And to return back work the sound device and microphone.
Maybe it """""pjsua_conf_adjust_tx_level(slot_number, 0 )"""""
Upvotes: 0
Views: 1302
Reputation: 500
himself answer :-)
in my case it was so
# call window ################ self.MuteMic = False self.MuteSpeaker = False ################ #btn signals self.connect(self.MuteUnmuteMicButton, QtCore.SIGNAL("clicked()"), self.MuteUnmuteMic) self.connect(self.MuteUnmuteSpeakerButton, QtCore.SIGNAL("clicked()"), self.MuteUnmuteSpeaker) def MuteUnmuteMic(self): try: if self.MuteMic: self.MuteMic = False self.parent().unmute_mic() else: self.MuteMic = True self.parent().mute_mic() except: debug ("ошибка при вызове функции включение или отключение микрофона (call Window).") def MuteUnmuteSpeaker(self): try: if self.MuteSpeaker: self.MuteSpeaker = False self.parent().unmute_speaker() else: self.MuteSpeaker = True self.parent().mute_speaker() except: debug ("ошибка при вызове функции включение или отключение микрофона (call Window).") # other code ---------- # ----------------------core of the my app # ---import PJUA lib---- def mute_mic(self): #this that you need in my case my app connected to pjua "self.lib" self.lib.conf_set_rx_level(0,0) debug ("вызвана функция выключение микрофона") def unmute_mic(self): self.lib.conf_set_rx_level(0,1) debug ("вызвана функция включение микрофона") def mute_speaker(self): self.lib.conf_set_tx_level(0,0) debug ("вызвана функция выключение динамиков") def unmute_speaker(self): self.lib.conf_set_tx_level(0,1) debug ("вызвана функция включение динамиков")
Upvotes: 2