Prevent unwanted automatic phone call
There is a far yet distinct possibility that this may be a screen touch issue. Does the phone open and close, etc. other apps too? If so, we may be dealing with a touch issue on the screen.

Another instance that I have experienced is: my friend had a phone that acted up random things when the phone was charging, meaning that when it was connected to a power source, be it a laptop or its original charger, the phone would do random things when on the table (without anyone touching it).

Also, as a third possibility, please perform a "clear cache" for the "phone" app in the "apps" list in your settings.