Question

Answer event comes too early in softphone-sdk.

  • 16 April 2024
  • 4 replies
  • 129 views

We are trying to initiate the call using https://github.com/ringcentral/ringcentral-softphone-js and stream some audio into the call after the call is answered. But it looks like `answered` events come too early before even the phone itself rings. Actually, it comes right after the call was created.

I am using the demo for outbound calls from the repository https://github.com/ringcentral/ringcentral-softphone-ts/blob/main/demos/outbound-call.ts


You can see in the logs that `ANSWERED` event comes in the same second as the previous event, right after the call was started.1.jpg


4 replies

I guess that you test by calling another user extension under the same account, right? If that is the case, can you test be making an outbound call to your mobile phone number (hope that you are in the U.S so you can make such local call.)

Yes, I was calling by extension under the same company account.

I tested the same code with a mobile phone number it works in the same way - the answered event comes immediately after the call was created.

It is a known issue if the callee is a RingCentral number, it will be answered immediately. It is by design. I don't like the behavior but I cannot change it. It's not due to the softphone SDK, it is a RingCentral server side behavior.


If you make a call to your own number (not RingCentral number). Make sure the callee is not a RingCentral number, and in theory, this issue will not be reproduced. I just tried my own mobile phone and it works as expected.


You can see that "SIP/2.0 183 Session Progress" at 10:46:47 and "SIP/2.0 200 OK" at 10:47:02. The 5 seconds difference is how long it took me to answer the phone call.


Receiving...(Wed Apr 17 2024 10:46:47 GMT-0700 (Pacific Daylight Time))

SIP/2.0 100 Trying

Via: SIP/2.0/TCP 00c8257b-c28c-4f31-a30a-07f998453a13.invalid;branch=z9hG4bK-9b592234-18dd-434b-8de0-206fea4788a1;received=45.62.187.76

To: <sip:secret@sip.ringcentral.com>;tag=44b438c2-3b81-40a7-a9bb-ba992227049e

From: <sip:secret@sip.ringcentral.com>;tag=886839d9-a9cd-4aff-bd62-60d4cae3afeb

Call-Id: d370268b-d19d-466a-9bb6-294fc5a22868

CSeq: 2537 INVITE

Content-Length: 0



Receiving...(Wed Apr 17 2024 10:46:47 GMT-0700 (Pacific Daylight Time))

SIP/2.0 183 Session Progress

Via: SIP/2.0/TCP 00c8257b-c28c-4f31-a30a-07f998453a13.invalid;branch=z9hG4bK-9b592234-18dd-434b-8de0-206fea4788a1;received=45.62.187.76

To: <sip:secret@sip.ringcentral.com>;tag=10.13.23.183-5070-79494a5d-9b60-41ad

From: <sip:secret@sip.ringcentral.com>;tag=886839d9-a9cd-4aff-bd62-60d4cae3afeb

Call-Id: d370268b-d19d-466a-9bb6-294fc5a22868

CSeq: 2537 INVITE

Allow: SUBSCRIBE, NOTIFY, REFER, INVITE, ACK, BYE, CANCEL, UPDATE, INFO

Content-Type: application/sdp

Contact: <sip:16504306662@104.245.57.195:5091;transport=tcp>

p-rc-api-ids: party-id=p-a0d17b7307ffbz18eed2b16fcz47c8ad0000-1;session-id=s-a0d17b7307ffbz18eed2b16fcz47c8ad0000

Content-Length: 225


v=0

o=- 1248600857100441966 8491060242449348806 IN IP4 208.87.41.71

s=SmcSip

c=IN IP4 208.87.41.71

t=0 0

m=audio 27920 RTP/AVP 0 101

a=sendrecv

a=rtpmap:0 pcmu/8000

a=rtpmap:101 telephone-event/8000

a=fmtp:101 0-15


Receiving...(Wed Apr 17 2024 10:47:02 GMT-0700 (Pacific Daylight Time))

SIP/2.0 200 OK

Via: SIP/2.0/TCP 00c8257b-c28c-4f31-a30a-07f998453a13.invalid;branch=z9hG4bK-9b592234-18dd-434b-8de0-206fea4788a1;received=45.62.187.76

To: <sip:secret@sip.ringcentral.com>;tag=10.13.23.183-5070-79494a5d-9b60-41ad

From: <sip:secret@sip.ringcentral.com>;tag=886839d9-a9cd-4aff-bd62-60d4cae3afeb

Call-Id: d370268b-d19d-466a-9bb6-294fc5a22868

CSeq: 2537 INVITE

Supported: replaces, timer, diversion, histinfo

Allow: SUBSCRIBE, NOTIFY, REFER, INVITE, ACK, BYE, CANCEL, UPDATE, INFO

Content-Type: application/sdp

Contact: <sip:16504306662@104.245.57.195:5091;transport=tcp>

p-rc-api-ids: party-id=p-a0d17b7307ffbz18eed2b16fcz47c8ad0000-1;session-id=s-a0d17b7307ffbz18eed2b16fcz47c8ad0000

Content-Length: 225


v=0

o=- 1248600857100441966 8491060242449348806 IN IP4 208.87.41.71

s=SmcSip

c=IN IP4 208.87.41.71

t=0 0

m=audio 27920 RTP/AVP 0 101

a=sendrecv

a=rtpmap:0 pcmu/8000

a=rtpmap:101 telephone-event/8000

a=fmtp:101 0-15

But we need this to create a call inside the company and stream the audio here.
Is there any other way to receive an event, maybe some custom event, when the call is answered?

Thanks.

Reply