def derive_sip_user_id(self, did): did = BroadsoftRequest.convert_phone_number(number=did) if not did: raise ValueError( "can't run BroadsoftObject.derive_sip_user_id without a value for did" ) if not self.broadsoftinstance.default_domain: raise ValueError( "can't run BroadsoftObject.derive_sip_user_id without a value for default_domain" ) return did + '@' + self.broadsoftinstance.default_domain
def prep_attributes(self): if self.broadsoftinstance is None: self.broadsoftinstance = self.derive_broadsoft_instance( instance=self.instance) if hasattr(self, 'did') and self.did: self.did = BroadsoftRequest.convert_phone_number(number=self.did) if hasattr(self, 'sip_user_id') and self.did and self.sip_user_id is None: self.sip_user_id = self.derive_sip_user_id(did=self.did) if self.xml and type(self.xml) is str: self.xml = ET.fromstring(self.xml) if hasattr(self, 'kname') and hasattr( self, 'email') and self.kname is not None and self.email is None: self.email = self.kname + '@mit.edu'