[FIX] Fix call gcphone (no WebRTC)

I will leave the solution that my solution, the one that worked for me about GCPHONE.

this is a momentary solution, since the problem comes from the native “NetworkSetVoiceChannel”, when executing the native one at the same time, it only changes the channel to the first execution. To solve this problem, we must give it time to execute the second and not at the same time.

GO FOR IT:

gcphone/server/server.lua line > 450 or function “RegisterServerEvent(‘gcPhone:acceptCall’)”

Change:

TriggerClientEvent('gcPhone:acceptCall', AppelsEnCours[id].transmitter_src, AppelsEnCours[id], true)
TriggerClientEvent('gcPhone:acceptCall', AppelsEnCours[id].receiver_src, AppelsEnCours[id], false)

FROM

TriggerClientEvent('gcPhone:acceptCall', AppelsEnCours[id].transmitter_src, AppelsEnCours[id], true)
SetTimeout(1000, function()
  TriggerClientEvent('gcPhone:acceptCall', AppelsEnCours[id].receiver_src, AppelsEnCours[id], false)
end)

And: line 685 or function: function onAcceptFixePhone(source, infoCall, rtcAnswer):
same change as above.

That is all! I hope it serves, I have my server running and it works more than 1 month ago with OneSync.

Link to request push Github: https://github.com/N3MTV/gcphone/pull/228/commits/02428d502f899024d3e36bfa1a2126df98f4496f

Sorry for my bad english :smiley:

26 Likes

you are lovely boy!!!

1 Like

are you sure that this is work ?

yes, im sure

not working for me

remember change config:

“useWebRTCVocal”: true
to
“useWebRTCVocal”: false,

1 Like

i did it

I use the original gcphone code with the mentioned change.

https://github.com/N3MTV/gcphone

EDIT:
try making the same change in “function onAcceptFixePhone (source, infoCall, rtcAnswer):”

1 Like

i did it too. it is still doesnt work.

by the way my server is onesync ?

its work in Onesync.

Change setTimeout:

SetTimeout(1000, function()
to
SetTimeout(2000, function()

or more… 3000, 4000 etc

Test until it works, remember to restart the resource every time you make the change.

i love you!

1 Like

How to do it? Can you see the picture

1 Like

Thx my man

nothing work for me

help me guys @Sonnydg

Line 425 to 444

RegisterServerEvent('gcPhone:acceptCall')
AddEventHandler('gcPhone:acceptCall', function(infoCall, rtcAnswer)
	local id = infoCall.id
	if AppelsEnCours[id] ~= nil then
		if PhoneFixeInfo[id] ~= nil then
			onAcceptFixePhone(source, infoCall, rtcAnswer)
			return
		end
		AppelsEnCours[id].receiver_src = infoCall.receiver_src or AppelsEnCours[id].receiver_src
		if AppelsEnCours[id].transmitter_src ~= nil and AppelsEnCours[id].receiver_src~= nil then
			AppelsEnCours[id].is_accepts = true
			AppelsEnCours[id].rtcAnswer = rtcAnswer
			TriggerClientEvent('gcPhone:acceptCall', AppelsEnCours[id].transmitter_src, AppelsEnCours[id], true)
			SetTimeout(1000, function()
			TriggerClientEvent('gcPhone:acceptCall', AppelsEnCours[id].receiver_src, AppelsEnCours[id], false)
			saveAppels(AppelsEnCours[id])
			end)
		end
	end
end)

Line 620 to 636

function onAcceptFixePhone(source, infoCall, rtcAnswer)
	local id = infoCall.id
	
	AppelsEnCours[id].receiver_src = source
	if AppelsEnCours[id].transmitter_src ~= nil and AppelsEnCours[id].receiver_src~= nil then
		AppelsEnCours[id].is_accepts = true
		AppelsEnCours[id].forceSaveAfter = true
		AppelsEnCours[id].rtcAnswer = rtcAnswer
		PhoneFixeInfo[id] = nil
		TriggerClientEvent('gcPhone:notifyFixePhoneChange', -1, PhoneFixeInfo)
		TriggerClientEvent('gcPhone:acceptCall', AppelsEnCours[id].transmitter_src, AppelsEnCours[id], true)
		SetTimeout(1000, function()
		TriggerClientEvent('gcPhone:acceptCall', AppelsEnCours[id].receiver_src, AppelsEnCours[id], false)
		saveAppels(AppelsEnCours[id])
		end)
	end
end

This is confirmed working. Thanks, @Sonnydg!

5 Likes

Thank you :heart:

I’m going to leave the Push Request link to the official GCPhone repository:

Merci <3

1 Like


how do I fix this