I want to use asterisk to cascade two Media servers sitting behind asterisk using below logic
Please help me how can i achieve that ?
I would like to send the Sdpless INVITE to 1st CS-1
Get the Media IP/Port from CS-1 in 200 OK
Send the received Media IP/Port to CS-2 in INVITE
Get the Media IP/Port from CS-2 in 200 OK
Send the Received Media IP/Port to CS-1 in ACK
send Final ACK to CS-2
These are more like proxy features than back to back user agent ones. The direct RTP setup feature in chan_sip is unsupported and I don’t know if there is any equivalent, at all, in chan_pjsip. Although it may have improved since, even the normal handling of late offer SDP was a bit flakey in chan_sip, as very few people use it. Only Cisco CUCM did, in our experience.
Is there any reason why you need this to happen on the initial invite, and not as the result of a re-INVITE?
This is not really what Asterisk was designed for as @david551 mentions, and is not supported. You would need to do massive modifications to Asterisk to try to do such a thing.