def given_a_configured_switchboard_with_an_operator_with_infos(step): switchboard_agents = ['{agent_number}@{context}'.format(**data) for data in step.hashes] agent_names = ['{firstname} {lastname}'.format(**data)] for data in step.hashes: user_helper.add_user_with_infos(data, step=step) for agent_name in agent_names: user_action_webi.switchboard_config_for_user(agent_name) queue_action_webi.add_or_replace_switchboard_queue('__switchboard', '3009', 'default', switchboard_agents) switchboard_queue = queue_helper.get_queue_with_name('__switchboard') switchboard_queue.joinempty = 'unavailable' switchboard_queue.leavewhenempty = 'unavailable' world.ws.queues.edit(switchboard_queue) queue_action_webi.add_or_replace_switchboard_hold_queue('__switchboard_hold', '3010', 'default') for data in step.hashes: if data.get('logged') == 'false': continue agent_name = '{firstname} {lastname}'.format(**data) agent_number = data['agent_number'] phone = step.scenario.phone_register.get_user_phone(agent_name) phone.call('*31{}'.format(agent_number)) common.wait_until(phone.is_hungup, tries=20) bus_helper.add_binding('switchboard_stats', 'collectd.switchboard', 'collectd')
def when_i_remove_agent_1_from_2(step, agent_number, queue_name): queue = queue_helper.get_queue_with_name(queue_name) agent_id = agent_helper.find_agent_id_with_number(agent_number) queue.agents.remove(agent_id) world.ws.queues.edit(queue) time.sleep(10)
def when_i_add_agent_1_to_2(step, agent_number, queue_name): queue = queue_helper.get_queue_with_name(queue_name) agent_id = agent_helper.find_agent_id_with_number(agent_number) queue.agents.append(agent_id) world.ws.queues.edit(queue) time.sleep(5)
def given_the_switchboard_is_configured_to_receive_a_maxium_of_n_call(step, n): switchboard_queue = queue_helper.get_queue_with_name('__switchboard') switchboard_queue.maxlen = n world.ws.queues.edit(switchboard_queue) asterisk_helper.send_to_asterisk_cli('queue reload')