Hi,
I have a weird problem trying to transfer extensions.conf code from an old system, running Asterisk 1.2.26-BRIstuffed-0.3.0-PRE-1y-p to a new one, running Asterisk 1.4.24. I use SNOM phones. Here is the old code :
exten => *88880,hint,DS/*88880 exten => *88880,1,Macro(agent-login,*88880,queue1,SIP/880)
[macro-agent-login] exten => s,1,NoOp(Agent Login Nr: ${ARG1} Queue: ${ARG2}) exten => s,n,GotoIf(${DB(${ARG2}/${ARG1})}?logout,1:login,1) exten => login,1,Answer() exten => login,n,Set(DB(${ARG2}/${ARG1})=1) exten => login,n,DevState(${ARG1},2) exten => login,n,AddQueueMember(${ARG2}|${ARG3}) exten => login,n,Playback(txt-70) exten => login,n,Hangup()
exten => logout,1,Answer() exten => logout,n,DBdel(${ARG2}/${ARG1}) exten => logout,n,DevState(${ARG1},0) exten => logout,n,RemoveQueueMember(${ARG2}|${ARG3}) exten => logout,n,Playback(txt-71) exten => logout,n,Hangup()
The lines
exten => login,n,DevState(${ARG1},2) and exten => logout,n,DevState(${ARG1},0)
activate and deactivate the LED of the SNOM phone, which visually shows if the used is currently logged in or logged out. I cannot manage to get this working on the new system. I've downloaded, complied and installed the backport of the new function DEVICE_STATE to 1.4 from here (http://svncommunity.digium.com/svn/russell/asterisk-1.4/func_devstate-1.4/), the function is registsered, but the LEDs remain off :(
Here is the new code :
exten => *88880,hint,Custom:*88880 exten => *88880,1,Macro(agent-login,*88880,queue1,SIP/880) [macro-agent-login] exten => s,1,NoOp(Agent Login Nr: ${ARG1} Queue: ${ARG2}) exten => s,n,GotoIf(${DB(${ARG2}/${ARG1})}?logout,1:login,1)
exten => login,1,Answer() exten => login,n,Playback(beep) exten => login,n,Set(DB(${ARG2}/${ARG1})=1) exten => login,n,Set(DEVSTATE(Custom:${ARG1})=BUSY)) exten => login,n,NoOp(${ARG1} has state ${DEVSTATE(Custom:${ARG1})}) exten => login,n,AddQueueMember(${ARG2}|${ARG3}) exten => login,n,Playback(txt-70) exten => login,n,Hangup()
exten => logout,1,Answer() exten => logout,n,Playback(beeperr) exten => logout,n,DBdel(${ARG2}/${ARG1}) exten => logout,n,Set(DEVSTATE(Custom:${ARG1})=NOT_INUSE)) exten => logout,n,NoOp(${ARG1} has state ${DEVSTATE(Custom:${ARG1})}) exten => logout,n,RemoveQueueMember(${ARG2}|${ARG3}) exten => logout,n,Playback(txt-71) exten => logout,n,Hangup()
Here is what the CLI shows : [Apr 21 16:22:31] -- Executing [logout@macro-agent-login:4] Set("SIP/880-09dd2ff0", "DEVSTATE(Custom:*88880)=NOT_INUSE)") in new stack [Apr 21 16:22:31] -- Executing [logout@macro-agent-login:5] NoOp("SIP/880-09dd2ff0", "*88880 has state UNKNOWN") in new stack
doesn't matter what I dial, I always get *88880 has state UNKNOWN and the LED remains off.
The function is registered :
localhost*CLI> show function DEVSTATE localhost*CLI> -= Info about function 'DEVSTATE' =-
[Syntax] DEVSTATE(device)
[Synopsis] Get or Set a device state
[Description] The DEVSTATE function can be used to retrieve the device state from any device state provider. For example: NoOp(SIP/mypeer has state ${DEVSTATE(SIP/mypeer)}) NoOp(Conference number 1234 has state ${DEVSTATE(MeetMe:1234)})
The DEVSTATE function can also be used to set custom device state from the dialplan. The "Custom:" prefix must be used. For example: Set(DEVSTATE(Custom:lamp1)=BUSY) Set(DEVSTATE(Custom:lamp2)=NOT_INUSE) You can subscribe to the status of a custom device state using a hint in the dialplan: exten => 1234,hint,Custom:lamp1
The possible values for both uses of this function are: UNKNOWN | NOT_INUSE | INUSE | BUSY | INVALID | UNAVAILABLE | RINGING RINGINUSE | ONHOLD
Obviously I have something wrong in the settings ... :(
|