Chosen Solution

Phone rebooting after turning on phonespeaker while calling

Mariusz, check your phone to see if there are any kernel panic logs saved; the Wiki page listed below will tell you how to find them. If there is one present, post the first page or so on your question. If you have one, it should point to the reason for the reboot and let us know if it’s a hardware or a software problem. iPhone Kernel Panics - iFixit