My agi code dose not execute in h extension

Hi friends.
I have a survey module but I cant execute it correctly in h extension.
when i use the survey module like that and directly:


exten => survey,1,Noop()
exten => survey,n,Dial(local/1000@ext-queues,g)
exten => survey,n,agi(senarios/survey.php)

it works correctly.

but when i use it in h extension:

exten => 6000,1,Set(flag=0)
exten => 6000,n,AGI(exp.php)
exten => 6000,n,ExecIf($[“${flag}” = “1”]?Goto(ivr-3,s,1):Goto(ivr-2,s,1))
exten => 6000,n,Hangup()

exten => 6001,1,Noop()
exten => 6001,n,AGI(exp2.php)
exten => 6001,n,Hangup()

; Handle call hangup
exten => h,1,Noop(Call ended, executing post-call scripts)
exten => h,n,AGI(senarios/survey.php)
exten => h,n,AGI(senarios/sms.php)
exten => h,n,Hangup()

it dose not work.

based on the logs it execute:
– Executing [h@context:2] AGI(“SIP/TEST-IN-00000014”, “senarios/survey.php”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/senarios/survey.php
– <SIP/TEST-IN-00000014>AGI Script senarios/survey.php completed, returning 0

but actually after the call ended, the call hangs up immediatly and nothing gonna happen and the caller dosnt hear any thing and cant enter its point.

the sms agi executes correctly when caller has direct call to a operator but when the call follows to the queue, the sms agi dose not execute too.

what should i do?

That’s how the ‘h’ extension works. It is executed when the call has been hung up. The call is gone at that point. You can’t play audio, communicate with them, nothing.

so what can i do to execute the survey module?

Train you agents to sense when the caller is about to hang up, and be the first one to hang up, or record the caller ID and originate a call back to the caller. In both cases, I imagine the caller will, almost certainly, either hang up on the survey, or give a very poor rating because of the pressure to complete the survey.

If this is a business caller, the caller ID may be the pilot number, so you may get their switchboard operator, if you call back.

(I don’t understand the basis of your misunderstanding here. It should be obvious that there is no longer a caller to speak to.)

On Saturday 22 June 2024 at 13:24:54, saminab via Asterisk Community wrote:

so what can i do to execute the survey module?

Ask your callers (announcement at the beginning of the call) to stay on the
line after speaking with the agent, because you would like them to provide
feedback about the call.

I am familiar with this from several business providers, especially utility
companies such as gas, electricity, water, but also occasionally banks.

Otherwise, as david551 points out, if you let the dialplan get to the h
extension, the call has been hung up and the other party has disappeared.


I still maintain the point that designing a monolithic kernel in 1991 is a
fundamental error. Be thankful you are not my student. You would not get a
high grade for such a design :slight_smile:

  • Andrew Tanenbaum to Linus Torvalds

                                                Please reply to the list;
                                                      please *don't* CC me.
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.