Link to home
Start Free TrialLog in
Avatar of Muhajreen
Muhajreen

asked on

Checking for extensions in use in Asterisk

Hello experts,

In an Asterisk 1.6.2 environment, I want to check for an extension if it's busy before paging it. I have found this code in extensions.conf sample, but it didn't work. When I page an extension while it's in a call, the other call becomes on hold and page is auto answered immediately.


[page]

exten => _*71XX,1,Macro(page,SIP/${EXTEN:2})

[macro-page]
;
; Paging macro:
;
;       Check to see if SIP device is in use and DO NOT PAGE if they are
;
;   ${ARG1} - Device to page

exten => s,1,ChanIsAvail(${ARG1},s)                     ; s is for ANY call
exten => s,n,GoToIf($[${AVAILORIGCHAN} = ""]?fail:autoanswer)
exten => s,n(autoanswer),Set(_ALERT_INFO="RA")                  ; This is for the PolyComs
exten => s,n,SIPAddHeader(Call-Info: Answer-After=0)    ; This is for the Grandstream, Snoms, and Others
exten => s,n,NoOp()                                     ; Add others here and Post on the Wiki!!!!
exten => s,n,Dial(${ARG1})
exten => s,n(fail),Hangup

Any help?

Avatar of jfaubiontx
jfaubiontx
Flag of United States of America image

The problem is that call waiting is available. When the code checks to see if the channel is available, the reponse is sure I have more lines available. The the auto answer on message happily puts the call on hold and auto answers the incoming line. One way two fix it is to disable the call waiting feature. This way the phone reports the channel as unavailable. Depending on the model of phone there may be more ways to do this. What phones are you using?
ASKER CERTIFIED SOLUTION
Avatar of nauliv
nauliv
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Muhajreen
Muhajreen

ASKER

Thank you for the great new feature of Asterisk 1.6 ! And sorry for the delay.

Actually I have tried the following:

exten => _1[012]X,1,NoOp(The status of ${EXTEN} is ${DEVICE_STATE(SIP/${EXTEN})})
same => n,Dial(SIP/${EXTEN},60)

But always when an extension (ie. 118) is in a call, and on other extension dials 118, I get that:

The status of 118 is NOT_INUSE

So what is the problem?
I'll ask again, what phone are you using?
Can you post the sip.conf for this extension?
Can you post the sip.conf for this extension?
I am using Linksys SPA942.

[118]
context=full
callerid="Muhajreen" <118>
type=friend
secret=xxxxx
host=dynamic
mailbox=118@default
qualify=yes
deny=0.0.0.0/0.0.0.0
permit=192.168.99.118/255.255.255.255
allow=ulaw
canreinvite=no
callgroup=1
pickupgroup=1
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
PS: don't forget to do a "sip reload" at the console after the changes :)
Great ! callcounter=yes has solved it ! Thank you.

I will post another question soon regarding paging only NOT_INUSE multiple extensions.