More than 1000 inmates have escaped from a Libyan prison near Benghazi, in mass jailbreak, news agency AP has reported.