Hello william wu,
sorry for the delayed reply. Here are some snippets on how I've implemented that feature. But as it is a complex setup, it will not work with copy & paste, the information provided will be guideline and the shows the parts related to FusionPBX and the triggers in the MTA...