Switching ISPs based on satistics (packet loss, latency, jitty etc)

Im just now exploring the functions of the mikrotik routers, and im looking for the best way to measure something like latency or jitter over each connection so that I might run a script to redirect VOIP traffic to another provider if a certain threshold is met. Ive messed with the traffic generator some, but havent been able to actually get it to work. Anyone have pointers on how i might do something like this?