raiseRuntimeError("Failed to load sipclient's configuration: %s\nIf an old configuration file is in place, delete it or move it and recreate the configuration using the sip_settings script."%str(e))
raiseRuntimeError("More than one account exists which matches %s: %s"%(self.account_name,", ".join(sorted(account.idforaccountinpossible_accounts))))
iflen(possible_accounts)==0:
raiseRuntimeError("No enabled account that matches %s was found. Available and enabled accounts: %s"%(self.account_name,", ".join(sorted(account.idforaccountinaccount_manager.get_accounts()ifaccount.enabled))))
self.account=possible_accounts[0]
ifself.accountisNone:
raiseRuntimeError("Unknown account %s. Available accounts: %s"%(self.account_name,', '.join(account.idforaccountinaccount_manager.iter_accounts())))
elifself.account==BonjourAccount():
raiseRuntimeError("Cannot use bonjour account for watcherinfo subscription")
elifnotself.account.presence.enabled:
raiseRuntimeError("Presence is not enabled for account %s"%self.account.id)
elifnotself.account.xcap.enabled:
raiseRuntimeError("XCAP is not enabled for account %s"%self.account.id)
elifself.account.xcap.xcap_rootisNone:
raiseRuntimeError("XCAP root is not defined for account %s"%self.account.id)
self.output.put("Expected an entry for account %s in the winfo document"%self.account.id)
else:
buf=["Received NOTIFY:","----"]
buf.append("Active watchers:")
forwatcherinwlist.active:
buf.append(" %s"%watcher)
buf.append("Terminated watchers:")
forwatcherinwlist.terminated:
buf.append(" %s"%watcher)
buf.append("Pending watchers:")
forwatcherinwlist.pending:
buf.append(" %s"%watcher)
buf.append("Waiting watchers:")
forwatcherinwlist.waiting:
buf.append(" %s"%watcher)
buf.append("----")
self.output.put('\n'.join(buf))
if__name__=="__main__":
description="This script subscribes to the presence.winfo event package and shows the received watcher info document's content. The program will un-SUBSCRIBE and quit when CTRL+D is pressed."
parser.add_option("-a","--account-name",type="string",dest="account_name",help="The name of the account to use.")
parser.add_option("-s","--trace-sip",action="store_true",dest="trace_sip",default=False,help="Dump the raw contents of incoming and outgoing SIP messages (disabled by default).")
parser.add_option("-j","--trace-pjsip",action="store_true",dest="trace_pjsip",default=False,help="Print PJSIP logging output (disabled by default).")
parser.add_option("-n","--trace-notifications",action="store_true",dest="trace_notifications",default=False,help="Print all notifications (disabled by default).")