Good point. Actually it could be understood from the context. If Ayşe was the one visited, the sentence might be like 'Ayşe dedi ki sen kendisini ziyaret etmişsin' and it would be certain that Ayşe is the one who is visited. However in the sentence above, you cannot differentiate it apart from the context
Actually, this sentence form is borrowed from Persian along with "ki" itself. "ki" in Persian is the equivalent of French "qui" and English "who". Actually here "ki" stands for "that" in English. "Ayşe dedi ki = Ayşe said that". This form is colloquial and easy to understand for new beginners especially for Indo-european natives. That is why a good point to start. A pure turkish form for that sentence (which is preferred written language) is actually: "Ayşe onu ziyaret ettiğini söyledi".