def test_from_dict(self): command_class = CTICommandClass(self.class_name, None, None) command = command_class.from_dict(self.msg) self.assertEqual(command.commandid, self.commandid) self.assertEqual(command.command_class, self.class_name)
def test_match_message_when_match_fun_false(self): match_fun = Mock() match_fun.return_value = False command_class = CTICommandClass(self.class_name, match_fun, None) self.assertFalse(command_class.match_message({})) self.assertFalse(command_class.match_message({'class': self.class_name}))
def test_register_callback(self): command_class = CTICommandClass(self.class_name, None, None) command = command_class.from_dict({'class': 'callback_test'}) self.assertEqual(command.callbacks_with_params(), []) function = Mock() command_class.register_callback_params(function) command = command_class.from_dict({'class': 'callback_test'}) self.assertEqual(len(command.callbacks_with_params()), 1)
def _new_class(function_name, value): def match(msg): return msg['function'] == function_name and msg['value'] == value def parse(msg, command): command.target = msg.get('target') return CTICommandClass('featuresput', match, parse)
def _new_class(enable_name, enable_value, destination_name): def match(msg): return (msg['function'] == 'fwd' and enable_name in msg['value'] and msg['value'][enable_name] == enable_value) def parse(msg, command): command.destination = msg['value'][destination_name] return CTICommandClass('featuresput', match, parse)
def test_callback_memory_usage(self): command_class = CTICommandClass(self.class_name, None, None) class Test(object): def __init__(self): command_class.register_callback_params(self.parse) def parse(self): pass command = command_class.from_dict({'class': 'callback_test'}) def run_test(): self.assertEqual(len(command.callbacks_with_params()), 0) test_object = Test() self.assertEqual(len(command.callbacks_with_params()), 1) test_object.parse() run_test() self.assertEqual(len(command.callbacks_with_params()), 0)
def test_deregister_callback_wrapped(self): command_class = CTICommandClass(self.class_name, None, None) command = command_class.from_dict({'class': 'callback_test'}) function_1 = lambda: None function_2 = lambda: None command_class.register_callback_params(function_1) command_class.register_callback_params(function_2) command_class.deregister_callback(command.callbacks_with_params()[0][0]) callbacks = command.callbacks_with_params() self.assertEqual(len(callbacks), 1) self.assertEqual(weak_method.WeakCallable(function_2), callbacks[0][0])
# -*- coding: utf-8 -*- # Copyright (C) 2007-2014 Avencall # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/> from xivo_cti.cti.cti_command import CTICommandClass Logout = CTICommandClass('logout', None, None) Logout.add_to_registry()
# Copyright (C) 2007-2014 Avencall # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/> from xivo_cti.cti.cti_command import CTICommandClass def _match(msg): return msg['command'] == 'queueremove' def _parse(msg, command): command.member = msg.get('member') command.queue = msg.get('queue') QueueRemove = CTICommandClass('ipbxcommand', _match, _parse) QueueRemove.add_to_registry()
# -*- coding: utf-8 -*- # Copyright (C) 2007-2014 Avencall # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/> from xivo_cti.cti.cti_command import CTICommandClass def _parse(msg, command): command.company = msg['company'] command.ident = msg['ident'] command.userlogin = msg['userlogin'] command.xivo_version = msg['xivoversion'] LoginID = CTICommandClass('login_id', None, _parse) LoginID.add_to_registry()
# -*- coding: utf-8 -*- # Copyright (C) 2007-2014 Avencall # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/> from xivo_cti.cti.cti_command import CTICommandClass CancelTransfer = CTICommandClass('cancel_transfer', None, None) CancelTransfer.add_to_registry()
# -*- coding: utf-8 -*- # Copyright (C) 2007-2014 Avencall # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/> from xivo_cti.cti.cti_command import CTICommandClass CompleteTransfer = CTICommandClass('complete_transfer', None, None) CompleteTransfer.add_to_registry()
def _new_class(function_name): def match(msg): return msg['function'] == function_name return CTICommandClass('getlist', match, _parse)
# Copyright (C) 2014 Avencall # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/> from xivo_cti.cti.cti_command import CTICommandClass def _parse_search(msg, command): command.pattern = msg.get('pattern') PeopleSearch = CTICommandClass('people_search', match_fun=None, parse_fun=_parse_search) PeopleSearch.add_to_registry() PeopleHeaders = CTICommandClass('people_headers', match_fun=None, parse_fun=None) PeopleHeaders.add_to_registry()
# -*- coding: utf-8 -*- # Copyright (C) 2007-2014 Avencall # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/> from xivo_cti.cti.cti_command import CTICommandClass def _parse(msg, command): command.number = msg['number'] AttendedTransfer = CTICommandClass('attended_transfer', None, _parse) AttendedTransfer.add_to_registry()
# -*- coding: utf-8 -*- # Copyright (C) 2007-2014 Avencall # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/> from xivo_cti.cti.cti_command import CTICommandClass GetSwitchboardDirectoryHeaders = CTICommandClass('get_switchboard_directory_headers', None, None) GetSwitchboardDirectoryHeaders.add_to_registry()
# -*- coding: utf-8 -*- # Copyright (C) 2007-2014 Avencall # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/> from xivo_cti.cti.cti_command import CTICommandClass Hangup = CTICommandClass('hangup', None, None) Hangup.add_to_registry()
# -*- coding: utf-8 -*- # Copyright (C) 2007-2014 Avencall # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/> from xivo_cti.cti.cti_command import CTICommandClass def _parse(msg, command): command.unique_id = msg['unique_id'] Answer = CTICommandClass('answer', None, _parse) Answer.add_to_registry()
# -*- coding: utf-8 -*- # Copyright (C) 2013-2014 Avencall # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/> from xivo_cti.cti.cti_command import CTICommandClass SubscribeToQueuesStats = CTICommandClass('subscribetoqueuesstats', None, None) SubscribeToQueuesStats.add_to_registry()
# -*- coding: utf-8 -*- # Copyright (C) 2007-2014 Avencall # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/> from xivo_cti.cti.cti_command import CTICommandClass def _parse(msg, command): command.variables = msg.get('infos', {}).get('variables', {}) CallFormResult = CTICommandClass('call_form_result', None, _parse) CallFormResult.add_to_registry()
# -*- coding: utf-8 -*- # Copyright (C) 2007-2014 Avencall # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/> from xivo_cti.cti.cti_command import CTICommandClass GetSwitchboardDirectoryHeaders = CTICommandClass( 'get_switchboard_directory_headers', None, None) GetSwitchboardDirectoryHeaders.add_to_registry()
# -*- coding: utf-8 -*- # Copyright (C) 2015 Avencall # SPDX-License-Identifier: GPL-3.0+ from xivo_cti.cti.cti_command import CTICommandClass def _parse(msg, command): command.status = msg.get('status') StartTLS = CTICommandClass('starttls', None, _parse) StartTLS.add_to_registry()
# -*- coding: utf-8 -*- # Copyright (C) 2007-2014 Avencall # SPDX-License-Identifier: GPL-3.0+ from xivo_cti.cti.cti_command import CTICommandClass def _match(msg): return msg['command'] == 'dial' def _parse(msg, command): command.destination = msg['destination'] Dial = CTICommandClass('ipbxcommand', _match, _parse) Dial.add_to_registry()
# -*- coding: utf-8 -*- # Copyright (C) 2007-2014 Avencall # SPDX-License-Identifier: GPL-3.0+ from xivo_cti.cti.cti_command import CTICommandClass def _match(msg): return msg['command'] == 'agentlogout' def _parse(msg, command): command.agent_id = msg.get('agentids') AgentLogout = CTICommandClass('ipbxcommand', _match, _parse) AgentLogout.add_to_registry()
# -*- coding: utf-8 -*- # Copyright (C) 2007-2014 Avencall # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/> from xivo_cti.cti.cti_command import CTICommandClass def _parse(msg, command): command.unique_id = msg['unique_id'] ResumeSwitchboard = CTICommandClass('resume_switchboard', None, _parse) ResumeSwitchboard.add_to_registry()
command.source = msg.get('source') command.source_entry_id = msg.get('source_entry_id') command.contact_infos = msg.get('contact_infos') def _parse_personal_contact_raw(msg, command): command.source = msg.get('source') command.source_entry_id = msg.get('source_entry_id') def _parse_import_personal_contacts_csv(msg, command): command.csv_contacts = msg.get('csv_contacts') PeopleSearch = CTICommandClass('people_search', match_fun=None, parse_fun=_parse_search) PeopleSearch.add_to_registry() PeopleHeaders = CTICommandClass('people_headers', match_fun=None, parse_fun=None) PeopleHeaders.add_to_registry() PeopleFavorites = CTICommandClass('people_favorites', match_fun=None, parse_fun=None) PeopleFavorites.add_to_registry() PeopleSetFavorite = CTICommandClass('people_set_favorite', match_fun=None,
# Copyright (C) 2007-2014 Avencall # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/> from xivo_cti.cti.cti_command import CTICommandClass def _match(msg): return msg['command'] == 'queueadd' def _parse(msg, command): command.member = msg.get('member') command.queue = msg.get('queue') QueueAdd = CTICommandClass('ipbxcommand', _match, _parse) QueueAdd.add_to_registry()
# Copyright (C) 2007-2014 Avencall # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/> from xivo_cti.cti.cti_command import CTICommandClass def _match(msg): return msg['command'] == 'queuepause' def _parse(msg, command): command.member = msg.get('member') command.queue = msg.get('queue') QueuePause = CTICommandClass('ipbxcommand', _match, _parse) QueuePause.add_to_registry()
# -*- coding: utf-8 -*- # Copyright (C) 2007-2015 Avencall # SPDX-License-Identifier: GPL-3.0+ from xivo_cti.cti.cti_command import CTICommandClass def _parse(msg, command): command.size = int(msg['size']) History = CTICommandClass('history', None, _parse) History.add_to_registry()
# -*- coding: utf-8 -*- # Copyright 2007-2017 The Wazo Authors (see the AUTHORS file) # SPDX-License-Identifier: GPL-3.0+ from xivo_cti.cti.cti_command import CTICommandClass def _parse_login_capas(msg, command): command.capaid = int(msg['capaid']) command.state = msg['state'] LoginCapas = CTICommandClass('login_capas', None, _parse_login_capas) LoginCapas.add_to_registry() def _parse_login_id(msg, command): command.company = msg['company'] command.ident = msg['ident'] command.userlogin = msg['userlogin'] # In wazo 17.16 the field was changed from xivoversion to wazoversion command.xivo_version = msg.get('wazoversion') or msg.get('xivoversion') LoginID = CTICommandClass('login_id', None, _parse_login_id) LoginID.add_to_registry() def _parse_login_pass(msg, command): command.password = msg['password']
# -*- coding: utf-8 -*- # Copyright (C) 2007-2014 Avencall # SPDX-License-Identifier: GPL-3.0+ from xivo_cti.cti.cti_command import CTICommandClass def _match(msg): return msg['command'] == 'listen' def _parse(msg, command): command.destination = msg['destination'] Listen = CTICommandClass('ipbxcommand', _match, _parse) Listen.add_to_registry()
# -*- coding: utf-8 -*- # Copyright (C) 2007-2014 Avencall # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/> from xivo_cti.cti.cti_command import CTICommandClass def _parse(msg, command): command.queue_name = msg['queue_name'] HoldSwitchboard = CTICommandClass('hold_switchboard', None, _parse) HoldSwitchboard.add_to_registry()
# -*- coding: utf-8 -*- # Copyright (C) 2007-2014 Avencall # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/> from xivo_cti.cti.cti_command import CTICommandClass def _parse(msg, command): command.pattern = msg.get('pattern') Directory = CTICommandClass('directory', None, _parse) Directory.add_to_registry()
# -*- coding: utf-8 -*- # Copyright (C) 2007-2014 Avencall # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/> from xivo_cti.cti.cti_command import CTICommandClass def _parse(msg, command): command.invitee = msg['invitee'] InviteConfroom = CTICommandClass('invite_confroom', None, _parse) InviteConfroom.add_to_registry()
# Copyright (C) 2007-2014 Avencall # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/> from xivo_cti.cti.cti_command import CTICommandClass def _match(msg): return msg['command'] == 'agentlogin' def _parse(msg, command): command.agent_phone_number = msg.get('agentphonenumber') command.agent_id = msg.get('agentids') AgentLogin = CTICommandClass('ipbxcommand', _match, _parse) AgentLogin.add_to_registry()
# -*- coding: utf-8 -*- # Copyright (C) 2007-2014 Avencall # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/> from xivo_cti.cti.cti_command import CTICommandClass def _match(msg): return msg['command'] == 'listen' def _parse(msg, command): command.destination = msg['destination'] Listen = CTICommandClass('ipbxcommand', _match, _parse) Listen.add_to_registry()
# -*- coding: utf-8 -*- # Copyright (C) 2007-2014 Avencall # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/> from xivo_cti.cti.cti_command import CTICommandClass def _match(msg): return msg['command'] == 'dial' def _parse(msg, command): command.destination = msg['destination'] Dial = CTICommandClass('ipbxcommand', _match, _parse) Dial.add_to_registry()
# -*- coding: utf-8 -*- # Copyright (C) 2015 Avencall # SPDX-License-Identifier: GPL-3.0+ from xivo_cti.cti.cti_command import CTICommandClass def _parse(msg, command): voicemail = msg['voicemail'] if not isinstance(voicemail, basestring): raise ValueError('expected basestring: was {}'.format(type(voicemail))) if not voicemail.isalnum(): raise ValueError( 'expected alphanumeric string: was {}'.format(voicemail)) command.voicemail_number = voicemail BlindTransferVoicemail = CTICommandClass('blind_transfer_voicemail', None, _parse) AttendedTransferVoicemail = CTICommandClass('attended_transfer_voicemail', None, _parse) BlindTransferVoicemail.add_to_registry() AttendedTransferVoicemail.add_to_registry()
# -*- coding: utf-8 -*- # Copyright (C) 2007-2014 Avencall # SPDX-License-Identifier: GPL-3.0+ from xivo_cti.cti.cti_command import CTICommandClass def _parse(msg, command): command.number = msg['number'] DirectTransfer = CTICommandClass('direct_transfer', None, _parse) DirectTransfer.add_to_registry()
# # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/> from xivo_cti.cti.cti_command import CTICommandClass def _parse_search(msg, command): command.pattern = msg.get('pattern') PeopleSearch = CTICommandClass('people_search', match_fun=None, parse_fun=_parse_search) PeopleSearch.add_to_registry() PeopleHeaders = CTICommandClass('people_headers', match_fun=None, parse_fun=None) PeopleHeaders.add_to_registry()
def _new_class(message_name, parse_fun): def match(msg): return msg['message'] == message_name return CTICommandClass('subscribe', match, parse_fun)
# -*- coding: utf-8 -*- # Copyright (C) 2015-2016 Avencall # SPDX-License-Identifier: GPL-3.0+ import uuid from xivo_cti.cti.cti_command import CTICommandClass def _check_valid_uuid(value): uuid.UUID(value) return value def _parse(msg, command): command.alias = msg['alias'] command.remote_xivo_uuid = _check_valid_uuid(msg['to'][0]) command.remote_user_uuid = _check_valid_uuid(msg['to'][1]) command.text = msg['text'] Chat = CTICommandClass('chitchat', None, _parse) Chat.add_to_registry()
# -*- coding: utf-8 -*- # Copyright (C) 2007-2014 Avencall # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/> from xivo_cti.cti.cti_command import CTICommandClass def _parse(msg, command): command.pattern = msg.get('pattern') SwitchboardDirectorySearch = CTICommandClass('switchboard_directory_search', None, _parse) SwitchboardDirectorySearch.add_to_registry()
# -*- coding: utf-8 -*- # Copyright (C) 2007-2014 Avencall # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/> from xivo_cti.cti.cti_command import CTICommandClass def _parse(msg, command): command.availstate = msg['availstate'] Availstate = CTICommandClass('availstate', None, _parse) Availstate.add_to_registry()