Commit 79604de2 authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Store the NAT policy in the media session, not in the call session.

parent df45d5f1
......@@ -93,7 +93,6 @@ protected:
LinphoneProxyConfig *destProxy = nullptr;
LinphoneErrorInfo *ei = nullptr;
LinphoneCallLog *log = nullptr;
LinphoneNatPolicy *natPolicy = nullptr;
SalOp *op = nullptr;
......
......@@ -59,8 +59,6 @@ CallSessionPrivate::~CallSessionPrivate () {
linphone_error_info_unref(ei);
if (log)
linphone_call_log_unref(log);
if (natPolicy)
linphone_nat_policy_unref(natPolicy);
if (op)
sal_op_release(op);
}
......@@ -786,12 +784,6 @@ void CallSession::configure (LinphoneCallDir direction, LinphoneProxyConfig *cfg
}
d->log = linphone_call_log_new(direction, fromAddr, toAddr);
if (d->destProxy)
d->natPolicy = linphone_proxy_config_get_nat_policy(d->destProxy);
if (!d->natPolicy)
d->natPolicy = linphone_core_get_nat_policy(d->core);
linphone_nat_policy_ref(d->natPolicy);
if (op) {
/* We already have an op for incoming calls */
d->op = op;
......
......@@ -261,6 +261,7 @@ private:
RtpProfile *textProfile = nullptr;
int mainTextStreamIndex = LINPHONE_CALL_STATS_TEXT;
LinphoneNatPolicy *natPolicy = nullptr;
StunClient *stunClient = nullptr;
IceAgent *iceAgent = nullptr;
......
......@@ -103,6 +103,8 @@ MediaSessionPrivate::~MediaSessionPrivate () {
linphone_call_stats_unref(videoStats);
if (textStats)
linphone_call_stats_unref(textStats);
if (natPolicy)
linphone_nat_policy_unref(natPolicy);
if (stunClient)
delete stunClient;
delete iceAgent;
......@@ -4087,6 +4089,12 @@ void MediaSession::configure (LinphoneCallDir direction, LinphoneProxyConfig *cf
L_D(MediaSession);
CallSession::configure (direction, cfg, op, from, to);
if (d->destProxy)
d->natPolicy = linphone_proxy_config_get_nat_policy(d->destProxy);
if (!d->natPolicy)
d->natPolicy = linphone_core_get_nat_policy(d->core);
linphone_nat_policy_ref(d->natPolicy);
if (direction == LinphoneCallOutgoing) {
d->selectOutgoingIpVersion();
d->getLocalIp(to);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment