Christian B
2006-Jun-17 02:00 UTC
[Asterisk-Users] hanging up call after launching a script, script should continue independently
hello! i'm trying to implement a callback feature. to accomplish this, i've written a python script(callback.agi) that starts another script as a independent process(with spawnl), without asterisk waiting for the other script (callback_dead.sh) to finish before it goes to the next extension. running it on the commandline seems to work, the script starts the other script and finishes(process dies), the second script, which assignment is to sleep for a while and create a callfile then, is alive until it has run completely. while this is working as expected when started from the commandline it doesn't work as it should when it is called with the agi/deadagi-command from the asterisk-dialplan. my dialplan looks like this: exten => X,1,DeadAgi(callback.agi,${CALLERIDNUM},${SERVICENO}) exten => X,n,Hangup So asterisk should start the callback.agi(which calls the second script) and then do the hangup(so the caller hears a status and has a free channel on his (pstn-)phone to receive the callback). since the second script is called as a individual process, i'd expect that asterisk does the hangup as soon as the first script has finished, but it waits till the second script has finished too (which sleeps for 15s). Also doing a "EXEC HANGUP" doesn't work, as the channel has not been answered(Which is a requirement for the callback functionality). Is there a way to let asterisk run the first script without waiting for the second script to finish? see the attachment (first script is python, second is bash because i started with bash, changed the first script to python but was too busy to adapt the second too). regards Christian Benke -------------- next part -------------- A non-text attachment was scrubbed... Name: callback.agi Type: application/octet-stream Size: 318 bytes Desc: not available Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20060617/9705bef7/callback.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: callback_dead.sh Type: application/x-shellscript Size: 846 bytes Desc: not available Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20060617/9705bef7/callback_dead.bin