MT#63298 AmB2BSession: introduce `getMediaPort()`

Introduce AmSdp port getter.
Just takes the first available port which is > 0.

Change-Id: I49a4b850219c64d4720dafb3684dc9d11fa4594f
mr13.5
Donat Zenichev 11 months ago
parent d4200b6ba3
commit e4e1742da6

@ -302,6 +302,21 @@ void AmB2BSession::addFakeSDPbasedOnPort(const AmMimeBody *src_sdp, AmMimeBody &
createFakeReply(&fake_mimebody, new_body);
}
unsigned int AmB2BSession::getMediaPort(const AmSdp& sdp)
{
unsigned int result = 0;
for (auto it = sdp.media.begin(); it != sdp.media.end(); ++it)
{
/* must be a legal port which must also not be ICE dummy port */
if (it->port > 0 && it->port != 9) {
result = it->port;
break;
}
}
return result;
}
void AmB2BSession::acceptPendingInvite(AmSipRequest *invite)
{
// reply the INVITE with fake 200 reply

@ -213,6 +213,9 @@ private:
/** create fake AmSipReply. SDP body based on SDP offer, but with a desired port */
void addFakeSDPbasedOnPort(const AmMimeBody *src_sdp, AmMimeBody &new_body, unsigned int& desired_port);
/** get the first available media port */
unsigned int getMediaPort(const AmSdp& sdp);
/** generate 200 SIP reply on a pending INVITE (uses fake body) */
virtual void acceptPendingInvite(AmSipRequest *invite);

Loading…
Cancel
Save