By the way, it's hard to understand your code because I don't see the entire code. I see only one function.
— Ok I send it all
— Https://pastebin.com/PwmqJcgx
— Do you have a link of it?
— I don't know the class MPI_Status, so I can't find the exact point of bug. But what I see: id_cons is always 3. Why? Because you do this in line 133 (in brackets). Now you should understand why estado.MPI_SOURCE is always 3.