Qatar and Ethiopian Airlines aircraft narrowly avoided a mid-air collision over Somali airspace.