本文整理汇总了Python中sipsimple.configuration.settings.SIPSimpleSettings类的典型用法代码示例。如果您正苦于以下问题:Python SIPSimpleSettings类的具体用法?Python SIPSimpleSettings怎么用?Python SIPSimpleSettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SIPSimpleSettings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _NH_XCAPManagerDidReloadData
def _NH_XCAPManagerDidReloadData(self, notification):
account = notification.sender.account
settings = SIPSimpleSettings()
offline_status = notification.data.offline_status
status_icon = notification.data.status_icon
try:
offline_note = next(note for service in offline_status.pidf.services for note in service.notes)
except (AttributeError, StopIteration):
offline_note = None
settings.presence_state.offline_note = offline_note
settings.save()
if status_icon:
icon_hash = hashlib.sha512(status_icon.data).hexdigest()
user_icon = UserIcon(status_icon.url, icon_hash)
if not settings.presence_state.icon or settings.presence_state.icon.etag != icon_hash:
# TODO: convert icon to PNG before saving it
self.owner.saveUserIcon(status_icon.data, icon_hash)
else:
user_icon = None
if settings.presence_state.icon:
unlink(settings.presence_state.icon.path)
settings.presence_state.icon = None
settings.save()
account.xcap.icon = user_icon
account.save()
# Cleanup old base64 encoded icons from payload
if account.id not in self._cleanedup_accounts:
self._cleanup_icons(account)
示例2: save_certificates
def save_certificates(self, sip_address, crt, key, ca):
crt = crt.strip() + os.linesep
key = key.strip() + os.linesep
ca = ca.strip() + os.linesep
X509Certificate(crt)
X509PrivateKey(key)
X509Certificate(ca)
makedirs(ApplicationData.get('tls'))
certificate_path = ApplicationData.get(os.path.join('tls', sip_address+'.crt'))
file = open(certificate_path, 'w')
os.chmod(certificate_path, 0600)
file.write(crt+key)
file.close()
ca_path = ApplicationData.get(os.path.join('tls', 'ca.crt'))
try:
existing_cas = open(ca_path).read().strip() + os.linesep
except:
file = open(ca_path, 'w')
file.write(ca)
file.close()
else:
if ca not in existing_cas:
file = open(ca_path, 'w')
file.write(existing_cas+ca)
file.close()
settings = SIPSimpleSettings()
settings.tls.ca_list = ca_path
settings.save()
return certificate_path
示例3: _AH_GoogleContactsActionTriggered
def _AH_GoogleContactsActionTriggered(self):
settings = SIPSimpleSettings()
if settings.google_contacts.authorization_token is not None:
settings.google_contacts.authorization_token = None
settings.save()
self.google_contacts_dialog.hide()
else:
self.google_contacts_dialog.open()
示例4: __init__
def __init__(self):
super(Blink, self).__init__(sys.argv)
self.setAttribute(Qt.AA_DontShowIconsInMenus, False)
self.sip_application = SIPApplication()
self.first_run = False
self.setOrganizationDomain("ag-projects.com")
self.setOrganizationName("AG Projects")
self.setApplicationName("Blink")
self.setApplicationVersion(__version__)
self.main_window = MainWindow()
self.chat_window = ChatWindow()
self.main_window.__closed__ = True
self.chat_window.__closed__ = True
self.main_window.installEventFilter(self)
self.chat_window.installEventFilter(self)
self.main_window.addAction(self.chat_window.control_button.actions.main_window)
self.chat_window.addAction(self.main_window.quit_action)
self.chat_window.addAction(self.main_window.help_action)
self.chat_window.addAction(self.main_window.redial_action)
self.chat_window.addAction(self.main_window.join_conference_action)
self.chat_window.addAction(self.main_window.mute_action)
self.chat_window.addAction(self.main_window.silent_action)
self.chat_window.addAction(self.main_window.preferences_action)
self.chat_window.addAction(self.main_window.transfers_window_action)
self.chat_window.addAction(self.main_window.logs_window_action)
self.chat_window.addAction(self.main_window.received_files_window_action)
self.chat_window.addAction(self.main_window.screenshots_window_action)
self.ip_address_monitor = IPAddressMonitor()
self.log_manager = LogManager()
self.presence_manager = PresenceManager()
self.session_manager = SessionManager()
self.update_manager = UpdateManager()
# Prevent application from exiting after last window is closed if system tray was initialized
if self.main_window.system_tray_icon:
self.setQuitOnLastWindowClosed(False)
self.main_window.check_for_updates_action.triggered.connect(self.update_manager.check_for_updates)
self.main_window.check_for_updates_action.setVisible(self.update_manager != Null)
if getattr(sys, "frozen", False):
XMLDocument.schema_path = Resources.get("xml-schemas")
Account.register_extension(AccountExtension)
BonjourAccount.register_extension(BonjourAccountExtension)
Contact.register_extension(ContactExtension)
Group.register_extension(GroupExtension)
SIPSimpleSettings.register_extension(SIPSimpleSettingsExtension)
notification_center = NotificationCenter()
notification_center.add_observer(self, sender=self.sip_application)
branding.setup(self)
示例5: _NH_CFGSettingsObjectDidChange
def _NH_CFGSettingsObjectDidChange(self, account, data):
if isinstance(account, Account):
if 'message_summary.enabled' in data.modified:
if not account.message_summary.enabled:
MWIData.remove(account)
if 'audio.enable_aec' in data.modified:
settings = SIPSimpleSettings()
BlinkLogger().log_info(u"Acoustic Echo Canceller is %s" % ('enabled' if settings.audio.enable_aec else 'disabled'))
settings.audio.tail_length = 15 if settings.audio.enable_aec else 0
settings.save()
示例6: runModal
def runModal(self):
self.window.makeKeyAndOrderFront_(None)
rc = NSApp.runModalForWindow_(self.window)
self.window.orderOut_(self)
if rc == NSOKButton:
note = unicode(self.nameText.stringValue())
settings = SIPSimpleSettings()
settings.presence_state.offline_note = note
settings.save()
return note
return None
示例7: notificationsCheckboxClicked_
def notificationsCheckboxClicked_(self, sender):
settings = SIPSimpleSettings()
settings.logs.trace_notifications_in_gui = bool(sender.state())
settings.logs.trace_notifications = settings.logs.trace_notifications_in_gui or settings.logs.trace_notifications_to_file
settings.save()
notification_center = NotificationCenter()
if settings.logs.trace_notifications_in_gui:
notification_center.add_observer(self)
else:
notification_center.discard_observer(self)
示例8: msrpRadioClicked_
def msrpRadioClicked_(self, sender):
trace = sender.selectedCell().tag()
settings = SIPSimpleSettings()
settings.logs.trace_msrp_in_gui = trace
if trace == Disabled:
settings.logs.trace_msrp = settings.logs.trace_msrp_to_file
elif trace == Simplified:
settings.logs.trace_msrp = True
elif trace == Full:
settings.logs.trace_msrp = True
settings.save()
示例9: _NH_SIPApplicationDidStart
def _NH_SIPApplicationDidStart(self, notification):
settings = SIPSimpleSettings()
if settings.presence_state.timestamp is None:
settings.presence_state.timestamp = ISOTimestamp.now()
settings.save()
self.get_location([account for account in AccountManager().iter_accounts() if account is not BonjourAccount()])
self.publish()
idle_timer = NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_(1.0, self, "updateIdleTimer:", None, True)
NSRunLoop.currentRunLoop().addTimer_forMode_(idle_timer, NSRunLoopCommonModes)
NSRunLoop.currentRunLoop().addTimer_forMode_(idle_timer, NSEventTrackingRunLoopMode)
示例10: init
def init(self):
Account.register_extension(AccountExtension)
BonjourAccount.register_extension(BonjourAccountExtension)
Contact.register_extension(BlinkContactExtension)
Group.register_extension(BlinkGroupExtension)
SIPSimpleSettings.register_extension(SIPSimpleSettingsExtension)
self._app.start(FileStorage(ApplicationData.directory))
# start session mgr
SessionManager()
示例11: _NH_CFGSettingsObjectDidChange
def _NH_CFGSettingsObjectDidChange(self, account, data):
if isinstance(account, Account):
if 'message_summary.enabled' in data.modified:
if not account.message_summary.enabled:
MWIData.remove(account)
if 'audio.echo_canceller.enabled' in data.modified:
settings = SIPSimpleSettings()
settings.audio.sample_rate = 32000 if settings.audio.echo_canceller.enabled and settings.audio.sample_rate not in ('16000', '32000') else 48000
spectrum = settings.audio.sample_rate/1000/2 if settings.audio.sample_rate/1000/2 < 20 else 20
BlinkLogger().log_info(u"Audio sample rate is set to %dkHz covering 0-%dkHz spectrum" % (settings.audio.sample_rate/1000, spectrum))
BlinkLogger().log_info(u"Acoustic Echo Canceller is %s" % ('enabled' if settings.audio.echo_canceller.enabled else 'disabled'))
if spectrum >=20:
BlinkLogger().log_info(u"For studio quality disable the option 'Use ambient noise reduction' in System Preferences > Sound > Input section.")
settings.save()
elif 'audio.sample_rate' in data.modified:
settings = SIPSimpleSettings()
spectrum = settings.audio.sample_rate/1000/2 if settings.audio.sample_rate/1000/2 < 20 else 20
if settings.audio.sample_rate == 48000:
settings.audio.echo_canceller.enabled = False
settings.audio.enable_aec = False
settings.save()
else:
settings.audio.echo_canceller.enabled = True
settings.audio.enable_aec = True
settings.save()
示例12: __init__
def __init__(self):
self.application = SIPApplication()
self.stopping = False
self.stop_event = Event()
Account.register_extension(AccountExtension)
BonjourAccount.register_extension(BonjourAccountExtension)
SIPSimpleSettings.register_extension(SIPSimpleSettingsExtension)
self.account_model = AccountModel()
self.bonjour_services = BonjourServices()
self.hal = HardwareAbstractionLayer()
self.session_manager = SessionManager()
self.web_handler = WebHandler()
示例13: _NH_SIPApplicationWillStart
def _NH_SIPApplicationWillStart(self, sender, data):
settings = SIPSimpleSettings()
settings.user_agent = "%s %s (MacOSX)" % (NSApp.delegate().applicationName, self._version)
BlinkLogger().log_info(u"Initializing SIP SIMPLE Client SDK %s" % sdk_version)
build = str(NSBundle.mainBundle().infoDictionary().objectForKey_("CFBundleVersion"))
date = str(NSBundle.mainBundle().infoDictionary().objectForKey_("BlinkVersionDate"))
BlinkLogger().log_info(u"Build %s from %s" % (build, date))
self.migratePasswordsToKeychain()
# Set audio settings compatible with AEC and Noise Supressor
settings.audio.sample_rate = 16000
settings.audio.tail_length = 15 if settings.audio.enable_aec else 0
settings.save()
BlinkLogger().log_info(u"Acoustic Echo Canceller is %s" % ('enabled' if settings.audio.enable_aec else 'disabled'))
# Although this setting is set at enrollment time, people who have downloaded previous versions will not have it
account_manager = AccountManager()
for account in account_manager.iter_accounts():
must_save = False
if account is not BonjourAccount() and account.sip.primary_proxy is None and account.sip.outbound_proxy and not account.sip.selected_proxy:
account.sip.primary_proxy = account.sip.outbound_proxy
must_save = True
if account is not BonjourAccount() and settings.tls.verify_server != account.tls.verify_server:
account.tls.verify_server = settings.tls.verify_server
must_save = True
if account.tls.certificate and os.path.basename(account.tls.certificate.normalized) != 'default.crt':
account.tls.certificate = DefaultValue
must_save = True
if account.id.domain == "sip2sip.info":
if account.server.settings_url is None:
account.server.settings_url = "https://blink.sipthor.net/settings.phtml"
must_save = True
if not account.ldap.hostname:
account.ldap.hostname = "ldap.sipthor.net"
account.ldap.dn = "ou=addressbook, dc=sip2sip, dc=info"
account.ldap.enabled = True
must_save = True
if must_save:
account.save()
logger = FileLogger()
logger.start()
self.ip_address_monitor.start()
示例14: speechRecognizer_didRecognizeCommand_
def speechRecognizer_didRecognizeCommand_(self, recognizer, command):
if command == u'Reject':
self.decideForAllSessionRequests(REJECT)
self.stopSpeechRecognition()
elif command == u'Busy':
self.decideForAllSessionRequests(BUSY)
self.stopSpeechRecognition()
elif command in (u'Accept', u'Answer'):
self.decideForAllSessionRequests(ACCEPT)
self.stopSpeechRecognition()
elif command in (u'Voicemail', u'Answering machine'):
settings = SIPSimpleSettings()
settings.answering_machine.enabled = not settings.answering_machine.enabled
settings.save()
if settings.answering_machine.enabled:
self.stopSpeechRecognition()
示例15: sipRadioClicked_
def sipRadioClicked_(self, sender):
notification_center = NotificationCenter()
trace = sender.selectedCell().tag()
settings = SIPSimpleSettings()
settings.logs.trace_sip_in_gui = trace
if trace == Disabled:
notification_center.discard_observer(self, name="DNSLookupTrace")
settings.logs.trace_sip = settings.logs.trace_sip_to_file
elif trace == Simplified:
notification_center.add_observer(self, name="DNSLookupTrace")
settings.logs.trace_sip = True
elif trace == Full:
notification_center.add_observer(self, name="DNSLookupTrace")
settings.logs.trace_sip = True
settings.save()