Checking status of a cell phone

Home » Asterisk Users » Checking status of a cell phone
Asterisk Users 7 Comments


I am looking for a way to check the status of a cell phone. Found one way that worked for me and would like to have some feedback or suggestion of improvments.

Below example is for a “Swedish” cell phone, dont know if it works in the same way for other countries.

I could define “redirecting” numbers for 3 traffic cases when u dial my mobile (073-302 59 75):
NOT_INUSE call forward to A
INUSE call forward to B in my case 010-602 4975
UNAVAILABLE call forward to C in my case 010-602 4976

From manager:
Action: OriginaternChannel: OOH323/00733025975@AvayarnExten: 0106024000rnContext: inputinterior.sernPriority: 1rnTimeout: 1000rnCallerID: 106024000rnrn
DBPutrnFamily: DSrnKey: 0733025975rnVal: NOT_INUSErnrn

Wait a second…

Action: DBGetrnFamily: DSrnKey: 0733025975rnrn

In the dialplan:
exten => 0106024975,1,Set(DB(DS/0733025975)=INUSE)
exten => 0106024975,n,Hangup()

exten => 0106024976,1,Set(DB(DS/0733025975)=UNAVAILABLE)
exten => 0106024976,n,Hangup()

Just a short call to my cell phone, to se if i get anything back, my cell phone doesn’t even ring.
Wait a second if the call is redirected, then check to se if the status has changed from NOT_INUSE to something else.

Dont know if it is a stupid idea, but it worked on my cell phone, and the switchboard girls was very happy to be able “to ask” my cell phone “what I am doing”
Most of the day i am INUSE so they dont need to transfer calls to me ehen they know I am INUSE.

Ofc there is some delay from asking to getting the answer, but as the girls said, we could live with the delay, 2seconds compared to be “blind” is nothing.

7 thoughts on - Checking status of a cell phone

  • I’d like to check I understood: Your Asterisk server is connected to a
    landline and can call your cellephone (073-302 59 75).

    When a call comes in from the landline, Asterisk checks whether your
    cellphone is available and redirects the call; If not available, it
    calls a landline number (010-602 4975). If this landline number is not
    available, it tries a third number (010-602 4976)?

    Is the AMI code below enough to check if the cellphone is

  • Setup as below:

    Celluar Network – E1 – Avaya – OOH323 – Asterisk

    It works like this, some1 (we can call her Åsa) wants to know if i am
    avaiable (my cell phone 073-302 59 75 is NOT_INUSE)
    She have a web-app (just a simple form), where she enter my extension and
    hits enter.
    The web-app originates the call as i wrote and waits for the “status” then
    ofc presents it to Åsa.

    I was writing the app (probably the worst written code i have done so dont
    ask me to post it) late thursday and let Åsa use it on Friday.
    And yes, the AMI code was enough, everytime she should transfer a call to me
    or just call me , she used the web-app first, and she was very happy.
    When she saw that I was INUSE she sent me a mail that mr X has been looking
    for me, i got the mail while I was talking in the phone so I know that
    she used the web-app to determine my status, not just transfering the call.

  • Thanks for the tip.

    So here’s how it works:
    1. The web app calls a script that uses AMI + Originate to send a call
    to the Avaya PBX
    2. Avaya is able to check that a number (cellphone in this case) is
    busy and calls a different number in Asterisk to indicate the status
    through a value in the DB
    3. The web script reads the value of DS/0733025975 and displays the

  • I thought the way you handled things, is that Asterisk would call your
    cellphone through the Avaya PBX just to check whether the cellphone is
    in_use/busy. At what point does the cellphone call Avaya or Asterisk

  • I was a little unclear, it is not the cell phone that does the call-back, it
    is the cell-phone-network.
    We can define 3 traffic-cases per cell-phone:
    1) If cell-phone wont anser in x seconds call number a.
    2) if cell-phone is busy call number b.
    3) if cell-phone is unavailable call number c.

    From ami, a set db entry 0733025975 = 0 (Idle)
    from ami, make a short call (1 second) to 0733025975
    wait 0.5 second
    check the db entry for 0733025975

    when i wait for 0.5 second and my cell phone is busy, i will get a call to
    number “b”
    I catch that call in dialplan and set 0733025975 = 1 (InUse)
    Ofc, if cell-phone is unavailable, i will get call to number “c”
    I catch that call in dialplan and set 0733025975 = 4 (Unavailable)

  • hi,

    if you only want that by any how you reachable , so you just make a simple
    DIALPLAN and do your work with DIal-plan, just DIAL those 3 numbers
    simuntenously, by seperating ‘&’, in that your cell number and other phone
    rings simultenously , and you can pick any of them other are automatically
    disconnected .