Hold caller to extension without using Dial, then do something on hangup

I have an extension in extensions.ael that when called, sends a system message to socat, which is listening on the network on a particular port.

So the client message is sent for Asterisk like this, for example:

System(echo “mycommand_with_arguments 291 234 199” | netcat localhost 7777 );

The system message passes quickly. I need to be able to keep the caller on the line until the caller him/herself hangs up and upon which, send another system message from Asterisk.

Here it is in pseudo AEL code:

201 => {   
   System(echo "mycommand_with_arguments 291 234 199" | netcat localhost 7777 );
   goto loopstart label until the caller hangs up then continue on;      
   System(echo "my_other_command_with_argument 999" | netcat localhost 7777 ); 

Hope someone can help.


The second System needs to be done in a hangup extension.

You don’t have to loop, you can just do a very long wait.

Thanks very much, I got it to work.

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