#NEWLINE# def log_call( phone_number , gateway_session_id , backend = None ) : #NEWLINE# #INDENT# cleaned_number = strip_plus ( phone_number ) #NEWLINE# v = VerifiedNumber . by_extensive_search ( cleaned_number ) #NEWLINE# call = Call ( phone_number = cleaned_number , direction = INCOMING , date = datetime . utcnow ( ) , backend_api = ( backend . get_api_id ( ) if backend else None ) , backend_id = ( backend . couch_id if backend else None ) , gateway_session_id = gateway_session_id ) #NEWLINE# if v : #NEWLINE# #INDENT# call . domain = v . domain #NEWLINE# call . couch_recipient_doc_type = v . owner_doc_type #NEWLINE# call . couch_recipient = v . owner_id #NEWLINE# #UNINDENT# call . save ( )