[asterisk-users] get SIP extension status without calling it

Vieri rentorbuy at yahoo.com
Sun Dec 2 18:02:18 CST 2007


I'd like to add that "show hints" on * CLI displays
the following for ext 4053 tested below:

   4053                : SIP/4053            
State:Idle            Watchers  0

(it should be "unavailable" or something, but anyway,
ChanIsAvail reports an AVAILSTATUS of 0, ie. unknown)

--- Vieri <rentorbuy at yahoo.com> wrote:

> Thanks Richard but I think that ChanIsAvail must be
> buggy (based on some user comments in the wiki,
> although quite outdated).
> 
> I have the hint entry as you say (am using FreePBX
> and
> it's already there).
> 
> But whenever I call ChanIsAvail with the s option I
> always get:
> ${AVAILSTATUS} = 0 AST_DEVICE_UNKNOWN - "Unknown";
> channel is valid, but unknown state. 
> 
> I might be doing something wrong but here is the
> code:
> 
> [IVR-menu1]
> exten => s,1,Answer()
> (...)
> exten => s,n,Playback(welcome)
> exten => s,n,ChanIsAvail(SIP/4053|s)
> exten => s,n,NoOp(DEBUG: availstatus is
> ${AVAILSTATUS})
> 
> In extensions.conf I also have:
> exten => 4053,hint,SIP/4053
> 
> I'm using Astrisk 1.2. Is ChanIsAvail working well
> in
> 1.2?
> 
> As far as setting a time limit on a call in the
> queue
> is concerned, it doesn't sound "nice" for the caller
> to be dropped after a few rings when it could have
> been dropped right fom the beginning. It could be a
> solution but it doesn't sound "right" ;-).
> 
> Vieri
> 
> --- Richard Revels <rrevels at bandwidth.com> wrote:
> 
> > In the sip.conf entry assign a context.
> > 
> > In that context, hint the extension i.e. exten =>
> > 7302,hint,SIP/7302.
> > 
> > Before you get ready to dial, or whatever, do
> > chanisavail  i.e.
> > 
> > exten =>
> > _1XXXX,n(CheckUse),ChanIsAvail(SIP/${EXTEN:1},js)
> > exten => _1XXXX,n,Playback(beep)
> > exten => _1XXXX,n,Dial(SIP/${EXTEN},2)
> > exten =>
> > _1XXXX,n,Goto(result-${DIALSTATUS},${EXTEN},1)
> > exten => _1XXXX,CheckUse+101,SayDigits(${EXTEN:1})
> > exten =>
> _1XXXX,CheckUse+102,Playback(vm-isonphone)
> > exten => _1XXXX,CheckUse+103,Hangup()
> > 
> > This is from the paging stuff.  It checks the
> > primary extension before  
> > ringing the auto answer extension of the phone.  I
> > seem to remember it  
> > detecting DND as well for the Cisco 7960.
> > 
> > I don't see it in this message but I seem to
> > remember seeing somewhere  
> > in this thread that the goal is to keep people
> from
> > being in a queue  
> > forever.  Why not just set a time limit on the
> queue
> > and play back  
> > "all operators busy" and hang up if a call hits
> that
> > limit?
> > 
> > Richard
> > 
> > 
> > 
> > On Dec 2, 2007, at 8:51 AM, Vieri wrote:
> > 
> > > Hi,
> > >
> > > I am trying to get a SIP extension's status
> > without
> > > actually making a call.
> > >
> > > I am using sofia-sip's "options" example utility
> > and
> > > the sip clients are SJphone softphones.
> > >
> > > From Asterisk I run the "options" utility and
> > query a
> > > sip extension at 10.215.147.240. I get:
> > >
> > > # ./options -1 --all sip:10.215.147.240
> > > SIP/2.0 501 Not Implemented
> > > Via: SIP/2.0/UDP
> > >
> >
>
10.215.144.27:38098;branch=z9hG4bKUKS02S3F8H8ZS;received=10.215.144.27
> > > From: <sip:10.215.144.27>;tag=U3DKgF7HgFKXH
> > > To: "unknown" <sip:10.215.147.240>;tag=614733430
> > > Call-ID: b6968197-1b7d-122b-0ab0-00c09f10e472
> > > CSeq: 92182805 OPTIONS
> > > Content-Length: 0
> > > Server: SJphone/1.65.377a (SJ Labs)
> > >
> > > I guess that the softphone should be answering
> > with a
> > > 2xx code followed by a status description?
> > > So I tried with the INVITE method and set DND on
> > the
> > > SIP extension:
> > >
> > > # ./options -1 --all --method INVITE
> > > sip:10.215.147.240
> > > SIP/2.0 486 Busy Here
> > > Via: SIP/2.0/UDP
> > >
> >
>
10.215.144.27:38098;branch=z9hG4bK5Z3BS8F737t0e;received=10.215.144.27
> > > From: <sip:10.215.144.27>;tag=590Z1ND8B6XpN
> > > To: "unknown"
> <sip:10.215.147.240>;tag=1a2d77b524
> > > Call-ID: 668ad4fa-1b7e-122b-fcb6-00c09f10e472
> > > CSeq: 92182952 INVITE
> > > Content-Length: 0
> > > Server: SJphone/1.65.377a (SJ Labs)
> > >
> > > The above would suit me fine because I get a
> "486
> > Busy
> > > Here" response.
> > > However, if DND is off then I get:
> > >
> > > # ./options -1 --all --method INVITE
> > > sip:10.215.147.240
> > > SIP/2.0 180 Ringing
> > >
> > > and the SIP extension actually "rings", as
> > > expected.(but this is undesireable)
> > >
> > > Now, does someone know another way to get the
> > status
> > > (ie. does it accept calls or not?) without
> making
> > the
> > > extension "ring"?
> > >
> > > Thanks
> > >
> > > Vieri



      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs



More information about the asterisk-users mailing list