Skip to content

Commit

Permalink
send correct callRef flag after reroute CALLED
Browse files Browse the repository at this point in the history
  • Loading branch information
willamowius committed Jun 6, 2018
1 parent 19bf762 commit d197c6c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
10 changes: 10 additions & 0 deletions ProxyChannel.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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", "");
Expand Down Expand Up @@ -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());
}
Expand Down Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion RasTbl.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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()),
Expand Down Expand Up @@ -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),
Expand Down
4 changes: 4 additions & 0 deletions RasTbl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit d197c6c

Please sign in to comment.