[asterisk-users] Manipulate extension state in 1.8.x

John Kiniston johnkiniston at gmail.com
Tue Jun 9 11:27:29 CDT 2015


You can use a custom device state to do it.

[dnd]
;DND Toggle
exten => *363,1,Answer()
 same =>
n,Set(CURRENT_PRESENCE=${DEVICE_STATE(Custom:DND${CHANNEL(peername)})})
 same =>      n,GotoIf($[${CURRENT_PRESENCE}=NOT_INUSE]?*78,1:*79,1)
;DND On
exten => *78,1,NoOP(Turning DND On)
 same =>     n,Set(DEVICE_STATE(Custom:DND${CHANNEL(peername)})=BUSY)
 same =>     n,Playback(do-not-disturb&enabled)
 same =>     n,Hangup()
;DND Off
exten => *79,1,NoOP(Turning DND Off)
 same =>     n,Set(DEVICE_STATE(Custom:DND${CHANNEL(peername)})=NOT_INUSE)
 same =>     n,Playback(do-not-disturb&disabled)
 same =>     n,Hangup()


Then you can simply hint on your device like:

exten => _70X,hint,SIP/${EXTEN}&Custom:DND${EXTEN}


On Tue, Jun 9, 2015 at 9:19 AM, Ishfaq Malik <ish at pack-net.co.uk> wrote:

> Hi
>
> Is there any way to set the presence state of a peer to in-use in asterisk
> 1.8?
>
> The idea is to integrate DND buttons on phones to BLF.
>
> Regards
>
> --
>
> Ishfaq Malik
> Department: VOIP Support
> Company: Packnet Limited
> t: +44 (0)161 660 2350
> f: +44 (0)161 660 9825
> e: ish at pack-net.co.uk
> w: http://www.pack-net.co.uk
>
> Registered Address: PACKNET LIMITED, Duplex 2, Ducie House
> 37 Ducie Street
> Manchester, M1 2JW
> COMPANY REG NO. 04920552
>
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>                http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
>



-- 
A human being should be able to change a diaper, plan an invasion, butcher
a hog, conn a ship, design a building, write a sonnet, balance accounts,
build a wall, set a bone, comfort the dying, take orders, give orders,
cooperate, act alone, solve equations, analyze a new problem, pitch manure,
program a computer, cook a tasty meal, fight efficiently, die gallantly.
Specialization is for insects.
---Heinlein
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20150609/1e0ba9bd/attachment.html>


More information about the asterisk-users mailing list