Limiting simultanous calls to SIP phones and mobil devices

Hi,
we have a rather old asterisk 1.2.7 running which is connected to a DeTeWe OpenCom 1010 PBX via a Digium TE205P Card.
Asterisk does the dialplan logic and holds the SIP phones while the other PBX has a lot of mobile DeCT phones and FAX devices.
In the Asterisk dialplan i do the following:
exten => 123,1,Dial(SIP/Foo&Zap/g2/500)
where SIP/Foo is the SIP phone of user Foo and Zap/g2/500 is his mobile phone. Now, if he has a call using his SIP phone and gets another, the mobile device is ringing, which is not what he wants. He only wants both devices ringing when not having a call and the other device being quiet if he has one whatever of his phones he is using.
I checked the configuration files and tried IsChanAvail(), but that did not seem to work.
Can someone give me a hint?

thanks in advance,
marcus

First thing you should do is update, then you can do

Example of using DEVICE_STATE for call-limit
Because call-limit is deprecated, sometimes you will need to make sure that, if an extension is in use, you will not call it.
The following dialplan entries make sure that extension 100 has only one call at a time.

exten => 100,1,ExecIf($[ ${DEVICE_STATE(SIP/${EXTEN})} = INUSE ]?Busy)
exten => 100,2,Dial(SIP/${EXTEN})

you have to use GROUP and GROUP_COUNT functions in order to implement the desired functionality

link: http://www.voip-info.org/wiki/view/Asterisk+func+group

HTH,
Ioan