A raid by Boko Haram Islamists on Friday at a military compound in the northeastern city of Maiduguri has freed dozens of insurgents from custody, the military told AFP.