I think you'll have to write a plugin, which you pass the telephone-number (%cid%) and which will then return the next OGM to play as a variable. You then have to set "Next OGM" as a variable instead of a text. For example you can then have a PhoneNumberOK OGM, and a PhonenumberInvalid OGM, and let the plugin return either of these names in a %NextOGM% variable.
In the SDK description, on IVM's main page, the PHP example actually does this trick, though as a pin-code validator in stead of phone.