[asterisk-users] DEVICE_STATE() and Asterisk 1.6.0.10

Mark Michelson mmichelson at digium.com
Thu Jul 16 09:29:12 CDT 2009


Barry L. Kline wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Mark Michelson wrote:
>> You need to set a call-limit for the SIP peer. Device state calculation for a 
>> SIP peer is predicated on both the call-limit and busylevel. Let's say that you 
>> were to have a call-limit of 2, but no busylevel set. These are the device 
>> states reported for the peer based on the number of calls currently handled:
> 
> 
> Hi Mark.  Thanks for your explanation of these parameters.
> 
> I should have posted my configurations.  I double-checked the contents
> of sip.conf and I have this.  The 'subscribecontext' was added for
> testing, per the other reply I got for my question.
> 
> ;
> ; Settings common to all devices on our system
> ;
> [basic-options](!)
>         type=friend
>         host=dynamic
>         canreinvite=no
>         disallow=all
>         allow=ulaw
>         dtmfmode=rfc2833
>         qualify=yes
> 
> ;
> ; Standard desksets here
> ;
> [lan-deskset](!,basic-options)
>         context=sip-deskset
>         notifyringing = yes
>         notifyhold = yes
>         limitonpeers = yes
>         call-limit=99
> 
> [6668](lan-deskset)
>         secret=mysecret
>         callerid="Matts SIP" <6668>
>         username=Barry's IP450
> 	call-limit=32
>         busylevel=1
>         subscribecontext=hint-context
> 
> 
> My hint-context is:
> 
> [hint-context]
> 
> exten => 6668,hint,SIP/6668;
> 
> 
> I'm still not getting anything other than NOT_INUSE from DEVICE_STATE.
> Here is the CLI output:
> 
> [Jul 15 18:40:15]     -- Executing [6668 at sip-deskset:1]
> NoOp("SIP/6666-0955ecc8", "SIP/6668 has state NOT_INUSE") in new stack
> [Jul 15 18:40:15]     -- Executing [6668 at sip-deskset:2]
> NoOp("SIP/6666-0955ecc8", "SIP/6666 has state NOT_INUSE") in new stack
> [Jul 15 18:40:15]     -- Executing [6668 at sip-deskset:3]
> ExecIf("SIP/6666-0955ecc8", "0?Busy(10)") in new stack
> [Jul 15 18:40:15]     -- Executing [6668 at sip-deskset:4]
> Dial("SIP/6666-0955ecc8", "SIP/6668") in new stack
> 
> 
> And here is sip show inuse:
> 
> corp-asterisk*CLI> sip show inuse
> * User name               In use          Limit
> 6668                      1               32
> 6667                      0               99
> 6666                      1               99
> * Peer name               In use          Limit
> 6668                      1/1/0           32
> 6667                      0/0/0           99
> 6666                      0/0/0           99
> 
> 
> For completeness, here is the dialplan that's producing this:
> 
> exten => 6668,1,NoOp(SIP/${EXTEN} has state ${DEVICE_STATE(SIP/${EXTEN})});
> exten => 6668,n,NoOp(SIP/6666 has state ${DEVICE_STATE(SIP/6666)});
> exten => 6668,n,ExecIf($[${DEVICE_STATE(SIP/${EXTEN})}="BUSY"]?Busy(10));
> exten => 6668,n,Dial(SIP/${EXTEN});
> 
> 

Thanks for the config info. I have a couple of suggestions for fixes.

1. Try changing the type in [basic-options] from friend to peer. I've found that 
device state reporting for outbound calls (from the perspective of the phone) 
tends to be more accurate with this type.

2. If for some odd reason number 1 either doesn't sound appealing to you or 
doesn't work, then try moving the limitonpeers=yes option from your 
[basic-options] section to the [general] section.

No, neither of these ideas actually make any real sense to me, but they are 
based on behavior that I have witnessed with my Asterisk setup in my office.

Mark Michelson



More information about the asterisk-users mailing list