#NEWLINE# def get_ivr_responses_from_touchforms_responses( call_log_entry , responses , app ) : #NEWLINE# #INDENT# '\n    responses is a list of XFormsResponse objects\n    app is the app from which the form came\n    ' #NEWLINE# ivr_responses = [ ] #NEWLINE# question_constraint_failed = False #NEWLINE# hang_up = False #NEWLINE# for response in responses : #NEWLINE# #INDENT# if ( response . status == 'validation-error' ) : #NEWLINE# #INDENT# question_constraint_failed = True #NEWLINE# call_log_entry . current_question_retry_count += 1 #NEWLINE# ivr_responses . append ( format_ivr_response ( response . text_prompt , app ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( response . status == 'http-error' ) : #NEWLINE# #INDENT# ivr_responses = [ ] #NEWLINE# hang_up = True #NEWLINE# break #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( responses . event . type == 'question' ) : #NEWLINE# #INDENT# ivr_responses . append ( format_ivr_response ( response . event . caption , app ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( response . event . type == 'form-complete' ) : #NEWLINE# #INDENT# hang_up = True #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return ( ivr_responses , question_constraint_failed , hang_up )