class TestObihaiHelper(TestCase): def test_add_caller_to_history(self): config_folder = "./" self.helper = ObihaiHelper(config_folder) self.helper.add_caller_to_history("port2", "11234567891", "John Smith", 1, "12:23:45 06/21") self.helper.add_caller_to_history("port2", "11234567890", "John Smith", 1, "12:23:45 06/22") self.helper.add_caller_to_history("port2", "11234567890", "John Smith", 1, "12:23:45 06/23") self.helper.add_caller_to_history("port2", "11234567890", "John Smith", 1, "12:23:45 06/24")
def test_add_caller_to_history(self): config_folder = "./" self.helper = ObihaiHelper(config_folder) self.helper.add_caller_to_history("port2", "11234567891", "John Smith", 1, "12:23:45 06/21") self.helper.add_caller_to_history("port2", "11234567890", "John Smith", 1, "12:23:45 06/22") self.helper.add_caller_to_history("port2", "11234567890", "John Smith", 1, "12:23:45 06/23") self.helper.add_caller_to_history("port2", "11234567890", "John Smith", 1, "12:23:45 06/24")
def test_handle_incoming_data(self): config_folder = "./" self.helper = ObihaiHelper(config_folder) self.obiscan = ObihaiScan(self.helper) self.syslog = ObihaiSyslog(self.helper, self.obiscan) data_bad1 = "<7> [SLIC]:Slic#0 OFFsaf HOOK" data_bad2 = "<7> fdgdgf[SLIC]:Slic#0 OFFsaf HOOK" self.syslog.handle_incoming_data(data_bad1) self.syslog.handle_incoming_data(data_bad2) data_hook_status1 = "<7> [SLIC]:Slic#0 OFF HOOK" data_hook_status2 = "<7> [SLIC]:Slic#0 ONHOOK" self.syslog.handle_incoming_data(data_hook_status1) self.syslog.handle_incoming_data(data_hook_status2) data_inbound1 = "<7> [SLIC] CID to deliver: 'John Smith' 11234567890" data_inbound2 = "<7> [SLIC] CID to deliver: 'Smith John' 11234567890" self.syslog.handle_incoming_data(data_inbound1) self.syslog.handle_incoming_data(data_inbound2) data_outbound1 = "<7> CCTL:NewCallOn Term 10[1] ->11234567890,11234567890" data_outbound2 = "<7> CCTL:NewCallOn Term 10[1] ->+11234567890,+11234567890" self.syslog.handle_incoming_data(data_outbound1) self.syslog.handle_incoming_data(data_outbound2)
def test_format_phone_number(self): config_folder = "./" self.helper = ObihaiHelper(config_folder) self.obiscan = ObihaiScan(self.helper) phone_str = "1234567890" print(self.obiscan.format_phone_number(phone_str)) phone_str = "0111234567890" print(self.obiscan.format_phone_number(phone_str))
def __init__(self, config_folder): self.helper = ObihaiHelper(config_folder) self.helper.print(self.helper.log_level_info, "ObihaiMonitor: Starting Obihai Monitor") self.obiscan = ObihaiScan(self.helper) self.obiscan.scan_call_status() self.obiscan.start() self.syslog = ObihaiSyslog(self.helper, self.obiscan) while True: try: self.helper.print( self.helper.log_level_debug, "ObihaiMonitor: Start obihai syslog monitor loop") self.syslog.monitor() except Exception as e: self.helper.print(self.helper.log_level_error, "ObihaiMonitor: Exception: " + str(e))
def __init__(self, config_folder): self.helper = ObihaiHelper(config_folder) self.helper.print(self.helper.log_level_info, "ObihaiMonitor: Starting Obihai Monitor") self.obiscan = ObihaiScan(self.helper) self.obiscan.scan_call_status() self.obiscan.start() self.syslog = ObihaiSyslog(self.helper, self.obiscan) while True: try: self.helper.print(self.helper.log_level_debug, "ObihaiMonitor: Start obihai syslog monitor loop") self.syslog.monitor() except Exception as e: self.helper.print(self.helper.log_level_error, "ObihaiMonitor: Exception: " + str(e))
def test_get_caller_name_from_opencnam(self): config_folder = "./" self.helper = ObihaiHelper(config_folder) self.helper.get_caller_name_from_opencnam("11234567890")
def test_scan_full_system_status(self): config_folder = "./" self.helper = ObihaiHelper(config_folder) self.obiscan = ObihaiScan(self.helper) print(self.obiscan.scan_full_system_status())