Limit on calls through me

Hi Everyone,
I want to limit the call to one…means if the call is going on i should not connect another call to that(No Call Waiting).
i found something for that…i.e. Asterisk Groups but i’m having some problem.

I read one example somewhere that when the call arrives before connecting the call, create one group with the called person number(dnid) and check how many counts are there.If the count is <=1 then connect the call or else play the busy tone.
exten => 200,1,Set(Group()=mygroup)

exten => 200,2,GoToIf($[${GROUP_COUNT(mygroup)} >1] ? : 103)

exten => 200,3,Dial(SIP/5186)

exten => 200,103,Busy

SO I also want the same thing but i’m not getting how to write the same in the php script I want this whole thing to be done in the script

I’m using asterisk 1.4.24 and phpagi-2.14

please any suggestions…

thank you