ChanIsAvail doesnt work correctly

Hi all.
I want to detect that which user is free to forward the call to him.
I use the softphone (Eyebeam and X-Lite) to make the call. All of them are registered to asterisk.
Here is sip.conf

[101]
type=friend
username=101
secret=123456
context=from-sip
regexten=1234			; When they register, create extension 1234
host=dynamic			; This device needs to register
nat=yes			; X-Lite is behind a NAT router
canreinvite=no			; Typically set to NO if behind NAT
disallow=all
allow=gsm			; GSM consumes far less bandwidth than ulaw
allow=ulaw
allow=alaw

[102]
type=friend
username=102
secret=123456
context=from-sip
regexten=1234			; When they register, create extension 1234
host=dynamic			; This device needs to register
nat=yes			; X-Lite is behind a NAT router
canreinvite=no			; Typically set to NO if behind NAT
disallow=all
allow=gsm			; GSM consumes far less bandwidth than ulaw
allow=ulaw
allow=alaw

[103]
type=friend
username=103
secret=123456
context=from-sip
regexten=1234			; When they register, create extension 1234
host=dynamic			; This device needs to register
nat=yes			; X-Lite is behind a NAT router
canreinvite=no			; Typically set to NO if behind NAT
disallow=all
allow=gsm			; GSM consumes far less bandwidth than ulaw
allow=ulaw
allow=alaw

And here is dialplan :

exten => s,1,Set(index=1)
exten => s,n(checkavail),ChanIsAvail(SIP/10${index})
exten => s,n,NoOp("Chanel ${AVAILCHAN} has status : ${AVAILSTATUS}")
exten => s,n,GotoIf($[${AVAILSTATUS}=1]?dial)
exten => s,n,Set(index=$[${index}+1])
exten => s,n,GotoIf($[${index}>3]?allbusy)
exten => s,n,Goto(checkavail)

But the AVAILSTATUS variable isn’t 1 (Not in use)

    -- Executing [0@19001773:1] Goto("SIP/101-08870dd0", "Test|s|1") in new stack
    -- Goto (Test,s,1)
    -- Executing [s@Test:1] Set("SIP/101-08870dd0", "index=1") in new stack
    -- Executing [s@Test:2] ChanIsAvail("SIP/101-08870dd0", "SIP/101") in new stack
    -- Executing [s@Test:3] NoOp("SIP/101-08870dd0", ""Chanel SIP/101-08925b10 has status : 0"") in new stack
    -- Executing [s@Test:4] GotoIf("SIP/101-08870dd0", "0?dial") in new stack
    -- Executing [s@Test:5] Set("SIP/101-08870dd0", "index=2") in new stack
    -- Executing [s@Test:6] GotoIf("SIP/101-08870dd0", "0?allbusy") in new stack
    -- Executing [s@Test:7] Goto("SIP/101-08870dd0", "checkavail") in new stack
    -- Goto (Test,s,2)
    -- Executing [s@Test:2] ChanIsAvail("SIP/101-08870dd0", "SIP/102") in new stack
    -- Executing [s@Test:3] NoOp("SIP/101-08870dd0", ""Chanel SIP/102-088a5f30 has status : 0"") in new stack
    -- Executing [s@Test:4] GotoIf("SIP/101-08870dd0", "0?dial") in new stack
    -- Executing [s@Test:5] Set("SIP/101-08870dd0", "index=3") in new stack
    -- Executing [s@Test:6] GotoIf("SIP/101-08870dd0", "0?allbusy") in new stack
    -- Executing [s@Test:7] Goto("SIP/101-08870dd0", "checkavail") in new stack
    -- Goto (Test,s,2)
    -- Executing [s@Test:2] ChanIsAvail("SIP/101-08870dd0", "SIP/103") in new stack
    -- Executing [s@Test:3] NoOp("SIP/101-08870dd0", ""Chanel SIP/103-088db0d8 has status : 0"") in new stack
    -- Executing [s@Test:4] GotoIf("SIP/101-08870dd0", "0?dial") in new stack
    -- Executing [s@Test:5] Set("SIP/101-08870dd0", "index=4") in new stack
    -- Executing [s@Test:6] GotoIf("SIP/101-08870dd0", "1?allbusy") in new stack
    -- Goto (Test,s,8)
    -- Executing [s@Test:8] SayNumber("SIP/101-08870dd0", "10") in new stack
    -- <SIP/101-08870dd0> Playing 'digits/10' (language 'en')
    -- Executing [s@Test:9] SayNumber("SIP/101-08870dd0", "4") in new stack
    -- <SIP/101-08870dd0> Playing 'digits/4' (language 'en')

Could you tell me how to check out that what channel is free to DIAL?

Hi

Have a read of voip-info.org/wiki/view/Aste … hanIsAvail

you could use devstate function and that will show the status of the device

Ian