Update query inside cdr table within the call

You can’t hook macro-hangupcall, but you can add a hangup handler and I expect that will do what you need. See the “How do I perform a custom action on hangup?” part of this this post: Hooking for fun and income