Skip to content

Commit

Permalink
MakeCall updates
Browse files Browse the repository at this point in the history
  • Loading branch information
willamowius committed Jan 3, 2017
1 parent 871dadd commit 9d1716d
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 25 deletions.
66 changes: 52 additions & 14 deletions MakeCall.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// MakeCall.cxx
//
// Copyright (c) 2007-2013, Jan Willamowius
// Copyright (c) 2007-2017, Jan Willamowius
//
// This work is published under the GNU Public License version 2 (GPLv2)
// see file COPYING for details.
Expand All @@ -27,7 +27,7 @@ MakeCallEndPoint::MakeCallEndPoint() : Singleton<MakeCallEndPoint>("MakeCallEndP
}

// Set the various options
DisableFastStart(Toolkit::AsBool(GkConfig()->GetString("CTI::MakeCall", "DisableFastStart", "0")));
DisableFastStart(true);
DisableH245Tunneling(Toolkit::AsBool(GkConfig()->GetString("CTI::MakeCall", "DisableH245Tunneling", "0")));

// Set the default codecs
Expand All @@ -48,13 +48,13 @@ MakeCallEndPoint::MakeCallEndPoint() : Singleton<MakeCallEndPoint>("MakeCallEndP
rasChannel = new H323TransportUDP(*this, interfaceAddress);
}

PString gkName = GkConfig()->GetString("CTI::MakeCall", "Gatekeeper", "127.0.0.1");
if (SetGatekeeper(gkName, rasChannel)) {
m_gkAddress = GkConfig()->GetString("CTI::MakeCall", "Gatekeeper", "127.0.0.1");
if (SetGatekeeper(m_gkAddress, rasChannel)) {
PTRACE(3, "MakeCallEndpoint: Gatekeeper set: " << *gatekeeper);
isRegistered = TRUE;
} else {
PTRACE(1, "MakeCallEndpoint: Error registering with gatekeeper at \"" << gkName << '"');
SNMP_TRAP(7, SNMPError, Network, "MakeCall endpoint failed to register with gatekeeper " + gkName);
PTRACE(1, "MakeCallEndpoint: Error registering with gatekeeper at \"" << m_gkAddress << '"');
SNMP_TRAP(7, SNMPError, Network, "MakeCall endpoint failed to register with gatekeeper " + m_gkAddress);
isRegistered = FALSE;
}
#ifdef H323_H46018
Expand All @@ -76,7 +76,7 @@ void MakeCallEndPoint::ThirdPartyMakeCall(const PString & user1, const PString &
PBoolean MakeCallEndPoint::IsRegisteredWithGk() const
{
return isRegistered;
}
}

void MakeCallEndPoint::AddDestination(const PString & token, const PString & alias)
{
Expand All @@ -102,9 +102,7 @@ PString MakeCallEndPoint::GetDestination(const PString & token)
}


PBoolean MakeCallEndPoint::OnIncomingCall(H323Connection & connection,
const H323SignalPDU &,
H323SignalPDU &)
PBoolean MakeCallEndPoint::OnIncomingCall(H323Connection & connection, const H323SignalPDU &, H323SignalPDU &)
{
PTRACE(2, "MakeCallEndpoint: Incoming call from \"" << connection.GetRemotePartyName() << "\" rejected");
return FALSE;
Expand All @@ -130,8 +128,7 @@ PBoolean MakeCallEndPoint::OnConnectionForwarded(H323Connection & connection,
}


void MakeCallEndPoint::OnConnectionEstablished(H323Connection & connection,
const PString & token)
void MakeCallEndPoint::OnConnectionEstablished(H323Connection & connection, const PString & token)
{
// find second party by call token
PString second_party = GetDestination(token);
Expand All @@ -142,13 +139,28 @@ void MakeCallEndPoint::OnConnectionEstablished(H323Connection & connection,
PTRACE(3, "MakeCallEndpoint: Using H.450.2 to transfer call");
connection.TransferCall(second_party);
#else
PTRACE(3, "MakeCallEndpoint: H.450.2 Not supported recompile");
PTRACE(3, "MakeCallEndpoint: H.450.2 Not supported, please recompile");
#endif
#ifdef HAS_ROUTECALLTOMC
} else if (transferMethod == "Reroute") {
PTCPSocket client(m_gkAddress, 7000);
PString callid = connection.GetCallIdentifier().AsString();
callid.Replace(" ", "-", true);
PString cmd = "reroutecall " + callid + " called " + second_party + "\r\n";
client.Write((const char *)cmd, cmd.GetLength());
cmd = "quit\r\n";
client.Write((const char *)cmd, cmd.GetLength());
// wait for GnuGk to send a response to avoid error in trace, wait 1/2 sec max.
char buffer[64];
client.SetReadTimeout(500);
client.read(buffer, 20);
client.Close();
} else if (transferMethod == "FacilityRouteCallToMC") {
#ifdef HAS_ROUTECALLTOMC
PTRACE(3, "MakeCallEndpoint: Using Facility(routeCalltoMC) to transfer call");
H225_ConferenceIdentifier confId;
connection.RouteCallToMC(second_party, confId);
#else
PTRACE(3, "MakeCallEndpoint: FacilityRouteCallToMC Not supported, please recompile");
#endif
} else {
PTRACE(3, "MakeCallEndpoint: Using Facility(callForwarded) to transfer call");
Expand All @@ -175,3 +187,29 @@ PBoolean MakeCallEndPoint::OpenAudioChannel(H323Connection & /* connection */,
return FALSE;
}

H323Connection * MakeCallEndPoint::CreateConnection(unsigned callReference)
{
unsigned options = 0;
return new MakeCallConnection(*this, callReference, options);
}


MakeCallConnection::MakeCallConnection(MakeCallEndPoint & _ep, unsigned _callReference, unsigned _options)
: H323Connection(_ep, _callReference, _options)
{
}

PBoolean MakeCallConnection::OnSendSignalSetup(H323SignalPDU & setupPDU)
{
// set outgoing bearer capability to unrestricted information transfer + huge transfer rate
PBYTEArray caps;
caps.SetSize(4);
caps[0] = 0x88;
caps[1] = 0x18;
caps[2] = 0x86;
caps[3] = 0xa5;
setupPDU.GetQ931().SetIE(Q931::BearerCapabilityIE, caps);

return H323Connection::OnSendSignalSetup(setupPDU);
}

19 changes: 17 additions & 2 deletions MakeCall.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// MakeCall.h
//
// Copyright (c) 2007-2013, Jan Willamowius
// Copyright (c) 2007-2017, Jan Willamowius
//
// This work is published under the GNU Public License version 2 (GPLv2)
// see file COPYING for details.
Expand All @@ -24,8 +24,11 @@ class MakeCallEndPoint : public Singleton<MakeCallEndPoint>, public H323EndPoint
{
public:
MakeCallEndPoint();
virtual ~MakeCallEndPoint() { }

// overrides from H323EndPoint
virtual H323Connection * CreateConnection(unsigned callReference);

virtual PBoolean OnIncomingCall(H323Connection &, const H323SignalPDU &, H323SignalPDU &);
virtual PBoolean OnConnectionForwarded(H323Connection &, const PString &, const H323SignalPDU &);
virtual void OnConnectionEstablished(H323Connection & connection, const PString & token);
Expand All @@ -36,7 +39,7 @@ class MakeCallEndPoint : public Singleton<MakeCallEndPoint>, public H323EndPoint
virtual void ThirdPartyMakeCall(const PString & user1, const PString & user2);
virtual PBoolean IsRegisteredWithGk() const;

protected:
protected:
void AddDestination(const PString & token, const PString & alias);
// get and remove destination from list
PString GetDestination(const PString & token);
Expand All @@ -46,7 +49,19 @@ class MakeCallEndPoint : public Singleton<MakeCallEndPoint>, public H323EndPoint

PCaselessString transferMethod;
PBoolean isRegistered;
PString m_gkAddress;
};


class MakeCallConnection : public H323Connection
{
public:
MakeCallConnection(MakeCallEndPoint & ep, unsigned _callReference, unsigned _options);
virtual ~MakeCallConnection() { }

PBoolean OnSendSignalSetup(H323SignalPDU & setupPDU);
};


#endif // _MakeCall_H

3 changes: 3 additions & 0 deletions changes.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Changes from 4.3 to 4.4
=======================
- [CTI::MakeCall] TransferMethod can now also be Reroute, DisableFastStart switch removed
- BUGFIX(MakeCall.cxx) fix MakeCall bearer capabilities to support video calls
- BUGFIX(ProxyChannel.cxx) don't send Notify after call Reroute: Polycom RealPresense starts a flood of Status messages
- BUGFIX(GkStatus.cxx) call ssh_init() and ssh_finalize() only on application start and shutdown
- BUGFIX(ProxyChannel.cxx) fix IP check for IgnoreSignaledPrivateH239IPs= switch
- new accounting/authentication policy RequireOneNet
Expand Down
12 changes: 4 additions & 8 deletions docs/manual/misc.sgml
Original file line number Diff line number Diff line change
Expand Up @@ -456,13 +456,15 @@ This defines the endpoint alias for the pseudo endpoint used to dial.
Default: <tt>FacilityForward</tt><newline>
<p>
Set the method to transfer the call from the pseudo endpoint to the actual destination. Possible values are:
FacilityForward, FacilityRouteCallToMC and H.450.2.
FacilityForward, FacilityRouteCallToMC, Reroute and H.450.2.

<item>
<tt/UseH450=1/<newline>
Default: <tt>0</tt><newline>
<p>
Use a H.450.2 transfer instead of a Facility message to transfer the call from the pseudo endpoint to the actual destination. <bf>Deprecated: Use TransferMethod= instead.</bf>
<bf>Deprecated: Use TransferMethod switch instead.</bf>

Use a H.450.2 transfer instead of a Facility message to transfer the call from the pseudo endpoint to the actual destination.

<item>
<tt/Gatekeeper=192.168.1.2/<newline>
Expand All @@ -476,12 +478,6 @@ Default: <tt>*:1722</tt><newline>
<p>
Interface and port to use for the pseudo endpoint.

<item>
<tt/DisableFastStart=1/<newline>
Default: <tt>0</tt><newline>
<p>
Disable FastStart for the pseudo endpoint.

<item>
<tt/DisableH245Tunneling=1/<newline>
Default: <tt>0</tt><newline>
Expand Down
2 changes: 1 addition & 1 deletion gk.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const char * KnownConfigEntries[][2] = {
{ "CTI::Agents", "VirtualQueueAliases" },
{ "CTI::Agents", "VirtualQueuePrefixes" },
{ "CTI::Agents", "VirtualQueueRegex" },
{ "CTI::MakeCall", "DisableFastStart" },
{ "CTI::MakeCall", "DisableFastStart" }, // obsolete, but still accepted
{ "CTI::MakeCall", "DisableH245Tunneling" },
{ "CTI::MakeCall", "EndpointAlias" },
{ "CTI::MakeCall", "Gatekeeper" },
Expand Down

0 comments on commit 9d1716d

Please sign in to comment.