I would modify your sequence slightly
> 1) Send a Describe request to the Kurento Media server to get a session ID in response.
> 2) Send a request for the Creation of a Media Pipeline to the kurento.
> 3) Send a request for the creation of a Media RTPEndpoint to the kurento.
> 4) Send a Process Offer (INVOKE) and send the SDP received in the INVITE message of A and received a response of the SDP which are accepted to KMS.
> 5) Forward the Invite from A to B with the SDP of KMS.
>
> On receiving the 200 OK response (Answer) from B, we would,
> 6) Send a request for the Creation of a Media RTPEndpoint to the kurento(For B).
> 7) Send a Process Offer (INVOKE) and send the SDP received in the 200OK message of B and received a response of the SDP which are accepted to KMS.
> 8) Send a Connect request (INVOKE) with values of (SDP accepted of A by KMS) in the object field and (SDP accepted of B by KMS) in the sink field and send another CONNECT request with values vice versa.
> 9) Forward the 200OK to A and call will be established.
1) Get session id for JSON-RPC
2) Create MediaPipeline and two RtpEndpoint ForA and ForB
3) Connect ForA to ForB and ForB to ForA
4) SIP INVITE, extract SDP(A-OFFER), send to
KMS:ForA.processOffer(A-OFFER), save ForA-ANSWER (!!!!don't send to
B!!!!)
5) KMS:ForB.createOffer(): get ForB-OFFER SDP, replace the SDP in the
SIP INVITE, i.e, A-OFFER with ForB-OFFER
and send to B (adjust Content-Length header, etc etc)
6) 200 OK from B, take B-ANSWER SDP from 200 OK , and send to
KMS:ForB.processAnswer(B-ANSWER).
At this point: B and ForB will start exchanging RTP/RTCP (even before
ACK), and you can verify this on wireshark,
ForB will show MediaConnectionStateChange DISCONNECTED -> CONNECTED
7) Replace B-ANSWER SDP in 200 OK with ForA-ANSWER, from step 4), and send to A.
A and ForA will start exchanging RTP/RTCP.
8) Send ACK as per normal
9) Summary
i) B sees SIP INVITE with ForB-OFFER
ii) A sees 200 OK with ForA-ANSWER
iii) KMS INVOKE: ForA.processOffer(A-OFFER), ForB.generateOffer(),
ForB.processAnswer(B-ANSWER)
There should be 3 INVOKEs
Note:
* A exchanges RTP with ForA, B exchanges RTP with ForB, and KMS
internally will bridge media between ForA and ForB.
* when you obtain ForB-OFFER SDP in step 5), you can remove all lines
from m=video onwards to have an audio-only SDP.
You should also remove any a=group lines that you see
(usually something like a=group audio0 video0; this is not needed when
you have only one media stream)