def lambda_handler()

in CBHelper-dial/lambda_function.py [0:0]


def lambda_handler(event, context):
    print(str(event))
    CONFIG_SECRET= os.environ['CONFIG_SECRET']
    connect_config=json.loads(get_config(CONFIG_SECRET))
    CONNECT_INSTANCE_ID = connect_config['CONNECT_INSTANCE_ID']
    CONNECT_QUEUE_ID =connect_config['CONNECT_QUEUE_ID']
    CONTACT_FLOW_ID= connect_config['CONTACT_FLOW_ID']

    CONTACTS_TABLE= os.environ['CONTACTS_TABLE']

    phoneNumber = event['contacts']['phoneNumber']
    
    response = place_call(phoneNumber, CONTACT_FLOW_ID, CONNECT_INSTANCE_ID, CONNECT_QUEUE_ID)
    remove_contactId(phoneNumber,CONTACTS_TABLE)
    
    if(response):
        print("Valid response")
        validNumber= True
    else:
        print("Invalid response")
        validNumber=False

    return {'validNumber':validNumber }