Survey after Hangup

Hello,
I’m new to Asterisk and I’m having trouble to manage an IVR for a survey after the hang up.
I have Asterisk 16.11.1 and FreePBX 15.0.16.75.
I managed to let it work when I set it as custom destination from FreePBX, but now I would like the following instructions should be executed when an operator hangs up:

[macro-survey]
exten => s,1,answer()
;this asks the first question (based on your recording) and stores them in variable
exten => s,n(question1),Read(answer1,enter-ext-of-person,1,1,2)
exten => s,n,GotoIf([ {answer1} < 4 ]?question2:question1)
;this asks the first question (based on your recording) and stores them in variable
exten => s,n(question2),Read(answer2,enter-ext-of-person,1,1,2)
exten => s,n,GotoIf([ {answer2} < 4 ]?finish:question1)
;this line puts the two answers together and separates them with a | symbol.
exten => s,n(finish),set(answer={answer1}|{answer2})
;this saves the answers into the CDR field of “userfield”
exten => s,n,Set(CDR(userfield)=${answer})
exten => s,n,hangup()

This context is saved into /etc/asterisk/extensions_override_freepbx.conf that should override the
/etc/asterisk/extensions_additional.conf behaviour.
I’ve tried to put the following into the [ext-local] dialplan:

exten => s,n,Set(CHANNEL(hangup_handler_push)=macro-survey,s,1);
or
exten => h,1,Goto(macro-survey,s,1)

But it doesn’t seem to work.
Can you help me? Thank you.

I don’t think it is going to be possible to answer this without knowledge of how FreePBX works, and this is not the right forum for that. For peer support, you want https://community.freepbx.org/

Note that the channel isn’t in a state in which Answer () would have any effect. I’m pretty sure that the same rule applies as for h extensions, namely you cannot send or receive media. Hangup handlers are supposed to be fast running, and anything that takes input from a human cannot be. Hangup handlers are subroutines, so naming one as a macro is, at best confusing.

The way of handling this requirement in plain Asterisk would be to use the “c” option on Queue, and put the IVR immediately after the call to Queue, possibly after testing for a normal completion of Queue.

Thank you for your hints! Can you please give me an example of queue with the “c” option?

same=> n, Queue(1234,c)
same=> n, .....