Modifying ChannelDestroyed event

Hello,

I am working with an application where I send some args along with StasisStart event. Then in the application, i have a handler which checks for StasisStart events, where those args are set as channel variables. Is there a way to get those variables set or added to the ChannelDestroyed event when it’s triggered? Or if there are better ways without having to get the args from the channel as variables? is it possible to modify the ChannelDestroyed event at will at all? From the digging i did i couldn’t find anything helpful so i’m asking this in here as to put an end to my searching.
If there are better ways to achieve my end result of having the custom args from StasisStart be present in the ChannelDestroyed event when it’s triggered, please send them my way also!
Thanks!

Here is the event for reference:

{"type":"ChannelDestroyed","timestamp":"2024-04-24T14:03:55.024+0200","cause":16,"cause_txt":"Normal Clearing","channel":{"id":"1713960214.56","name":"PJSIP/1001-00000027","state":"Up","protocol_id":"9d66b1f27994ee81d37df16e121c03e4@0:0:0:0:0:0:0:0","caller":{"name":"yyyy","number":"yyyy"},"connected":{"name":"","number":"zzzz"},"accountcode":"","dialplan":{"context":"internal","exten":"zzzz","priority":9,"app_name":"","app_data":""},"creationtime":"2024-04-24T14:03:34.426+0200","language":"en"},"asterisk_id":"08:00:27:18:d8:cf","application":"xxxxxx"}
{"type":"StasisStart","timestamp":"2024-04-24T14:06:46.885+0200","args":["item1=val1","item2=val2"],"channel":{"id":"1713960406.59","name":"PJSIP/1001-00000029","state":"Ring","protocol_id":"9c945c8841fdc58ddd6de4253204d33b@0:0:0:0:0:0:0:0","caller":{"name":"yyyy","number":"yyyy"},"connected":{"name":"","number":""},"accountcode":"","dialplan":{"context":"internal","exten":"zzzz","priority":7,"app_name":"Stasis","app_data":"app_name,item1=val1,item2=val2"},"creationtime":"2024-04-24T14:06:46.885+0200","language":"en"},"asterisk_id":"08:00:27:18:d8:cf","application":"app_name"}

“Modification” of events is done by modifying the underlying source code. If you just want to attach specific channel variables to the channel to emit in events, then that is configurable[1].

[1] asterisk/configs/samples/ari.conf.sample at master · asterisk/asterisk · GitHub

Thanks for the quick reply!
If you don’t mind me asking, is the performance penalty related to the amount of variables put in channelvars ? Or do i get a performance penalty even having just 1 variable? Currently I plan to only be putting 4 variables. I don’t have any stress testers atm so this could help me for future decisions.

Everything inherently has a performance penalty, the less channel variables on the channel, and the less you put in the event, the less impact there will be. Realistically it shouldn’t be worried about until it actually becomes a problem.