Have you looked at Dial&#39;s g option ?<br>&quot;<strong>g</strong>: When the called party hangs up, exit to execute more commands in the current context.&quot;