Wouldn't it be better to try to leverage somehow `$uac_req(evroute)`? Now it has to be set to `1` to get the event route executed. The field can be turned into a flags meaning, so if it is set to 2, then adds the execution as per this PR:
* https://www.kamailio.org/wiki/cookbooks/5.5.x/pseudovariables#uac_req_key
By that, the prototype of the function does not change.