Browse Source

Added prefix-resolution if no default proxy is set and the number is not absolute

master
klonfish 10 years ago
parent
commit
4558c0f1b2
  1. 9
      phoneinterface.py

9
phoneinterface.py

@ -62,7 +62,6 @@ class PhoneInterface(object):
pconf.publish_enabled = False pconf.publish_enabled = False
pconf.realm = p.realm pconf.realm = p.realm
pconf.register_enabled = True pconf.register_enabled = True
pconf.register_enabled = True
pconf.server_addr = p.proxy pconf.server_addr = p.proxy
self.__core.add_proxy_config(pconf) self.__core.add_proxy_config(pconf)
pconf.done() pconf.done()
@ -153,6 +152,12 @@ class PhoneInterface(object):
self.__event_cbs.append(cb) self.__event_cbs.append(cb)
def call(self, number): def call(self, number):
if '@' not in number and self.__core.default_proxy_config is None:
# Try to resolve prefix
for p in self.__config.proxies:
if number.startswith(p.prefix):
number += '@' + p.realm
break
self.__core.invite(number) self.__core.invite(number)
def accept_call(self): def accept_call(self):
@ -208,4 +213,4 @@ if __name__ == '__main__':
pass pass
except KeyboardInterrupt: except KeyboardInterrupt:
phone.stop() phone.stop()

Loading…
Cancel
Save