# 2-second latency of setting local description to RTCPeerConnection when user answers the call on Callkit

**URL:** <https://react-native-webrtc.discourse.group/t/2-second-latency-of-setting-local-description-to-rtcpeerconnection-when-user-answers-the-call-on-callkit/1518>\
**Category:** iOS\
**Created:** [March 30, 2022, 1:10pm UTC](https://react-native-webrtc.discourse.group/t/2-second-latency-of-setting-local-description-to-rtcpeerconnection-when-user-answers-the-call-on-callkit/1518 "2022-03-30T13:10:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![yunusaydinonline](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/yunusaydinonline/32/591_2.png) [@yunusaydinonline](https://react-native-webrtc.discourse.group/u/yunusaydinonline)\
**Post date:** [March 30, 2022, 1:10pm UTC](https://react-native-webrtc.discourse.group/t/2-second-latency-of-setting-local-description-to-rtcpeerconnection-when-user-answers-the-call-on-callkit/1518/1 "2022-03-30T13:10:41Z")

</div>

Hi,

I’ve been develop a React Native VoIP app powered by WebRTC and CallKit since last year.  
I’m having a latency problem with setting local description to RTCPeerConnection.

My logic here is; after the call is answered via CallKit, then CallKit fires these two events `performAnswerCallAction` and `didActivateAudioSession`. Then I create RTCPeerConnection and call `setLocalDescription` with this SDP:

```auto
{
"sdp":"v=0
o=- 654351570947918441 2 IN IP4 127.0.0.1
s=-
t=0 0
a=msid-semantic: WMS FA7E5E0A-101F-41F0-9B4A-3299D810A2C2
m=audio 9 RTP/SAVPF 9 8 0 101
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=ice-ufrag:VC+j
a=ice-pwd:QZpffFLu3LK/e2hxufOkPLiq
a=ice-options:trickle renomination
a=fingerprint:sha-256 27:82:8A:D3:51:40:74:89:39:CD:B9:8E:DF:A3:8A:F1:81:C1:55:B0:CA:71:38:EA:BF:F4:38:42:DB:45:17:BE
a=setup:active
a=mid:audio
a=sendrecv
a=rtcp-mux
a=rtpmap:9 G722/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=ssrc:1529435550 cname:rspdP8f1rP+aU3Qw
a=ssrc:1529435550 msid:FA7E5E0A-101F-41F0-9B4A-3299D810A2C2 73C274FA-FC1D-4360-BFFA-A372C4EFCFAE
a=ssrc:1529435550 mslabel:FA7E5E0A-101F-41F0-9B4A-3299D810A2C2
a=ssrc:1529435550 label:73C274FA-FC1D-4360-BFFA-A372C4EFCFAE",
"type":"answer"
}

```

My problem is; `RTCPeerConnection.setLocalDescription(desc)` takes about 2-2.5 seconds after audio session activated by CallKit. Otherwise, connection establishes as fast as expected (Of course I hear or convey no sound without CallKit).

P.S: There is no connection problem or missing audio after connection is established. It just takes too long to connect to other peer.
