If you want to validate you phone number within contact form 7 wordpress plugin. Here is the great example of that. Please follow the give steps .
first, i went to the plugin folder and edited, contact-form-7/modules/text.php
and created a new function (please excuse my mistakes in naming conventions).
1. i inserted this code: