Issue with Dial

I have dialplan as

exten => 4000,1,Dial(SIP/100,20)
exten => 4000,n,Dial(SIP/101,20)
exten => 4000,n,Dial(SIP/102,20)
exten => 4000,n,Dial(SIP/103,20)
exten => 4000,n,Agi(agi://host:port/hello.agi)
exten => 4000,n,Goto(4000,1)

if I test
exten => 4000,n,Agi(agi://host:port/hello.agi)
alone it works i.e. hello.agi gets executed.

It also works if none of the Dial() are responded i.e. if nobody picks up the phone then hello.agi is executed.

But if any one Dial is responsed e.g. if SIP/101 picks the phone, then hello.agi is not called.

Is it that once Dial() is called controll is lost. What is the solution to this?
I want to call a AGI code once somebody picks up the phone and record who picked up the phone.

If a device dialed through Dial answers no more extension priorities are executed; you may use the M option of the Dial flag parameter to execute a macro upon the connection of the call.

Cheers.

Marco Bruni
www.marcobruni.net

asterisk cdr is an option you can use this with a mysql database where you can search for calls and see who answered the call. look at statistics and pdf downloading

areski.net/areski/index.php? … &Itemid=54