Watch the videos @ menu/info/guides, to get a better understanding of how to program tasker. then you need a profile with 4 contexts.
1- state / wifi connected
2- Time / every 5 min
3- state / display off
4- state / phone / call any (invert)
with a task that toggles the wifi.
To add additional contexts just long press the original context.