Hello,
Welcome to Microsoft Q&A.
A phone line is a line on a device that can either receive incoming calls or place outgoing calls. It does not support to hang up the phone by code. Hanging up is an operation performed by the user and the application cannot interfere.
Thanks.