def insert_adv_user_full_infos(entries): users = list() for entry in entries: mailbox = entry.get('linenumber', None) exten = entry.get('linenumber', None) context = entry.get('context', None) ule_helper.delete_user_line_extension_voicemail(entry['firstname'], entry['lastname'], exten=exten, context=context, mailbox=mailbox) incall_helper.delete_incalls_with_did(entry['incall']) user = User() user.firstname = entry['firstname'] user.lastname = entry['lastname'] user.language = 'fr_FR' user.line = UserLine() user.line.context = entry['context'] user.line.number = entry['linenumber'] user.line.secret = entry.get('linesecret', '') user.voicemail = UserVoicemail() user.voicemail.name = '%s %s' % (entry['firstname'], entry['lastname']) user.voicemail.number = entry['voicemail'] user.incall = UserIncall() user.incall.exten = entry['incall'] user.incall.context = 'from-extern' users.append(user) world.ws.users.import_(users)
def _delete_extension_type(exten, extension_type, typeval): try: if extension_type == 'user': user_helper.delete_user(int(typeval)) elif extension_type == 'queue': queue_helper.delete_queues_with_number(exten) elif extension_type == 'group': group_helper.delete_groups_with_number(exten) elif extension_type == 'incall': incall_helper.delete_incalls_with_did(exten) elif extension_type == 'meetme': meetme_helper.delete_meetme_with_confno(exten) elif extension_type == 'outcall': dialpattern_helper.delete((typeval)) except ElementDeletionError as e: print "I tried deleting a type %s typeval %s but it didn't work." % (extension_type, typeval) print e
def _delete_extension_type(exten, extension_type, typeval): try: if extension_type == 'user': user_helper.delete_user(int(typeval)) elif extension_type == 'queue': queue_helper.delete_queues_with_number(exten) elif extension_type == 'group': group_helper.delete_groups_with_number(exten) elif extension_type == 'incall': incall_helper.delete_incalls_with_did(exten) elif extension_type == 'meetme': meetme_helper.delete_meetme_with_confno(exten) elif extension_type == 'outcall': dialpattern_helper.delete((typeval)) except ElementDeletionError as e: print "I tried deleting a type %s typeval %s but it didn't work." % ( extension_type, typeval) print e
def given_there_is_an_incall_group1_in_context_group2_to_the_queue_group3(step, did, context, dst_type, dst_name, cid_name, cid_num): caller_id = '"%s" <%s>' % (cid_name, cid_num) incall_helper.delete_incalls_with_did(did) incall_helper.add_incall(did, context, dst_type, dst_name, caller_id)
def given_there_is_an_incall_group1_in_context_group2_to(step, did, context, dst_type, dst_name): incall_helper.delete_incalls_with_did(did) incall_helper.add_incall(did, context, dst_type, dst_name)
def given_there_is_no_incall_in_context(step, did, context): incall_helper.delete_incalls_with_did(did, context)
def given_there_is_no_incall(step, did): incall_helper.delete_incalls_with_did(did)
def given_there_is_an_incall_group1_in_context_group2_to_the_queue_group3( step, did, context, dst_type, dst_name, cid_name, cid_num): caller_id = '"%s" <%s>' % (cid_name, cid_num) incall_helper.delete_incalls_with_did(did) incall_helper.add_incall(did, context, dst_type, dst_name, caller_id)
def given_there_is_an_incall_group1_in_context_group2_to( step, did, context, dst_type, dst_name): incall_helper.delete_incalls_with_did(did) incall_helper.add_incall(did, context, dst_type, dst_name)
def given_there_are_incalls_with_infos(step): for incall in step.hashes: did = incall['extension'] context = incall['context'] incall_helper.delete_incalls_with_did(did, context) _add_incall(did, context)