diff --git a/ProxyChannel.cxx b/ProxyChannel.cxx index 80dfd20f..e0a47005 100644 --- a/ProxyChannel.cxx +++ b/ProxyChannel.cxx @@ -2524,6 +2524,12 @@ ProxySocket::Result CallSignalSocket::ReceiveData() return m_result; } + if (m_call->IsCallRefFixup()) { + PTRACE(3, "CallRefFixup: Set IsFromDestination=" << !q931pdu->IsFromDestination()); + q931pdu->SetFromDestination(!q931pdu->IsFromDestination()); + msg->SetChanged(); + } + if (msg->GetQ931().HasIE(Q931::DisplayIE)) { PString newDisplayIE; PString screenDisplayIE = GkConfig()->GetString(RoutedSec, "ScreenDisplayIE", ""); @@ -7088,6 +7094,9 @@ bool CallSignalSocket::RerouteCall(CallLeg which, const PString & destination) // set calling and called party if (which == Called) { newCall->SetCalling(m_call->GetCalledParty()); + // now both sides think they are called and we need to fix the Q.931 CallRef flag + newCall->SetCallRefFixup(true); + m_call->SetCallRefFixup(true); } else { newCall->SetCalling(m_call->GetCallingParty()); } @@ -7116,6 +7125,7 @@ bool CallSignalSocket::RerouteCall(CallLeg which, const PString & destination) droppedSocket->SendReleaseComplete(H225_ReleaseCompleteReason::e_undefinedReason); // callDeflection ? + // TODO: set these into newCall instead of m_call ??? or both ? if (route.m_destEndpoint) m_call->SetCalled(route.m_destEndpoint); else diff --git a/RasTbl.cxx b/RasTbl.cxx index a6c6b6cc..bc6a4435 100644 --- a/RasTbl.cxx +++ b/RasTbl.cxx @@ -2656,6 +2656,7 @@ CallRec::CallRec( m_callIdentifier(((const H225_AdmissionRequest&)arqPdu).m_callIdentifier), m_conferenceIdentifier(((const H225_AdmissionRequest&)arqPdu).m_conferenceID), m_crv(((const H225_AdmissionRequest&)arqPdu).m_callReferenceValue.GetValue() & 0x7fffU), + m_callRefFixup(false), m_sourceAddress(((const H225_AdmissionRequest&)arqPdu).m_srcInfo), m_srcInfo(AsString(((const H225_AdmissionRequest&)arqPdu).m_srcInfo)), m_destInfo(destInfo), m_bandwidth(bandwidth), m_setupTime(0), m_alertingTime(0), @@ -2723,6 +2724,7 @@ CallRec::CallRec( ) : m_CallNumber(0), m_callIdentifier(setup.m_callIdentifier), m_conferenceIdentifier(setup.m_conferenceID), m_crv(q931pdu.GetCallReference() & 0x7fffU), + m_callRefFixup(false), m_destInfo(destInfo), m_bandwidth(GK_DEF_BANDWIDTH), m_setupTime(0), m_alertingTime(0), m_connectTime(0), m_disconnectTime(0), m_disconnectCause(0), m_disconnectCauseTranslated(0), m_releaseSource(-1), @@ -2782,6 +2784,7 @@ CallRec::CallRec( CallRec::CallRec(const H225_CallIdentifier & callID, H225_TransportAddress sigAdr) : m_CallNumber(0), m_callIdentifier(callID), m_crv(0), + m_callRefFixup(false), m_bandwidth(GK_DEF_BANDWIDTH), m_setupTime(0), m_alertingTime(0), m_connectTime(0), m_disconnectTime(0), m_disconnectCause(0), m_disconnectCauseTranslated(0), m_releaseSource(-1), m_acctSessionId(Toolkit::Instance()->GenerateAcctSessionId()), @@ -2815,7 +2818,9 @@ CallRec::CallRec( ) : m_CallNumber(0), m_callIdentifier(oldCall->m_callIdentifier), m_conferenceIdentifier(oldCall->m_conferenceIdentifier), - m_crv(oldCall->m_crv), m_Calling(oldCall->m_Calling), + m_crv(oldCall->m_crv), + m_callRefFixup(oldCall->m_callRefFixup), + m_Calling(oldCall->m_Calling), m_sourceAddress(oldCall->m_sourceAddress), m_destinationAddress(oldCall->m_destinationAddress), m_srcInfo(oldCall->m_srcInfo), diff --git a/RasTbl.h b/RasTbl.h index 6698cd5d..4848f59d 100644 --- a/RasTbl.h +++ b/RasTbl.h @@ -772,6 +772,8 @@ class CallRec { const H225_CallIdentifier & GetCallIdentifier() const { return m_callIdentifier; } void ClearCallIdentifier() { m_callIdentifier = 0; } unsigned GetCallRef() const { return m_crv; } + void SetCallRefFixup(bool val) { m_callRefFixup = val; } + bool IsCallRefFixup() const { return m_callRefFixup; } const H225_ConferenceIdentifier & GetConferenceIdentifier() const { return m_conferenceIdentifier; } endptr GetCallingParty() const { return m_Calling; } endptr GetCalledParty() const { return m_Called; } @@ -1473,6 +1475,8 @@ class CallRec { H225_ConferenceIdentifier m_conferenceIdentifier; /// Call Reference Value for the call WORD m_crv; + /// update call ref flag: both sides think they are the destination after a "reroute CALLED" + bool m_callRefFixup; /// EndpointRec for the calling party (if it is a registered endpoint) /// NOTE: it does not change during CallRec lifetime endptr m_Calling;