I just wanted to know if Photon Voice is available for Unreal Engine 5, or if there is any way of compiling the c++ code in the project.
Yes, Photon Voice is indeed available for Unreal Engine 5.
The Photon Voice C++ Client lib is part of the Photon Voice C++ Client SDKs, which you already use, and you can just link to it from your .Build.cs file in Unreal the same way in which you already link to the other libs.
"or if there is any way of compiling the c++ code in the project"
You mean the Photon Voice Client code? Yes, you can compile it yourself, using the project files that are included in the SDK as well. But, why would you? There is no need for you to compile it as we already provide precompiled binaries for you.
The only time you would want to recompile it, would be, when you want to make custom modifications to it (either temporary changes for debugging purposes or permanent changes).
There is an UE integration demo project specifically for Voice available at https://www.dropbox.com/s/rg9517ko59c5kvh/PhotonVoiceDemo-UE4.zip?dl=1, which demonstrates how to connect it with the Unreal Engine audio input and audio output APIs.