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())))
buf.append("Presence for %s:"%urllib.parse.unquote(pidf.entity))
persons={}
devices={}
services={}
printed_sep=True
forchildinpidf:
ifisinstance(child,Person):
persons[child.id]=child
elifisinstance(child,Device):
devices[child.id]=child
elifisinstance(child,Service):
services[child.id]=child
# handle person information
iflen(persons)==0:
iflist(pidf.notes):
buf.append(" Person information:")
fornoteinpidf.notes:
buf.append(" %s"%self._format_note(note))
printed_sep=False
else:
forpersoninlist(persons.values()):
buf.append(" Person: %s"%person.id)
buf.extend(self._format_person(person,pidf))
printed_sep=False
# handle services informaation
iflen(services)>0:
ifnotprinted_sep:
buf.append(" "+"-"*3)
forserviceinlist(services.values()):
buf.append(" Service: %s"%service.id)
buf.extend(self._format_service(service,pidf))
# handle devices informaation
iflen(devices)>0:
ifnotprinted_sep:
buf.append(" "+"-"*3)
fordeviceinlist(devices.values()):
buf.append(" Device: %s"%device.id)
buf.extend(self._format_device(device,pidf))
buf.append("-"*16)
# push the data
self.output.put('\n'.join(buf))
if__name__=="__main__":
description="This script subscribes to the conference event package published by the specified SIP target. If a SIP target is not specified, it will subscribe to its own address. It will then interprete PIDF bodies contained in NOTIFYs and display their meaning. 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).")