I have the following issue using Asterisk.
When someone dials an extension, I execute a small AGI program, which works fine under normal circumstances.
The AGI program takes input from the caller (the number to dial), then it dials the number entered, etc.
When the call ends, it supposed to continue, asking the caller some other questions and waiting for input.
If the called person hangs up, the AGI program continues the execution normally, but if the caller hangs up first, the AGI programs stops its execution.
My question is, there is any way to make the AGI program continue even if either one of the parties or both hang up?
have you looked at DeadAGI ?
I tried DEADAGI as well, but the behavior is the same.
Short answer: No.
If you want to do somethig like this you will have to either program it into Asterisk to use a different Dial command that would not terminate both legs of a call, or you could write a simple web interface and have the call go through a meetme room and control the calling through that web interface.
I haven’t tried what you’d like to see happen here but I have a thought for you:
Try at your own risk.
In the end, you’re dealing with a shell program. The AGI process is probably being told to terminate by the parent process via a SIGHUP or SIGKILL. You can override how these signals are processed, depending on the language you’ve chosen to write it in, it may be simple. Catch the signal the Asterisk process is passing and do whatever cleanup you’d like to do before exiting.
A word of caution: attempting this will probably break something. For instance, interacting with the parent process that told you to die could spell disaster. I sincerely doubt there are any test cases that factor for one of us yahoos ignoring signals and keeping AGI programs running after they’re told to terminate. Zombie processes laying around may become a problem, too.
If you are trying to use the AGI to tell the callee something after the caller hangs up…an extra beware.
Another option would be to store values in astdb that trace the steps of your AGI such that you can go back with another process sometime later and finish up whatever was left undone. This method would be MUCH safer than the one described above.
Am I missing something here.
From your description :-
A calls B
A is asked questions correctly
Is this correct ?
A calls B
A is not asked questions, do you then want B to be asked them ?
Is this correct ?
I ask as you do say the caller is to be asked questions
Hi, even though I have just registered to get help for my own little issue I feel I can help you out on this one.
The solution for me was to work with fastAGI and to have an AGI server (basically a tcp server) doing all the job for you.
My * is executing a fastAGI on a Win2003 server where I have my application (c#) listening to the 4573 (default fastAGI port).
I am spawning a new thread for each incoming connection and as soon as the caller hangs up I can catch the event of the lost tcp connection to (in my case) write some proprietary cdrs in my DB.
This works very nicely and it’s much more powerful than using std:in/out on the * machine.
Hope that helped…
Per the Asterisk docs, Asterisk now sends SIGHUP to running AGI apps. If you don’t want your app to die you need to handle SIGHUP inside the app.
As baconbuttie said, i solved it using DEADAGI, it was a long time ago, but i want to “close” the thread for future reference, maybe some other people will find it helpful.
DEADAGI does not kill the TCP connection as FASTAGI does on Hangup.
Thanks to everybody.