# Asterisk Project : MobileStatus Application

Added by mdavenport , edited by mdavenport on Aug 31, 2010

chan_mobile also registers an application named MobileStatus. You can use this in your Dialplan to determine the 'state' of a device.
For example, suppose you wanted to call dave's extension, but only if he was in the office. You could test to see if his mobile phone was attached to Asterisk, if it is dial his extension, otherwise dial his mobile phone.

    exten => 40,1,MobileStatus(dave,DAVECELL)
    exten => 40,2,GotoIf($["${DAVECELL}" = "1"]?3:5)
    exten => 40,3,Dial(ZAP/g1/0427466412,45,tT)
    exten => 40,4,Hangup
    exten => 40,5,Dial(SIP/40,45,tT)
    exten => 40,6,Hangup

MobileStatus sets the value of the given variable to :-

- 1 = Disconnected. i.e. Device not in range of Asterisk, or turned off etc etc
- 2 = Connected and Not on a call. i.e. Free
- 3 = Connected and on a call. i.e. Busy