Computer-implemented method for establishing a VOIP communication between a PBX system and a first terminal device in a communication network, wherein the first terminal device is provided with a VOIP application or video call application, and wherein the PBX system and the first terminal device are able to communicate via a first and a second communication connection (11, 12) in the communication network, the method comprising the steps of - receiving, by the PBX system, a call from a second terminal device to be forwarded to the first terminal device, characterized by - verifying, by the PBX system, if the first terminal device is logged in the communication network, wherein if the PBX system verifies that the first terminal device is not logged in, the call is rejected, and if the PBX system verifies that the first terminal device is logged in, then the further steps are performed by the PBX system: ∘ determining, whether the VOIP application or video call application on the first terminal device is running in a background mode with the VOIP application or video call application being inactive, or in a foreground mode with the VOIP application or video call application being active, and if the PBX system determines that the VOIP application or video call application is running in the foreground mode, ▪ using the first connection between the PBX system and the first terminal device for forwarding the call to the first terminal device, and if the PBX system determines that the VOIP application or video call application is running in the background mode, ▪ using the second connection between the PBX system and the first terminal device for receiving information from the first terminal device on the type of its communication connection that it is using at that point of time. - receiving, by the PBX system, a call from a second terminal device to be forwarded to the first terminal device, characterized by - verifying, by the PBX system, if the first terminal device is logged in the communication network, wherein if the PBX system verifies that the first terminal device is not logged in, the call is rejected, and if the PBX system verifies that the first terminal device is logged in, then the further steps are performed by the PBX system: ∘ determining, whether the VOIP application or video call application on the first terminal device is running in a background mode with the VOIP application or video call application being inactive, or in a foreground mode with the VOIP application or video call application being active, and if the PBX system determines that the VOIP application or video call application is running in the foreground mode, ▪ using the first connection between the PBX system and the first terminal device for forwarding the call to the first terminal device, and if the PBX system determines that the VOIP application or video call application is running in the background mode, ▪ using the second connection between the PBX system and the first terminal device for receiving information from the first terminal device on the type of its communication connection that it is using at that point of time. ▪ using the first connection between the PBX system and the first terminal device for forwarding the call to the first terminal device, and if the PBX system determines that the VOIP application or video call application is running in the background mode, ▪ using the second connection between the PBX system and the first terminal device for receiving information from the first terminal device on the type of its communication connection that it is using at that point of time.