I’m writing an integration between Asterisk and our Help Desk software so that support techs can click DND on a support ticket. The objective is to mark them as unavailable, both to the PBX and within the help desk software. Then when a ticket is closed, they’ll automatically exit DND.
I’m using the DBPut
and DBDel
commands like so:
async def all_events(event):
print(event)
ami.create_action(
{
"Action": "Events",
"ActionID": f'{uuid.uuid4()}',
"Family": "DND",
"Key": "215",
"Value": "1",
},
all_events,
)
ami.create_action(
{
"Action": "DBDel",
"ActionID": f'{uuid.uuid4()}',
"Family": "DND",
"Key": "215",
},
all_events,
)
That’s all working, as far as setting/unsetting DND goes. The one thing remaining is that the BLF key for exten 215 doesn’t change when DND changes. I’d like the behavior to be exactly the same as if the user dialed *76
on the phone.
When *76
is dialed, about 143 events are fired, the most meaningful of which appear to be:
{'Event': 'DeviceStateChange', 'Privilege': 'call,all', 'Device': 'Custom:DEVDND215', 'State': 'NOT_INUSE'}
{'Event': 'DeviceStateChange', 'Privilege': 'call,all', 'Device': 'Custom:DND215', 'State': 'NOT_INUSE'}
What’s the way to have DND set by an AMI script, while making it behave exactly as if *76
was entered on the device? (If the user has multiple phones, it’s fine if they ALL are affected by the DND.)
Any thoughts or other suggestions would be much appreciated!