Add script callback functions, and add support for callback in end of transmissions.