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

dave cantera david.cantera at iacnet.net
Sun Dec 2 09:25:06 CST 2007


vieri,
you can get sip status with the following shell script...   I named it 
'sipshowpeer'...   to execute, chmod 755 sipshowpeers
daveC

--------------------------< cut here >-------------------------
#!/bin/sh
#   sipshowpeers
#
#   show current asterisk SIP peers

asterisk -r -x 'sip show peers' | awk '
  BEGIN{
    #Name/username              Host            Dyn Nat ACL Port     Status
    # $1                        $2              $3  $4   $5  $6       $7
  }
  {
    name=$1
    host=$2
    dyn=$3
    nat=$4
    acl=$5
    port=$6
    status=$7
      printf("%14.14s %18.18s %14.14s %14.14s %s\n",$1,$2,$3,$4,$5,$6,$7)
  }
  END{
    printf("Done...\n")
  }'
#502                        (Unspecified)    D          0        Unmonitored
#501                        (Unspecified)    D          0        Unmonitored
#403                        10.10.15.43                 5060     Unmonitored
#402                        10.10.15.42                 5060     Unmonitored
#401/401                    192.168.15.100   D          5062     Unmonitored
#301/301                    192.168.15.31    D          5060     Unmonitored
#300/300                    192.168.15.31    D          5060     Unmonitored
------------------------------< cut here 
 >-------------------------------------------------------








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
>
>
>
>       ____________________________________________________________________________________
> Be a better pen pal. 
> Text or chat with friends inside Yahoo! Mail. See how.  http://overview.mail.yahoo.com/
>
> _______________________________________________
> --Bandwidth and Colocation Provided by http://www.api-digital.com--
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
>
>
>
>   

-- 
My wife's sister is in California.  
I should buy her a Videophone2008!

Truly, The Next Best Thing to Being There!
--

WorldWideVideoPhones.com
856.380.0894






More information about the asterisk-users mailing list