implement type=alias to deprecate type=h323 and a whole lot more code clean up

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4052 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Jeremy McNamara 2004-10-23 02:43:41 +00:00
parent 4f2438acab
commit b31c4d7fb9
3 changed files with 235 additions and 312 deletions

View File

@ -78,14 +78,14 @@ MyProcess::MyProcess(): PProcess("The NuFone Network's", "H.323 Channel Driver f
void MyProcess::Main() void MyProcess::Main()
{ {
ast_verbose(" == Creating H.323 Endpoint\n"); cout << " == Creating H.323 Endpoint" << endl;
endPoint = new MyH323EndPoint(); endPoint = new MyH323EndPoint();
PTrace::Initialise(0, NULL, PTrace::Timestamp | PTrace::Thread | PTrace::FileAndLine); PTrace::Initialise(0, NULL, PTrace::Timestamp | PTrace::Thread | PTrace::FileAndLine);
} }
#define H323_G7231 OPAL_G7231_6k3"{sw}" #define H323_G7231 OPAL_G7231_6k3 "{sw}"
#define H323_G729 OPAL_G729 "{sw}" #define H323_G729 OPAL_G729 "{sw}"
#define H323_G729A OPAL_G729A"{sw}" #define H323_G729A OPAL_G729A "{sw}"
H323_REGISTER_CAPABILITY(H323_G7231Capability, H323_G7231); H323_REGISTER_CAPABILITY(H323_G7231Capability, H323_G7231);
H323_REGISTER_CAPABILITY(AST_G729Capability, H323_G729); H323_REGISTER_CAPABILITY(AST_G729Capability, H323_G729);
@ -94,70 +94,67 @@ H323_REGISTER_CAPABILITY(AST_G729ACapability, H323_G729A);
H323_G7231Capability::H323_G7231Capability(BOOL annexA_) H323_G7231Capability::H323_G7231Capability(BOOL annexA_)
: H323AudioCapability(7, 4) : H323AudioCapability(7, 4)
{ {
annexA = annexA_; annexA = annexA_;
} }
PObject::Comparison H323_G7231Capability::Compare(const PObject & obj) const PObject::Comparison H323_G7231Capability::Compare(const PObject & obj) const
{ {
Comparison result = H323AudioCapability::Compare(obj); Comparison result = H323AudioCapability::Compare(obj);
if (result != EqualTo) if (result != EqualTo) {
return result; return result;
}
PINDEX otherAnnexA = ((const H323_G7231Capability &)obj).annexA; PINDEX otherAnnexA = ((const H323_G7231Capability &)obj).annexA;
if (annexA < otherAnnexA) if (annexA < otherAnnexA) {
return LessThan; return LessThan;
if (annexA > otherAnnexA) }
return GreaterThan; if (annexA > otherAnnexA) {
return EqualTo; return GreaterThan;
}
return EqualTo;
} }
PObject * H323_G7231Capability::Clone() const PObject * H323_G7231Capability::Clone() const
{ {
return new H323_G7231Capability(*this); return new H323_G7231Capability(*this);
} }
PString H323_G7231Capability::GetFormatName() const PString H323_G7231Capability::GetFormatName() const
{ {
return H323_G7231; return H323_G7231;
} }
unsigned H323_G7231Capability::GetSubType() const unsigned H323_G7231Capability::GetSubType() const
{ {
return H245_AudioCapability::e_g7231; return H245_AudioCapability::e_g7231;
} }
BOOL H323_G7231Capability::OnSendingPDU(H245_AudioCapability & cap, BOOL H323_G7231Capability::OnSendingPDU(H245_AudioCapability & cap,
unsigned packetSize) const unsigned packetSize) const
{ {
cap.SetTag(H245_AudioCapability::e_g7231); cap.SetTag(H245_AudioCapability::e_g7231);
H245_AudioCapability_g7231 & g7231 = cap;
H245_AudioCapability_g7231 & g7231 = cap; g7231.m_maxAl_sduAudioFrames = packetSize;
g7231.m_maxAl_sduAudioFrames = packetSize; g7231.m_silenceSuppression = annexA;
g7231.m_silenceSuppression = annexA; return TRUE;
return TRUE;
} }
BOOL H323_G7231Capability::OnReceivedPDU(const H245_AudioCapability & cap, BOOL H323_G7231Capability::OnReceivedPDU(const H245_AudioCapability & cap,
unsigned & packetSize) unsigned & packetSize)
{ {
if (cap.GetTag() != H245_AudioCapability::e_g7231) if (cap.GetTag() != H245_AudioCapability::e_g7231) {
return FALSE; return FALSE;
}
const H245_AudioCapability_g7231 & g7231 = cap; const H245_AudioCapability_g7231 & g7231 = cap;
packetSize = g7231.m_maxAl_sduAudioFrames; packetSize = g7231.m_maxAl_sduAudioFrames;
annexA = g7231.m_silenceSuppression; annexA = g7231.m_silenceSuppression;
return TRUE;
return TRUE;
} }
H323Codec * H323_G7231Capability::CreateCodec(H323Codec::Direction direction) const H323Codec * H323_G7231Capability::CreateCodec(H323Codec::Direction direction) const
{ {
return NULL; return NULL;
} }
/////////////////////////////////////////////////////////////////////////////
AST_G729Capability::AST_G729Capability() AST_G729Capability::AST_G729Capability()
: H323AudioCapability(24, 6) : H323AudioCapability(24, 6)
{ {
@ -165,26 +162,24 @@ AST_G729Capability::AST_G729Capability()
PObject * AST_G729Capability::Clone() const PObject * AST_G729Capability::Clone() const
{ {
return new AST_G729Capability(*this); return new AST_G729Capability(*this);
} }
unsigned AST_G729Capability::GetSubType() const unsigned AST_G729Capability::GetSubType() const
{ {
return H245_AudioCapability::e_g729; return H245_AudioCapability::e_g729;
} }
PString AST_G729Capability::GetFormatName() const PString AST_G729Capability::GetFormatName() const
{ {
return H323_G729; return H323_G729;
} }
H323Codec * AST_G729Capability::CreateCodec(H323Codec::Direction direction) const H323Codec * AST_G729Capability::CreateCodec(H323Codec::Direction direction) const
{ {
return NULL; return NULL;
} }
/////////////////////////////////////////////////////////////////////////////
AST_G729ACapability::AST_G729ACapability() AST_G729ACapability::AST_G729ACapability()
: H323AudioCapability(24, 6) : H323AudioCapability(24, 6)
{ {
@ -192,22 +187,22 @@ AST_G729ACapability::AST_G729ACapability()
PObject * AST_G729ACapability::Clone() const PObject * AST_G729ACapability::Clone() const
{ {
return new AST_G729ACapability(*this); return new AST_G729ACapability(*this);
} }
unsigned AST_G729ACapability::GetSubType() const unsigned AST_G729ACapability::GetSubType() const
{ {
return H245_AudioCapability::e_g729AnnexA; return H245_AudioCapability::e_g729AnnexA;
} }
PString AST_G729ACapability::GetFormatName() const PString AST_G729ACapability::GetFormatName() const
{ {
return H323_G729A; return H323_G729A;
} }
H323Codec * AST_G729ACapability::CreateCodec(H323Codec::Direction direction) const H323Codec * AST_G729ACapability::CreateCodec(H323Codec::Direction direction) const
{ {
return NULL; return NULL;
} }
/** MyH323EndPoint /** MyH323EndPoint
@ -218,7 +213,7 @@ H323Codec * AST_G729ACapability::CreateCodec(H323Codec::Direction direction) con
* transport = ip. * transport = ip.
* port = 1720. * port = 1720.
*/ */
int MyH323EndPoint::MakeCall(const PString & dest, PString & token, unsigned int *callReference, unsigned int port, char *cid_name, char *cid_name) int MyH323EndPoint::MakeCall(const PString & dest, PString & token, unsigned int *callReference, unsigned int port, char *cid_name, char *cid_num)
{ {
PString fullAddress; PString fullAddress;
MyH323Connection * connection; MyH323Connection * connection;
@ -253,9 +248,9 @@ int MyH323EndPoint::MakeCall(const PString & dest, PString & token, unsigned int
connection->SetLocalPartyName(PString(cid_num)); connection->SetLocalPartyName(PString(cid_num));
} }
if (h323debug) { if (h323debug) {
cout << " -- " << GetLocalUserName() << " is calling host " << fullAddress << endl; cout << "\t-- " << GetLocalUserName() << " is calling host " << fullAddress << endl;
cout << " -- " << "Call token is " << (const char *)token << endl; cout << "\t--" << "Call token is " << (const char *)token << endl;
cout << " -- Call reference is " << *callReference << endl; cout << "\t-- Call reference is " << *callReference << endl;
} }
connection->Unlock(); connection->Unlock();
return 0; return 0;
@ -263,16 +258,16 @@ int MyH323EndPoint::MakeCall(const PString & dest, PString & token, unsigned int
void MyH323EndPoint::SetEndpointTypeInfo( H225_EndpointType & info ) const void MyH323EndPoint::SetEndpointTypeInfo( H225_EndpointType & info ) const
{ {
H323EndPoint::SetEndpointTypeInfo(info); H323EndPoint::SetEndpointTypeInfo(info);
info.m_gateway.IncludeOptionalField(H225_GatewayInfo::e_protocol); info.m_gateway.IncludeOptionalField(H225_GatewayInfo::e_protocol);
info.m_gateway.m_protocol.SetSize(1); info.m_gateway.m_protocol.SetSize(1);
H225_SupportedProtocols &protocol=info.m_gateway.m_protocol[0]; H225_SupportedProtocols &protocol=info.m_gateway.m_protocol[0];
protocol.SetTag(H225_SupportedProtocols::e_voice); protocol.SetTag(H225_SupportedProtocols::e_voice);
PINDEX as=SupportedPrefixes.GetSize(); PINDEX as=SupportedPrefixes.GetSize();
((H225_VoiceCaps &)protocol).m_supportedPrefixes.SetSize(as); ((H225_VoiceCaps &)protocol).m_supportedPrefixes.SetSize(as);
for (PINDEX p=0; p<as; p++) { for (PINDEX p=0; p<as; p++) {
H323SetAliasAddress(SupportedPrefixes[p], ((H225_VoiceCaps &)protocol).m_supportedPrefixes[p].m_prefix); H323SetAliasAddress(SupportedPrefixes[p], ((H225_VoiceCaps &)protocol).m_supportedPrefixes[p].m_prefix);
} }
} }
void MyH323EndPoint::SetGateway(void) void MyH323EndPoint::SetGateway(void)
@ -288,7 +283,7 @@ H323Capabilities MyH323EndPoint::GetCapabilities(void)
BOOL MyH323EndPoint::ClearCall(const PString & token) BOOL MyH323EndPoint::ClearCall(const PString & token)
{ {
if (h323debug) { if (h323debug) {
cout << " -- ClearCall: Request to clear call with token " << token << endl; cout << "\t-- ClearCall: Request to clear call with token " << token << endl;
} }
return H323EndPoint::ClearCall(token); return H323EndPoint::ClearCall(token);
} }
@ -307,8 +302,9 @@ void MyH323EndPoint::SendUserTone(const PString &token, char tone)
void MyH323EndPoint::OnClosedLogicalChannel(H323Connection & connection, const H323Channel & channel) void MyH323EndPoint::OnClosedLogicalChannel(H323Connection & connection, const H323Channel & channel)
{ {
channelsOpen--; channelsOpen--;
if (h323debug) if (h323debug) {
cout << " channelsOpen = " << channelsOpen << endl; cout << "\t\tchannelsOpen = " << channelsOpen << endl;
}
H323EndPoint::OnClosedLogicalChannel(connection, channel); H323EndPoint::OnClosedLogicalChannel(connection, channel);
} }
@ -317,7 +313,7 @@ BOOL MyH323EndPoint::OnConnectionForwarded(H323Connection & connection,
const H323SignalPDU & pdu) const H323SignalPDU & pdu)
{ {
if (h323debug) { if (h323debug) {
cout << " -- Call Forwarded to " << forwardParty << endl; cout << "\t-- Call Forwarded to " << forwardParty << endl;
} }
return FALSE; return FALSE;
} }
@ -327,7 +323,7 @@ BOOL MyH323EndPoint::ForwardConnection(H323Connection & connection,
const H323SignalPDU & pdu) const H323SignalPDU & pdu)
{ {
if (h323debug) { if (h323debug) {
cout << " -- Forwarding call to " << forwardParty << endl; cout << "\t-- Forwarding call to " << forwardParty << endl;
} }
return H323EndPoint::ForwardConnection(connection, forwardParty, pdu); return H323EndPoint::ForwardConnection(connection, forwardParty, pdu);
} }
@ -352,105 +348,119 @@ void MyH323EndPoint::OnConnectionCleared(H323Connection & connection, const PStr
WORD sourcePort; WORD sourcePort;
remoteName = connection.GetRemotePartyName(); remoteName = connection.GetRemotePartyName();
cd.call_reference = connection.GetCallReference(); cd.call_reference = connection.GetCallReference();
cd.call_token = strdup((const char *)clearedCallToken); cd.call_token = strdup((const char *)clearedCallToken);
cd.call_source_aliases = strdup((const char *)connection.GetRemotePartyName()); cd.call_source_aliases = strdup((const char *)connection.GetRemotePartyName());
connection.GetSignallingChannel()->GetRemoteAddress().GetIpAndPort(Ip, sourcePort); connection.GetSignallingChannel()->GetRemoteAddress().GetIpAndPort(Ip, sourcePort);
cd.sourceIp = strdup((const char *)Ip.AsString()); cd.sourceIp = strdup((const char *)Ip.AsString());
/* Convert complex strings */ /* Convert complex strings */
char *s; char *s;
if ((s = strchr(cd.call_source_aliases, ' ')) != NULL) if ((s = strchr(cd.call_source_aliases, ' ')) != NULL) {
*s = '\0'; *s = '\0';
}
switch (connection.GetCallEndReason()) { switch (connection.GetCallEndReason()) {
case H323Connection::EndedByCallForwarded : case H323Connection::EndedByCallForwarded:
if (h323debug) if (h323debug) {
cout << " -- " << remoteName << " has forwarded the call" << endl; cout << "-- " << remoteName << " has forwarded the call" << endl;
}
break; break;
case H323Connection::EndedByRemoteUser : case H323Connection::EndedByRemoteUser:
if (h323debug) if (h323debug) {
cout << " -- " << remoteName << " has cleared the call" << endl; cout << "-- " << remoteName << " has cleared the call" << endl;
}
break; break;
case H323Connection::EndedByCallerAbort : case H323Connection::EndedByCallerAbort:
if (h323debug) if (h323debug) {
cout << " -- " << remoteName << " has stopped calling" << endl; cout << "-- " << remoteName << " has stopped calling" << endl;
}
break; break;
case H323Connection::EndedByRefusal : case H323Connection::EndedByRefusal:
if (h323debug) if (h323debug) {
cout << " -- " << remoteName << " did not accept your call" << endl; cout << "-- " << remoteName << " did not accept your call" << endl;
}
break; break;
case H323Connection::EndedByRemoteBusy : case H323Connection::EndedByRemoteBusy:
if (h323debug) if (h323debug) {
cout << " -- " << remoteName << " was busy" << endl; cout << "-- " << remoteName << " was busy" << endl;
}
break; break;
case H323Connection::EndedByRemoteCongestion : case H323Connection::EndedByRemoteCongestion:
if (h323debug) if (h323debug) {
cout << " -- Congested link to " << remoteName << endl; cout << "-- Congested link to " << remoteName << endl;
}
break; break;
case H323Connection::EndedByNoAnswer : case H323Connection::EndedByNoAnswer:
if (h323debug) if (h323debug) {
cout << " -- " << remoteName << " did not answer your call" << endl; cout << "-- " << remoteName << " did not answer your call" << endl;
}
break; break;
case H323Connection::EndedByTransportFail : case H323Connection::EndedByTransportFail:
if (h323debug) if (h323debug) {
cout << " -- Call with " << remoteName << " ended abnormally" << endl; cout << "-- Call with " << remoteName << " ended abnormally" << endl;
}
break; break;
case H323Connection::EndedByCapabilityExchange : case H323Connection::EndedByCapabilityExchange:
if (h323debug) if (h323debug) {
cout << " -- Could not find common codec with " << remoteName << endl; cout << "-- Could not find common codec with " << remoteName << endl;
}
break; break;
case H323Connection::EndedByNoAccept : case H323Connection::EndedByNoAccept:
if (h323debug) if (h323debug) {
cout << " -- Did not accept incoming call from " << remoteName << endl; cout << "-- Did not accept incoming call from " << remoteName << endl;
}
break; break;
case H323Connection::EndedByAnswerDenied : case H323Connection::EndedByAnswerDenied:
if (h323debug) if (h323debug) {
cout << " -- Refused incoming call from " << remoteName << endl; cout << "-- Refused incoming call from " << remoteName << endl;
}
break; break;
case H323Connection::EndedByNoUser : case H323Connection::EndedByNoUser:
if (h323debug) if (h323debug) {
cout << " -- Remote endpoint could not find user: " << remoteName << endl; cout << "-- Remote endpoint could not find user: " << remoteName << endl;
}
break; break;
case H323Connection::EndedByNoBandwidth : case H323Connection::EndedByNoBandwidth:
if (h323debug) if (h323debug) {
cout << " -- Call to " << remoteName << " aborted, insufficient bandwidth." << endl; cout << "-- Call to " << remoteName << " aborted, insufficient bandwidth." << endl;
}
break; break;
case H323Connection::EndedByUnreachable : case H323Connection::EndedByUnreachable:
if (h323debug) if (h323debug) {
cout << " -- " << remoteName << " could not be reached." << endl; cout << "-- " << remoteName << " could not be reached." << endl;
}
break; break;
case H323Connection::EndedByHostOffline : case H323Connection::EndedByHostOffline:
if (h323debug) if (h323debug) {
cout << " -- " << remoteName << " is not online." << endl; cout << "-- " << remoteName << " is not online." << endl;
}
break; break;
case H323Connection::EndedByNoEndPoint : case H323Connection::EndedByNoEndPoint:
if (h323debug) if (h323debug) {
cout << " -- No phone running for " << remoteName << endl; cout << "-- No phone running for " << remoteName << endl;
}
break; break;
case H323Connection::EndedByConnectFail : case H323Connection::EndedByConnectFail:
if (h323debug) if (h323debug) {
cout << " -- Transport error calling " << remoteName << endl; cout << "-- Transport error calling " << remoteName << endl;
}
break; break;
default : default:
if (h323debug) if (h323debug)
cout << " -- Call with " << remoteName << " completed (" << connection.GetCallEndReason() << ")" << endl; cout << " -- Call with " << remoteName << " completed (" << connection.GetCallEndReason() << ")" << endl;
} }
if(connection.IsEstablished()) if (connection.IsEstablished()) {
if (h323debug) if (h323debug) {
cout << " -- Call duration " << setprecision(0) << setw(5) << (PTime() - connection.GetConnectionStartTime()) << endl; cout << "\t-- Call duration " << setprecision(0) << setw(5) << (PTime() - connection.GetConnectionStartTime()) << endl;
}
}
/* Invoke the PBX application registered callback */ /* Invoke the PBX application registered callback */
on_connection_cleared(cd); on_connection_cleared(cd);
return; return;
} }
H323Connection * MyH323EndPoint::CreateConnection(unsigned callReference, void *o) H323Connection * MyH323EndPoint::CreateConnection(unsigned callReference, void *o)
{ {
unsigned options = 0; unsigned options = 0;
@ -466,6 +476,7 @@ H323Connection * MyH323EndPoint::CreateConnection(unsigned callReference, void *
} else { } else {
options |= H323Connection::H245TunnelingOptionEnable; options |= H323Connection::H245TunnelingOptionEnable;
} }
/* Disable until I can figure out the proper way to deal with this */
#if 0 #if 0
if (opts->noSilenceSuppression) { if (opts->noSilenceSuppression) {
options |= H323Connection::SilenceSuppresionOptionDisable; options |= H323Connection::SilenceSuppresionOptionDisable;
@ -476,7 +487,7 @@ H323Connection * MyH323EndPoint::CreateConnection(unsigned callReference, void *
return new MyH323Connection(*this, callReference, options); return new MyH323Connection(*this, callReference, options);
} }
/* MyH323Connection */ /* MyH323Connection Implementation */
MyH323Connection::MyH323Connection(MyH323EndPoint & ep, unsigned callReference, MyH323Connection::MyH323Connection(MyH323EndPoint & ep, unsigned callReference,
unsigned options) unsigned options)
: H323Connection(ep, callReference, options) : H323Connection(ep, callReference, options)
@ -500,9 +511,9 @@ H323Connection::AnswerCallResponse MyH323Connection::OnAnswerCall(const PString
H323SignalPDU & /*connectPDU*/) H323SignalPDU & /*connectPDU*/)
{ {
if (h323debug) if (h323debug) {
cout << "\t=-= In OnAnswerCall for call " << GetCallReference() << endl; cout << "\t=-= In OnAnswerCall for call " << GetCallReference() << endl;
}
if (!on_answer_call(GetCallReference(), (const char *)GetCallToken())) { if (!on_answer_call(GetCallReference(), (const char *)GetCallToken())) {
return H323Connection::AnswerCallDenied; return H323Connection::AnswerCallDenied;
} }
@ -511,12 +522,12 @@ H323Connection::AnswerCallResponse MyH323Connection::OnAnswerCall(const PString
return H323Connection::AnswerCallDeferred; return H323Connection::AnswerCallDeferred;
} }
BOOL MyH323Connection::OnAlerting(const H323SignalPDU & /*alertingPDU*/, const PString & username) BOOL MyH323Connection::OnAlerting(const H323SignalPDU & /*alertingPDU*/, const PString & username)
{ {
if (h323debug) { if (h323debug) {
cout << "\t =-= In OnAlerting for call " << GetCallReference() cout << "\t=-= In OnAlerting for call " << GetCallReference()
<< ": sessionId=" << sessionId << endl; << ": sessionId=" << sessionId << endl;
cout << " -- Ringing phone for \"" << username << "\"" << endl; cout << "\t-- Ringing phone for \"" << username << "\"" << endl;
} }
on_chan_ringing(GetCallReference(), (const char *)GetCallToken() ); on_chan_ringing(GetCallReference(), (const char *)GetCallToken() );
return TRUE; return TRUE;
@ -524,11 +535,6 @@ BOOL MyH323Connection::OnAlerting(const H323SignalPDU & /*alertingPDU*/, const
BOOL MyH323Connection::OnReceivedSignalSetup(const H323SignalPDU & setupPDU) BOOL MyH323Connection::OnReceivedSignalSetup(const H323SignalPDU & setupPDU)
{ {
if (h323debug) {
ast_verbose(" -- Received SETUP message\n");
}
call_details_t cd; call_details_t cd;
PString sourceE164; PString sourceE164;
PString destE164; PString destE164;
@ -539,6 +545,10 @@ BOOL MyH323Connection::OnReceivedSignalSetup(const H323SignalPDU & setupPDU)
WORD sourcePort; WORD sourcePort;
char *s, *s1; char *s, *s1;
if (h323debug) {
cout << ("\t--Received SETUP message\n");
}
sourceAliases = setupPDU.GetSourceAliases(); sourceAliases = setupPDU.GetSourceAliases();
destAliases = setupPDU.GetDestinationAlias(); destAliases = setupPDU.GetDestinationAlias();
@ -551,21 +561,24 @@ BOOL MyH323Connection::OnReceivedSignalSetup(const H323SignalPDU & setupPDU)
/* Convert complex strings */ /* Convert complex strings */
// FIXME: deal more than one source alias // FIXME: deal more than one source alias
if ((s = strchr(sourceAliases, ' ')) != NULL) if ((s = strchr(sourceAliases, ' ')) != NULL) {
*s = '\0'; *s = '\0';
if ((s = strchr(sourceAliases, '\t')) != NULL) }
if ((s = strchr(sourceAliases, '\t')) != NULL) {
*s = '\0'; *s = '\0';
if ((s1 = strchr(destAliases, ' ')) != NULL) }
if ((s1 = strchr(destAliases, ' ')) != NULL) {
*s1 = '\0'; *s1 = '\0';
if ((s1 = strchr(destAliases, '\t')) != NULL) }
if ((s1 = strchr(destAliases, '\t')) != NULL) {
*s1 = '\0'; *s1 = '\0';
}
cd.call_reference = GetCallReference(); cd.call_reference = GetCallReference();
Lock(); Lock();
cd.call_token = strdup((const char *)GetCallToken()); cd.call_token = strdup((const char *)GetCallToken());
Unlock(); Unlock();
cd.call_source_aliases = strdup((const char *)sourceAliases); cd.call_source_aliases = strdup((const char *)sourceAliases);
cd.call_dest_alias = strdup((const char *)destAliases); cd.call_dest_alias = strdup((const char *)destAliases);
cd.call_source_e164 = strdup((const char *)sourceE164); cd.call_source_e164 = strdup((const char *)sourceE164);
cd.call_dest_e164 = strdup((const char *)destE164); cd.call_dest_e164 = strdup((const char *)destE164);
@ -583,7 +596,6 @@ BOOL MyH323Connection::OnReceivedSignalSetup(const H323SignalPDU & setupPDU)
} }
return FALSE; return FALSE;
} }
return H323Connection::OnReceivedSignalSetup(setupPDU); return H323Connection::OnReceivedSignalSetup(setupPDU);
} }
@ -606,15 +618,18 @@ BOOL MyH323Connection::OnSendSignalSetup(H323SignalPDU & setupPDU)
/* Convert complex strings */ /* Convert complex strings */
// FIXME: deal more than one source alias // FIXME: deal more than one source alias
if ((s = strchr(sourceAliases, ' ')) != NULL) if ((s = strchr(sourceAliases, ' ')) != NULL) {
*s = '\0'; *s = '\0';
if ((s = strchr(sourceAliases, '\t')) != NULL) }
if ((s = strchr(sourceAliases, '\t')) != NULL) {
*s = '\0'; *s = '\0';
if ((s1 = strchr(destAliases, ' ')) != NULL) }
if ((s1 = strchr(destAliases, ' ')) != NULL) {
*s1 = '\0'; *s1 = '\0';
if ((s1 = strchr(destAliases, '\t')) != NULL) }
if ((s1 = strchr(destAliases, '\t')) != NULL) {
*s1 = '\0'; *s1 = '\0';
}
cd.call_reference = GetCallReference(); cd.call_reference = GetCallReference();
Lock(); Lock();
cd.call_token = strdup((const char *)GetCallToken()); cd.call_token = strdup((const char *)GetCallToken());
@ -624,22 +639,20 @@ BOOL MyH323Connection::OnSendSignalSetup(H323SignalPDU & setupPDU)
cd.call_source_e164 = strdup((const char *)sourceE164); cd.call_source_e164 = strdup((const char *)sourceE164);
cd.call_dest_e164 = strdup((const char *)destE164); cd.call_dest_e164 = strdup((const char *)destE164);
int res = on_outgoing_call(cd); int res = on_outgoing_call(cd);
if (!res) { if (!res) {
if (h323debug) { if (h323debug) {
cout << " -- Call Failed" << endl; cout << "\t-- Call Failed" << endl;
} }
return FALSE; return FALSE;
} }
return H323Connection::OnSendSignalSetup(setupPDU); return H323Connection::OnSendSignalSetup(setupPDU);
} }
BOOL MyH323Connection::OnSendReleaseComplete(H323SignalPDU & releaseCompletePDU) BOOL MyH323Connection::OnSendReleaseComplete(H323SignalPDU & releaseCompletePDU)
{ {
if (h323debug) { if (h323debug) {
cout << " -- Sending RELEASE COMPLETE" << endl; cout << "\t-- Sending RELEASE COMPLETE" << endl;
} }
return H323Connection::OnSendReleaseComplete(releaseCompletePDU); return H323Connection::OnSendReleaseComplete(releaseCompletePDU);
} }
@ -647,7 +660,7 @@ BOOL MyH323Connection::OnSendReleaseComplete(H323SignalPDU & releaseCompletePDU)
BOOL MyH323Connection::OnReceivedFacility(const H323SignalPDU & pdu) BOOL MyH323Connection::OnReceivedFacility(const H323SignalPDU & pdu)
{ {
if (h323debug) { if (h323debug) {
cout << " -- Received Facility message... " << endl; cout << "\t-- Received Facility message... " << endl;
} }
return H323Connection::OnReceivedFacility(pdu); return H323Connection::OnReceivedFacility(pdu);
} }
@ -655,7 +668,7 @@ BOOL MyH323Connection::OnReceivedFacility(const H323SignalPDU & pdu)
void MyH323Connection::OnReceivedReleaseComplete(const H323SignalPDU & pdu) void MyH323Connection::OnReceivedReleaseComplete(const H323SignalPDU & pdu)
{ {
if (h323debug) { if (h323debug) {
cout << " -- Received RELEASE COMPLETE message..." << endl; cout << "\t-- Received RELEASE COMPLETE message..." << endl;
} }
return H323Connection::OnReceivedReleaseComplete(pdu); return H323Connection::OnReceivedReleaseComplete(pdu);
} }
@ -663,16 +676,15 @@ void MyH323Connection::OnReceivedReleaseComplete(const H323SignalPDU & pdu)
BOOL MyH323Connection::OnClosingLogicalChannel(H323Channel & channel) BOOL MyH323Connection::OnClosingLogicalChannel(H323Channel & channel)
{ {
if (h323debug) { if (h323debug) {
cout << " -- Closing logical channel..." << endl; cout << "\t-- Closing logical channel..." << endl;
} }
return H323Connection::OnClosingLogicalChannel(channel); return H323Connection::OnClosingLogicalChannel(channel);
} }
void MyH323Connection::SendUserInputTone(char tone, unsigned duration) void MyH323Connection::SendUserInputTone(char tone, unsigned duration)
{ {
if (h323debug) { if (h323debug) {
cout << " -- Sending user input tone (" << tone << ") to remote" << endl; cout << "\t-- Sending user input tone (" << tone << ") to remote" << endl;
} }
on_send_digit(GetCallReference(), tone, (const char *)GetCallToken()); on_send_digit(GetCallReference(), tone, (const char *)GetCallToken());
H323Connection::SendUserInputTone(tone, duration); H323Connection::SendUserInputTone(tone, duration);
@ -682,7 +694,7 @@ void MyH323Connection::OnUserInputTone(char tone, unsigned duration, unsigned lo
{ {
if (mode == H323_DTMF_INBAND) { if (mode == H323_DTMF_INBAND) {
if (h323debug) { if (h323debug) {
cout << " -- Received user input tone (" << tone << ") from remote" << endl; cout << "\t-- Received user input tone (" << tone << ") from remote" << endl;
} }
on_send_digit(GetCallReference(), tone, (const char *)GetCallToken()); on_send_digit(GetCallReference(), tone, (const char *)GetCallToken());
} }
@ -693,7 +705,7 @@ void MyH323Connection::OnUserInputString(const PString &value)
{ {
if (mode == H323_DTMF_RFC2833) { if (mode == H323_DTMF_RFC2833) {
if (h323debug) { if (h323debug) {
cout << " -- Received user input string (" << value << ") from remote." << endl; cout << "\t-- Received user input string (" << value << ") from remote." << endl;
} }
on_send_digit(GetCallReference(), value[0], (const char *)GetCallToken()); on_send_digit(GetCallReference(), value[0], (const char *)GetCallToken());
} }
@ -719,13 +731,12 @@ BOOL MyH323Connection::OnStartLogicalChannel(H323Channel & channel)
cout << (const char *)(channel.GetCapability()).GetFormatName() << endl; cout << (const char *)(channel.GetCapability()).GetFormatName() << endl;
} }
/* adjust the count of channels we have open */ /* Increase the count of channels we have open */
channelsOpen++; channelsOpen++;
if (h323debug) { if (h323debug) {
cout << "\t\t-- channelsOpen = " << channelsOpen << endl; cout << "\t\t-- channelsOpen = " << channelsOpen << endl;
} }
return TRUE; return TRUE;
} }
@ -752,7 +763,7 @@ MyH323_ExternalRTPChannel::MyH323_ExternalRTPChannel(MyH323Connection & connecti
free(info); free(info);
} }
// Get the payload code /* Get the payload code */
OpalMediaFormat format(capability.GetFormatName(), FALSE); OpalMediaFormat format(capability.GetFormatName(), FALSE);
payloadCode = format.GetPayloadType(); payloadCode = format.GetPayloadType();
} }
@ -880,8 +891,8 @@ int h323_set_capability(int cap, int dtmfMode)
oldcaps = endPoint->GetCapabilities(); oldcaps = endPoint->GetCapabilities();
for (PINDEX i=0; i< oldcaps.GetSize(); i++) { for (PINDEX i=0; i< oldcaps.GetSize(); i++) {
codecs.AppendString(oldcaps[i].GetFormatName()); codecs.AppendString(oldcaps[i].GetFormatName());
} }
endPoint->RemoveCapabilities(codecs); endPoint->RemoveCapabilities(codecs);
mode = dtmfMode; mode = dtmfMode;
if (dtmfMode == H323_DTMF_INBAND) { if (dtmfMode == H323_DTMF_INBAND) {
@ -948,16 +959,12 @@ int h323_start_listener(int listenPort, struct sockaddr_in bindaddr)
} }
PIPSocket::Address interfaceAddress(bindaddr.sin_addr); PIPSocket::Address interfaceAddress(bindaddr.sin_addr);
if (!listenPort) { if (!listenPort) {
listenPort = 1720; listenPort = 1720;
} }
/** H.323 listener */ /** H.323 listener */
H323ListenerTCP *tcpListener; H323ListenerTCP *tcpListener;
tcpListener = new H323ListenerTCP(*endPoint, interfaceAddress, (WORD)listenPort); tcpListener = new H323ListenerTCP(*endPoint, interfaceAddress, (WORD)listenPort);
if (!endPoint->StartListener(tcpListener)) { if (!endPoint->StartListener(tcpListener)) {
cout << "ERROR: Could not open H.323 listener port on " << ((H323ListenerTCP *) tcpListener)->GetListenerPort() << endl; cout << "ERROR: Could not open H.323 listener port on " << ((H323ListenerTCP *) tcpListener)->GetListenerPort() << endl;
delete tcpListener; delete tcpListener;
@ -965,11 +972,9 @@ int h323_start_listener(int listenPort, struct sockaddr_in bindaddr)
} }
cout << " == H.323 listener started" << endl; cout << " == H.323 listener started" << endl;
return 0; return 0;
}; };
int h323_set_alias(struct oh323_alias *alias) int h323_set_alias(struct oh323_alias *alias)
{ {
char *p; char *p;
@ -982,29 +987,27 @@ int h323_set_alias(struct oh323_alias *alias)
return 1; return 1;
} }
cout << " == Adding alias \"" << h323id << "\" to endpoint" << endl; cout << "== Adding alias \"" << h323id << "\" to endpoint" << endl;
endPoint->AddAliasName(h323id); endPoint->AddAliasName(h323id);
endPoint->RemoveAliasName(localProcess->GetUserName()); endPoint->RemoveAliasName(localProcess->GetUserName());
if (!e164.IsEmpty()) { if (!e164.IsEmpty()) {
cout << " == Adding E.164 \"" << e164 << "\" to endpoint" << endl; cout << "== Adding E.164 \"" << e164 << "\" to endpoint" << endl;
endPoint->AddAliasName(e164); endPoint->AddAliasName(e164);
} }
if (strlen(alias->prefix)) { if (strlen(alias->prefix)) {
p = alias->prefix; p = alias->prefix;
num = strsep(&p, ","); num = strsep(&p, ",");
while(num) { while(num) {
cout << " == Adding Prefix \"" << num << "\" to endpoint" << endl; cout << "== Adding Prefix \"" << num << "\" to endpoint" << endl;
endPoint->SupportedPrefixes += PString(num); endPoint->SupportedPrefixes += PString(num);
endPoint->SetGateway(); endPoint->SetGateway();
num = strsep(&p, ","); num = strsep(&p, ",");
} }
} }
return 0; return 0;
} }
void h323_set_id(char *id) void h323_set_id(char *id)
{ {
PString h323id(id); PString h323id(id);
@ -1012,7 +1015,6 @@ void h323_set_id(char *id)
if (h323debug) { if (h323debug) {
cout << " == Using '" << h323id << "' as our H.323ID for this call" << endl; cout << " == Using '" << h323id << "' as our H.323ID for this call" << endl;
} }
/* EVIL HACK */ /* EVIL HACK */
endPoint->SetLocalUserName(h323id); endPoint->SetLocalUserName(h323id);
} }
@ -1022,14 +1024,13 @@ void h323_show_tokens(void)
cout << "Current call tokens: " << setprecision(2) << endPoint->GetAllConnections() << endl; cout << "Current call tokens: " << setprecision(2) << endPoint->GetAllConnections() << endl;
} }
/** Establish Gatekeeper communiations, if so configured, /** Establish Gatekeeper communiations, if so configured,
* register aliases for the H.323 endpoint to respond to. * register aliases for the H.323 endpoint to respond to.
*/ */
int h323_set_gk(int gatekeeper_discover, char *gatekeeper, char *secret) int h323_set_gk(int gatekeeper_discover, char *gatekeeper, char *secret)
{ {
PString gkName = PString(gatekeeper); PString gkName = PString(gatekeeper);
PString pass = PString(secret); PString pass = PString(secret);
H323TransportUDP *rasChannel; H323TransportUDP *rasChannel;
if (!h323_end_point_exist()) { if (!h323_end_point_exist()) {
@ -1041,36 +1042,32 @@ int h323_set_gk(int gatekeeper_discover, char *gatekeeper, char *secret)
cout << "Error: Gatekeeper cannot be NULL" << endl; cout << "Error: Gatekeeper cannot be NULL" << endl;
return 1; return 1;
} }
if (strlen(secret)) { if (strlen(secret)) {
endPoint->SetGatekeeperPassword(pass); endPoint->SetGatekeeperPassword(pass);
} }
if (gatekeeper_discover) { if (gatekeeper_discover) {
/* discover the gk using multicast */ /* discover the gk using multicast */
if (endPoint->DiscoverGatekeeper(new H323TransportUDP(*endPoint))) { if (endPoint->DiscoverGatekeeper(new H323TransportUDP(*endPoint))) {
cout << " == Using " << (endPoint->GetGatekeeper())->GetName() << " as our Gatekeeper." << endl; cout << "== Using " << (endPoint->GetGatekeeper())->GetName() << " as our Gatekeeper." << endl;
} else { } else {
cout << " *** Could not find a gatekeeper." << endl; cout << "Warning: Could not find a gatekeeper." << endl;
return 1; return 1;
} }
} else { } else {
rasChannel = new H323TransportUDP(*endPoint); rasChannel = new H323TransportUDP(*endPoint);
if (!rasChannel) { if (!rasChannel) {
cout << " *** No RAS Channel, this is bad" << endl; cout << "Error: No RAS Channel, this is bad" << endl;
return 1; return 1;
} }
if (endPoint->SetGatekeeper(gkName, rasChannel)) { if (endPoint->SetGatekeeper(gkName, rasChannel)) {
cout << " == Using " << (endPoint->GetGatekeeper())->GetName() << " as our Gatekeeper." << endl; cout << "== Using " << (endPoint->GetGatekeeper())->GetName() << " as our Gatekeeper." << endl;
} else { } else {
cout << " *** Error registering with gatekeeper \"" << gkName << "\". " << endl; cout << "Error registering with gatekeeper \"" << gkName << "\". " << endl;
/* XXX Maybe we should fire a new thread to attempt to re-register later and not kill asterisk here? */ /* XXX Maybe we should fire a new thread to attempt to re-register later and not kill asterisk here? */
return 1; return 1;
} }
} }
return 0; return 0;
} }
@ -1083,7 +1080,6 @@ void h323_send_tone(const char *call_token, char tone)
cout << "ERROR: [h323_send_tone] No Endpoint, this is bad!" << endl; cout << "ERROR: [h323_send_tone] No Endpoint, this is bad!" << endl;
return; return;
} }
PString token = PString(call_token); PString token = PString(call_token);
endPoint->SendUserTone(token, tone); endPoint->SendUserTone(token, tone);
} }
@ -1109,7 +1105,6 @@ int h323_clear_call(const char *call_token)
if (!h323_end_point_exist()) { if (!h323_end_point_exist()) {
return 1; return 1;
} }
endPoint->ClearCall(PString(call_token)); endPoint->ClearCall(PString(call_token));
return 0; return 0;
}; };
@ -1120,19 +1115,16 @@ int h323_send_alerting(const char *token)
const PString currentToken(token); const PString currentToken(token);
H323Connection * connection; H323Connection * connection;
if (h323debug) {
cout << "\tSending alerting\n" << endl;
}
connection = endPoint->FindConnectionWithLock(currentToken); connection = endPoint->FindConnectionWithLock(currentToken);
if (h323debug)
ast_verbose("\tSending alerting\n");
if (!connection) { if (!connection) {
cout << "No connection found for " << token << endl; cout << "No connection found for " << token << endl;
return -1; return -1;
} }
connection->AnsweringCall(H323Connection::AnswerCallPending); connection->AnsweringCall(H323Connection::AnswerCallPending);
connection->Unlock(); connection->Unlock();
return 0; return 0;
} }
@ -1144,15 +1136,12 @@ int h323_send_progress(const char *token)
H323Connection * connection; H323Connection * connection;
connection = endPoint->FindConnectionWithLock(currentToken); connection = endPoint->FindConnectionWithLock(currentToken);
if (!connection) { if (!connection) {
cout << "No connection found for " << token << endl; cout << "No connection found for " << token << endl;
return -1; return -1;
} }
connection->AnsweringCall(H323Connection::AnswerCallDeferredWithMedia); connection->AnsweringCall(H323Connection::AnswerCallDeferredWithMedia);
connection->Unlock(); connection->Unlock();
return 0; return 0;
} }
@ -1165,25 +1154,25 @@ int h323_answering_call(const char *token, int busy)
connection = endPoint->FindConnectionWithLock(currentToken); connection = endPoint->FindConnectionWithLock(currentToken);
if (connection == NULL) { if (!connection) {
cout << "No connection found for " << token << endl; cout << "No connection found for " << token << endl;
return -1; return -1;
} }
if (!busy) { if (!busy) {
if (h323debug) if (h323debug) {
ast_verbose("\tanswering call\n"); cout << "\tAnswering call " << token << endl;
}
connection->AnsweringCall(H323Connection::AnswerCallNow); connection->AnsweringCall(H323Connection::AnswerCallNow);
} else { } else {
if (h323debug) if (h323debug) {
ast_verbose("\tdenying call\n"); cout << "\tdenying call " << token << endl;
}
connection->AnsweringCall(H323Connection::AnswerCallDenied); connection->AnsweringCall(H323Connection::AnswerCallDenied);
} }
connection->Unlock(); connection->Unlock();
return 0; return 0;
} }
int h323_show_codec(int fd, int argc, char *argv[]) int h323_show_codec(int fd, int argc, char *argv[])
{ {
cout << "Allowed Codecs:\n\t" << setprecision(2) << endPoint->GetCapabilities() << endl; cout << "Allowed Codecs:\n\t" << setprecision(2) << endPoint->GetCapabilities() << endl;
@ -1205,7 +1194,7 @@ void h323_native_bridge(const char *token, const char *them, char *capability)
H323Channel *channel; H323Channel *channel;
MyH323Connection *connection = (MyH323Connection *)endPoint->FindConnectionWithLock(token); MyH323Connection *connection = (MyH323Connection *)endPoint->FindConnectionWithLock(token);
if (!connection){ if (!connection) {
cout << "ERROR: No connection found, this is bad\n"; cout << "ERROR: No connection found, this is bad\n";
return; return;
} }

View File

@ -30,8 +30,7 @@
#define AST_H323_H #define AST_H323_H
/** These need to be redefined here because the C++ /** These need to be redefined here because the C++
side of this driver is blind to the asterisk headers */ side of this driver is blind to the asterisk headers */
/*! G.723.1 compression */ /*! G.723.1 compression */
#define AST_FORMAT_G723_1 (1 << 0) #define AST_FORMAT_G723_1 (1 << 0)
/*! GSM compression */ /*! GSM compression */
@ -61,31 +60,16 @@ class H323_G7231Capability : public H323AudioCapability
{ {
PCLASSINFO(H323_G7231Capability, H323AudioCapability); PCLASSINFO(H323_G7231Capability, H323AudioCapability);
public: public:
H323_G7231Capability( H323_G7231Capability(BOOL annexA = TRUE);
BOOL annexA = TRUE /// Enable Annex A silence insertion descriptors Comparison Compare(const PObject & obj) const;
); PObject * Clone() const;
Comparison Compare(const PObject & obj) const; virtual H323Codec * CreateCodec(H323Codec::Direction direction) const;
PObject * Clone() const;
virtual H323Codec * CreateCodec(
H323Codec::Direction direction /// Direction in which this instance runs
) const;
unsigned GetSubType() const; unsigned GetSubType() const;
PString GetFormatName() const; PString GetFormatName() const;
BOOL OnSendingPDU( BOOL OnSendingPDU(H245_AudioCapability & pdu, unsigned packetSize) const;
H245_AudioCapability & pdu, /// PDU to set information on BOOL OnReceivedPDU(const H245_AudioCapability & pdu, unsigned & packetSize);
unsigned packetSize /// Packet size to use in capability
) const;
BOOL OnReceivedPDU(
const H245_AudioCapability & pdu, /// PDU to get information from
unsigned & packetSize /// Packet size to use in capability
);
protected: protected:
BOOL annexA; BOOL annexA;
}; };
/**This class describes the (fake) G729 codec capability. /**This class describes the (fake) G729 codec capability.
@ -95,100 +79,56 @@ class AST_G729Capability : public H323AudioCapability
PCLASSINFO(AST_G729Capability, H323AudioCapability); PCLASSINFO(AST_G729Capability, H323AudioCapability);
public: public:
/**@name Construction */
//@{
/**Create a new G.729 capability.
*/
AST_G729Capability(); AST_G729Capability();
//@} /* Create a copy of the object. */
/**@name Overrides from class PObject */
//@{
/**Create a copy of the object.
*/
virtual PObject * Clone() const; virtual PObject * Clone() const;
//@}
/**@name Operations */ /* Create the codec instance, allocating resources as required. */
//@{ virtual H323Codec * CreateCodec(H323Codec::Direction direction) const;
/**Create the codec instance, allocating resources as required.
*/
virtual H323Codec * CreateCodec(
H323Codec::Direction direction /// Direction in which this instance runs
) const;
//@}
/**@name Identification functions */ /* Get the sub-type of the capability. This is a code dependent on the
//@{
/**Get the sub-type of the capability. This is a code dependent on the
main type of the capability. main type of the capability.
This returns one of the four possible combinations of mode and speed This returns one of the four possible combinations of mode and speed
using the enum values of the protocol ASN H245_AudioCapability class. using the enum values of the protocol ASN H245_AudioCapability class. */
*/
virtual unsigned GetSubType() const; virtual unsigned GetSubType() const;
/**Get the name of the media data format this class represents. /* Get the name of the media data format this class represents. */
*/
virtual PString GetFormatName() const; virtual PString GetFormatName() const;
//@}
}; };
/* This class describes the VoiceAge G729A codec capability. */
/**This class describes the VoiceAge G729A codec capability.
*/
class AST_G729ACapability : public H323AudioCapability class AST_G729ACapability : public H323AudioCapability
{ {
PCLASSINFO(AST_G729ACapability, H323AudioCapability); PCLASSINFO(AST_G729ACapability, H323AudioCapability);
public: public:
/**@name Construction */ /* Create a new G.729A capability. */
//@{
/**Create a new G.729A capability.
*/
AST_G729ACapability(); AST_G729ACapability();
//@}
/**@name Overrides from class PObject */ /* Create a copy of the object. */
//@{
/**Create a copy of the object.
*/
virtual PObject * Clone() const; virtual PObject * Clone() const;
//@} /* Create the codec instance, allocating resources as required. */
virtual H323Codec * CreateCodec(H323Codec::Direction direction) const;
/**@name Operations */ /* Get the sub-type of the capability. This is a code dependent on the
//@{
/**Create the codec instance, allocating resources as required.
*/
virtual H323Codec * CreateCodec(
H323Codec::Direction direction /// Direction in which this instance runs
) const;
//@}
/**@name Identification functions */
//@{
/**Get the sub-type of the capability. This is a code dependent on the
main type of the capability. main type of the capability.
This returns one of the four possible combinations of mode and speed This returns one of the four possible combinations of mode and speed
using the enum values of the protocol ASN H245_AudioCapability class. using the enum values of the protocol ASN H245_AudioCapability class. */
*/
virtual unsigned GetSubType() const; virtual unsigned GetSubType() const;
/**Get the name of the media data format this class represents. /* Get the name of the media data format this class represents. */
*/
virtual PString GetFormatName() const; virtual PString GetFormatName() const;
//@}
}; };
class MyH323EndPoint : public H323EndPoint { class MyH323EndPoint : public H323EndPoint {
PCLASSINFO(MyH323EndPoint, H323EndPoint); PCLASSINFO(MyH323EndPoint, H323EndPoint);
public: public:
int MakeCall(const PString &, PString &, unsigned int *, unsigned int, char *, char *);
int MakeCall(const PString &, PString &, unsigned int *, unsigned int, char *, char *s);
BOOL ClearCall(const PString &); BOOL ClearCall(const PString &);
void OnClosedLogicalChannel(H323Connection &, const H323Channel &); void OnClosedLogicalChannel(H323Connection &, const H323Channel &);
@ -198,13 +138,10 @@ class MyH323EndPoint : public H323EndPoint {
void SendUserTone(const PString &, char); void SendUserTone(const PString &, char);
H323Capabilities GetCapabilities(void); H323Capabilities GetCapabilities(void);
BOOL OnConnectionForwarded(H323Connection &, const PString &, const H323SignalPDU &); BOOL OnConnectionForwarded(H323Connection &, const PString &, const H323SignalPDU &);
BOOL ForwardConnection(H323Connection &, const PString &, const H323SignalPDU &); BOOL ForwardConnection(H323Connection &, const PString &, const H323SignalPDU &);
PStringArray SupportedPrefixes;
void SetEndpointTypeInfo( H225_EndpointType & info ) const; void SetEndpointTypeInfo( H225_EndpointType & info ) const;
void SetGateway(void); void SetGateway(void);
PStringArray SupportedPrefixes;
}; };
class MyH323Connection : public H323Connection { class MyH323Connection : public H323Connection {
@ -214,13 +151,14 @@ class MyH323Connection : public H323Connection {
public: public:
MyH323Connection(MyH323EndPoint &, unsigned, unsigned); MyH323Connection(MyH323EndPoint &, unsigned, unsigned);
~MyH323Connection(); ~MyH323Connection();
H323Channel * CreateRealTimeLogicalChannel(const H323Capability &, H323Channel * CreateRealTimeLogicalChannel(const H323Capability &,
H323Channel::Directions, H323Channel::Directions,
unsigned, unsigned,
const H245_H2250LogicalChannelParameters *, const H245_H2250LogicalChannelParameters *,
RTP_QOS *); RTP_QOS *);
H323Connection::AnswerCallResponse OnAnswerCall(const PString &, const H323SignalPDU &, H323SignalPDU &); H323Connection::AnswerCallResponse OnAnswerCall(const PString &,
const H323SignalPDU &,
H323SignalPDU &);
void OnReceivedReleaseComplete(const H323SignalPDU &); void OnReceivedReleaseComplete(const H323SignalPDU &);
BOOL OnAlerting(const H323SignalPDU &, const PString &); BOOL OnAlerting(const H323SignalPDU &, const PString &);
BOOL OnSendReleaseComplete(H323SignalPDU &); BOOL OnSendReleaseComplete(H323SignalPDU &);
@ -253,7 +191,6 @@ class MyH323_ExternalRTPChannel : public H323_ExternalRTPChannel {
Directions direction, Directions direction,
unsigned sessionID); unsigned sessionID);
/* Destructor */
~MyH323_ExternalRTPChannel(); ~MyH323_ExternalRTPChannel();
/* Overrides */ /* Overrides */
@ -270,7 +207,7 @@ class MyH323_ExternalRTPChannel : public H323_ExternalRTPChannel {
/** /**
* The MyProcess is a necessary descendant PProcess class so that the H323EndPoint * The MyProcess is a necessary descendant PProcess class so that the H323EndPoint
* objected to be created from within that class. (Who owns main() problem). * objected to be created from within that class. (Solves the who owns main() problem).
*/ */
class MyProcess : public PProcess { class MyProcess : public PProcess {

View File

@ -134,21 +134,23 @@ extern setup_incoming_cb on_incoming_call;
typedef int (*setup_outbound_cb)(call_details_t); typedef int (*setup_outbound_cb)(call_details_t);
extern setup_outbound_cb on_outgoing_call; extern setup_outbound_cb on_outgoing_call;
/* This is a callback prototype function, called when openh323 /* This is a callback prototype function, called when
OnAlerting is invoked */ OnAlerting is invoked */
typedef void (*chan_ringing_cb)(unsigned, const char *); typedef void (*chan_ringing_cb)(unsigned, const char *);
extern chan_ringing_cb on_chan_ringing; extern chan_ringing_cb on_chan_ringing;
/* This is a callback protoype function, called when the openh323 /* This is a callback protoype function, called when
OnConnectionEstablished is inovked */ OnConnectionEstablished is inovked */
typedef void (*con_established_cb)(unsigned, const char *); typedef void (*con_established_cb)(unsigned, const char *);
extern con_established_cb on_connection_established; extern con_established_cb on_connection_established;
/* This is a callback prototype function, called when the openH323 /* This is a callback prototype function, called when
OnConnectionCleared callback is invoked */ OnConnectionCleared callback is invoked */
typedef void (*clear_con_cb)(call_details_t); typedef void (*clear_con_cb)(call_details_t);
extern clear_con_cb on_connection_cleared; extern clear_con_cb on_connection_cleared;
/* This is a callback prototype function, called when
an H.323 call is answered */
typedef int (*answer_call_cb)(unsigned, const char *); typedef int (*answer_call_cb)(unsigned, const char *);
extern answer_call_cb on_answer_call; extern answer_call_cb on_answer_call;
@ -179,12 +181,9 @@ extern "C" {
con_established_cb, con_established_cb,
send_digit_cb, send_digit_cb,
answer_call_cb); answer_call_cb);
int h323_set_capability(int, int); int h323_set_capability(int, int);
int h323_set_alias(struct oh323_alias *); int h323_set_alias(struct oh323_alias *);
int h323_set_gk(int, char *, char *); int h323_set_gk(int, char *, char *);
void h323_set_id(char *); void h323_set_id(char *);
void h323_show_tokens(void); void h323_show_tokens(void);
@ -203,12 +202,10 @@ extern "C" {
/* H.323 alerting and progress */ /* H.323 alerting and progress */
int h323_send_alerting(const char *token); int h323_send_alerting(const char *token);
int h323_send_progress(const char *token); int h323_send_progress(const char *token);
int h323_answering_call(const char *token, int); int h323_answering_call(const char *token, int);
int h323_soft_hangup(const char *data); int h323_soft_hangup(const char *data);
int h323_show_codec(int fd, int argc, char *argv[]); int h323_show_codec(int fd, int argc, char *argv[]);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif