[Asterisk-cvs] asterisk/channels/h323 ast_h323.cpp,1.28,1.29 ast_h323.h,1.13,1.14 chan_h323.h,1.13,1.14 h323.conf.sample,1.7,1.8
jeremy at lists.digium.com
jeremy at lists.digium.com
Wed Dec 24 16:45:22 CST 2003
Update of /usr/cvsroot/asterisk/channels/h323
In directory mongoose.digium.com:/tmp/cvs-serv5340
Modified Files:
ast_h323.cpp ast_h323.h chan_h323.h h323.conf.sample
Log Message:
totally revert that highly broken patch. Please test your code before submitting diffs.
Index: ast_h323.cpp
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/h323/ast_h323.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- ast_h323.cpp 23 Dec 2003 23:00:59 -0000 1.28
+++ ast_h323.cpp 24 Dec 2003 22:36:57 -0000 1.29
@@ -41,11 +41,10 @@
/* DTMF Mode */
int mode = H323_DTMF_RFC2833;
-/* Make those variables accessible from chan_h323.c */
-extern "C" {
/** Options for connections creation */
-call_options_t global_options;
-}
+BOOL noFastStart;
+BOOL noH245Tunnelling;
+BOOL noSilenceSuppression;
/**
* We assume that only one endPoint should exist.
@@ -60,27 +59,6 @@
/** H.323 listener */
H323ListenerTCP *tcpListener;
-/* Provide common methods to split out non-user parts of OpenH323 aliases */
-static void FormatAliases(PString & aliases)
-{
- /* Convert complex strings */
- // FIXME: deal more than one source alias
- char *s;
- const char *p = (const char *)aliases;
- if ((s = strchr(p, '(')) != NULL)
- *s = '\0';
- else if ((s = strchr(p, ',')) != NULL)
- *s = '\0';
- else if ((s = strchr(p, '[')) != NULL)
- *s = '\0';
- else if ((s = strchr(p, ' ')) != NULL)
- *s = '\0';
- else if ((s = strchr(p, '\t')) != NULL)
- *s = '\0';
- /* Strip trailing spaces */
- for(s = (char *)(p + strlen(p)); (s > p) && (*--s == ' '); *s = '\0');
-}
-
MyProcess::MyProcess(): PProcess("The NuFone Network's", "H.323 Channel Driver for Asterisk",
MAJOR_VERSION, MINOR_VERSION, BUILD_TYPE, BUILD_NUMBER)
{
@@ -98,7 +76,6 @@
{
cout << " == Creating H.323 Endpoint" << endl;
endPoint = new MyH323EndPoint();
- endPoint->DisableDetectInBandDTMF(TRUE);
PTrace::Initialise(0, NULL, PTrace::Timestamp | PTrace::Thread | PTrace::FileAndLine);
}
@@ -134,7 +111,6 @@
: H323AudioCapability(7, 4)
{
annexA = annexA_;
- rtpPayloadType = RTP_DataFrame::G7231;
}
PObject::Comparison H323_G7231Capability::Compare(const PObject & obj) const
@@ -272,8 +248,7 @@
* port = 1720.
*/
int MyH323EndPoint::MakeCall(const PString & dest, PString & token,
- unsigned int *callReference,
- call_options_t *call_options)
+ unsigned int *callReference, unsigned int port, char *callerid)
{
PString fullAddress;
MyH323Connection * connection;
@@ -289,7 +264,7 @@
cout << " -- Making call to " << fullAddress << "." << endl;
}
- if (!(connection = (MyH323Connection *)H323EndPoint::MakeCallLocked(fullAddress, token, call_options))) {
+ if (!(connection = (MyH323Connection *)H323EndPoint::MakeCallLocked(fullAddress, token))) {
if (h323debug)
cout << "Error making call to \"" << fullAddress << '"' << endl;
return 1;
@@ -297,8 +272,8 @@
*callReference = connection->GetCallReference();
- if (call_options->callerid)
- connection->SetCID(call_options->callerid); // Use our local function to setup H.323 caller ID correctly
+ if (callerid)
+ connection->SetLocalPartyName(PString(callerid));
connection->Unlock();
@@ -312,16 +287,7 @@
void MyH323EndPoint::SetEndpointTypeInfo( H225_EndpointType & info ) const
{
-// cout << " **** Terminal type: " << terminalType << endl;
H323EndPoint::SetEndpointTypeInfo(info);
-// cout << " **** INFO: " << info << endl;
- /* Because H323EndPoint::SetEndpointTypeInfo() don't set correctly
- endpoint type, force manual setting it */
- if(terminalType == e_GatewayOnly)
- {
- info.RemoveOptionalField(H225_EndpointType::e_terminal);
- info.IncludeOptionalField(H225_EndpointType::e_gateway);
- }
info.m_gateway.IncludeOptionalField(H225_GatewayInfo::e_protocol);
info.m_gateway.m_protocol.SetSize(1);
H225_SupportedProtocols &protocol=info.m_gateway.m_protocol[0];
@@ -370,17 +336,17 @@
}
BOOL MyH323EndPoint::OnConnectionForwarded(H323Connection & connection,
- const PString & forwardParty,
- const H323SignalPDU & pdu)
-{
+ const PString & forwardParty,
+ const H323SignalPDU & pdu)
+ {
if (h323debug)
cout << " -- Call Forwarded to " << forwardParty << endl;
return FALSE;
-}
-
+ }
+
BOOL MyH323EndPoint::ForwardConnection(H323Connection & connection,
- const PString & forwardParty,
- const H323SignalPDU & pdu)
+ const PString & forwardParty,
+ const H323SignalPDU & pdu)
{
if (h323debug)
cout << " -- Forwarding call to " << forwardParty << endl;
@@ -403,12 +369,14 @@
call_details_t cd;
- /* Use common alias formatting routine */
- FormatAliases(remoteName);
-
cd.call_reference = connection.GetCallReference();
cd.call_token = (const char *)connection.GetCallToken();
- cd.call_source_aliases = (const char *)remoteName;
+ cd.call_source_aliases = (const char *)connection.GetRemotePartyName();
+
+ /* Convert complex strings */
+ char *s;
+ if ((s = strchr(cd.call_source_aliases, ' ')) != NULL)
+ *s = '\0';
/* Invoke the PBX application registered callback */
on_connection_cleared(cd);
@@ -484,7 +452,7 @@
break;
default :
if (h323debug)
- cout << " -- Call with " << remoteName << " completed (" << connection.GetCallEndReason() << ")" << endl;
+ cout << " -- Call with " << remoteName << " completed" << endl;
}
if(connection.IsEstablished())
if (h323debug)
@@ -495,146 +463,26 @@
H323Connection * MyH323EndPoint::CreateConnection(unsigned callReference, void *outbound)
{
unsigned options = 0;
- call_options_t *call_options = (call_options_t *)outbound;
-
- if (!call_options)
- call_options = &global_options;
- if (call_options->noFastStart)
+ if (noFastStart)
options |= H323Connection::FastStartOptionDisable;
- if (call_options->noH245Tunnelling)
+ if (noH245Tunnelling)
options |= H323Connection::H245TunnelingOptionDisable;
- /* Set silence detection mode - won't work for Asterisk's RTP but can be used in the negotiation process */
- SetSilenceDetectionMode(call_options->noSilenceSuppression ? H323AudioCodec::NoSilenceDetection : H323AudioCodec::AdaptiveSilenceDetection);
-
- return new MyH323Connection(*this, callReference, options, call_options);
-}
-
-/* MyH323_ExternalRTPChannel */
-MyH323_ExternalRTPChannel::MyH323_ExternalRTPChannel(
- H323Connection & connection, /// Connection to endpoint for channel
- const H323Capability & capability, /// Capability channel is using
- Directions direction, /// Direction of channel
- unsigned sessionID /// Session ID for channel
- ): H323_ExternalRTPChannel(connection,capability,direction,sessionID)
-{
-}
-
-MyH323_ExternalRTPChannel::MyH323_ExternalRTPChannel(
- H323Connection & connection, /// Connection to endpoint for channel
- const H323Capability & capability, /// Capability channel is using
- Directions direction, /// Direction of channel
- unsigned sessionID, /// Session ID for channel
- const H323TransportAddress & data, /// Data address
- const H323TransportAddress & control/// Control address
- ): H323_ExternalRTPChannel(connection, capability, direction, sessionID, data, control)
-{
-}
-
-MyH323_ExternalRTPChannel::MyH323_ExternalRTPChannel(
- H323Connection & connection, /// Connection to endpoint for channel
- const H323Capability & capability, /// Capability channel is using
- Directions direction, /// Direction of channel
- unsigned sessionID, /// Session ID for channel
- const PIPSocket::Address & ip, /// IP address of media server
- WORD dataPort /// Data port (control is dataPort+1)
- ): H323_ExternalRTPChannel(connection, capability, direction, sessionID, ip, dataPort)
-{
-}
-
-BOOL MyH323_ExternalRTPChannel::Start()
-{
- BOOL res;
- PIPSocket::Address remoteIpAddress; // IP Address of remote endpoint
- WORD remotePort; // remote endpoint Data port (control is dataPort+1)
- PIPSocket::Address externalIpAddress; // IP address of media server
- WORD externalPort; // local media server Data port (control is dataPort+1)
-
- res = H323_ExternalRTPChannel::Start();
- if (!res)
- return res;
-
- if (h323debug) {
- /* Show H.323 channel number to make debugging more comfortable */
- cout << " -- Started RTP media for channel " << GetNumber() << ": ";
- cout << ((GetDirection()==H323Channel::IsTransmitter)?"sending ":((GetDirection()==H323Channel::IsReceiver)?"receiving ":" "));
- cout << (const char *)(GetCapability()).GetFormatName() << endl;
- }
-
- if(!GetRemoteAddress(remoteIpAddress, remotePort) && h323debug)
- cout << " ** Unable to get remote IP address" << endl;
- externalMediaAddress.GetIpAndPort(externalIpAddress, externalPort);
-
- if (h323debug) {
- cout << " -- remoteIpAddress: " << remoteIpAddress << endl;
- cout << " -- remotePort: " << remotePort << endl;
- cout << " -- ExternalIpAddress: " << externalIpAddress << endl;
- cout << " -- ExternalPort: " << externalPort << endl;
- }
-
- const OpalMediaFormat & mediaFormat = codec->GetMediaFormat();
- if (rtpPayloadType == RTP_DataFrame::IllegalPayloadType) {
- rtpPayloadType = capability->GetPayloadType();
- if (rtpPayloadType == RTP_DataFrame::IllegalPayloadType)
- rtpPayloadType = mediaFormat.GetPayloadType();
- }
-
- /* Deduce direction of starting channel */
- int direction;
- if (GetDirection()==H323Channel::IsTransmitter)
- direction = 1;
- else if (GetDirection()==H323Channel::IsReceiver)
- direction = 0;
- else
- direction = -1;
-
- /* Notify Asterisk of remote RTP information */
- /* direction and payload arguments needs to
- * correctly setup RTP transport
- */
- on_start_logical_channel(connection.GetCallReference(), (const char *)remoteIpAddress.AsString(), remotePort, direction, (int)rtpPayloadType);
-
- return TRUE;
-}
-
-/* MyH323Connection */
-MyH323Connection::MyH323Connection(MyH323EndPoint & ep,
- unsigned callReference,
- unsigned options)
- : H323Connection(ep,
- callReference,
- options)
-{
- remoteIpAddress = 0; // IP Address of remote endpoint
- remotePort = 0; // remote endpoint Data port (control is dataPort+1)
-
- progressSetup = global_options.progress_setup;
- progressAlert = global_options.progress_alert;
-
- if (h323debug)
- cout << " == New H.323 Connection created." << endl;
- return;
+ return new MyH323Connection(*this, callReference, options);
}
/* MyH323Connection */
MyH323Connection::MyH323Connection(MyH323EndPoint & ep,
- unsigned callReference,
- unsigned options,
- call_options_t *call_options)
- : H323Connection(ep,
- callReference,
- options)
+ unsigned callReference,
+ unsigned options)
+ : H323Connection(ep,
+ callReference,
+ options)
{
- remoteIpAddress = 0; // IP Address of remote endpoint
- remotePort = 0; // remote endpoint Data port (control is dataPort+1)
-
- if (!call_options)
- call_options = &global_options;
-
- progressSetup = call_options->progress_setup;
- progressAlert = call_options->progress_alert;
+ remoteIpAddress = 0; // IP Address of remote endpoint
+ remotePort = 0; // remote endpoint Data port (control is dataPort+1)
if (h323debug)
cout << " == New H.323 Connection created." << endl;
@@ -648,118 +496,20 @@
return;
}
-/* Declare reference to standard Asterisk's callerid parser */
-extern "C" {
- void ast_callerid_parse(const char *, char **, char **);
-}
-
-/*
- * Setup H.323 caller ID to allow OpenH323 to set up Q.931's
- * IE:DisplayName and IE:DisplayNumber fields correctly
- */
-void MyH323Connection::SetCID(const char *callerid)
-{
- char *name;
- char *num;
-
- ast_callerid_parse(callerid, &name, &num);
-
- if (h323debug)
- cout << "name=" << name << ", num=" << num << endl;
-
- if ((name && *name) || (num && *num))
- {
- localAliasNames.RemoveAll();
- if(name && *name) {
- SetLocalPartyName(PString(name));
-// localAliasNames.AppendString(name);
- }
- if(num && *num)
- localAliasNames.AppendString(PString(num));
- }
-}
-
-BOOL MyH323Connection::OnReceivedProgress(const H323SignalPDU & pdu)
-{
- BOOL res;
-
- res = H323Connection::OnReceivedProgress(pdu);
-
- if(res && on_progress) {
- BOOL inband;
- unsigned ProgressPI;
-
- if(!pdu.GetQ931().GetProgressIndicator(ProgressPI))
- ProgressPI = 0;
- if(h323debug)
- cout << "Progress Indicator is " << ProgressPI << endl;
-
- /* XXX Is this correct? XXX */
- switch(ProgressPI) {
- case Q931::ProgressNotEndToEndISDN:
- case Q931::ProgressInbandInformationAvailable:
- inband = TRUE;
- break;
- default:
- inband = FALSE;
- }
- on_progress(GetCallReference(), inband);
- }
-
- return res;
-}
-
H323Connection::AnswerCallResponse MyH323Connection::OnAnswerCall(const PString & caller,
- const H323SignalPDU & setupPDU,
+ const H323SignalPDU & /*setupPDU*/,
H323SignalPDU & /*connectPDU*/)
{
- unsigned ProgressInd;
-
/* The call will be answered later with "AnsweringCall()" function.
*/
- if(!setupPDU.GetQ931().GetProgressIndicator(ProgressInd))
- ProgressInd = 0;
- if(h323debug)
- cout << "PI in SETUP was " << ProgressInd << endl;
-
- /* Progress indicator must be always set to 8 if Setup Have Progress indicator equal to 3 */
- if(progressAlert)
- ProgressInd = progressAlert;
- else if(ProgressInd == Q931::ProgressOriginNotISDN)
- ProgressInd = Q931::ProgressInbandInformationAvailable;
- if(ProgressInd)
- alertingPDU->GetQ931().SetProgressIndicator(ProgressInd);
- if(h323debug)
- cout << "Adding PI=" << ProgressInd << " to ALERT message" << endl;
-
return H323Connection::AnswerCallAlertWithMedia;
}
-BOOL MyH323Connection::OnAlerting(const H323SignalPDU & alertingPDU, const PString & username)
+BOOL MyH323Connection::OnAlerting(const H323SignalPDU & /*alertingPDU*/, const PString & username)
{
+
if (h323debug)
cout << " -- Ringing phone for \"" << username << "\"" << endl;
-
- if (on_progress) {
- BOOL inband;
- unsigned alertingPI;
-
- if(!alertingPDU.GetQ931().GetProgressIndicator(alertingPI))
- alertingPI = 0;
- if(h323debug)
- cout << "Progress Indicator is " << alertingPI << endl;
-
- /* XXX Is this correct? XXX */
- switch(alertingPI) {
- case Q931::ProgressNotEndToEndISDN:
- case Q931::ProgressInbandInformationAvailable:
- inband = TRUE;
- break;
- default:
- inband = FALSE;
- }
- on_progress(GetCallReference(), inband);
- }
return TRUE;
}
@@ -773,7 +523,6 @@
PString sourceE164;
PString destE164;
- PString redirE164;
PString sourceAliases;
PString destAliases;
PString sourceIp;
@@ -788,12 +537,19 @@
setupPDU.GetSourceE164(sourceE164);
destE164 = "";
setupPDU.GetDestinationE164(destE164);
- if(!setupPDU.GetQ931().GetRedirectingNumber(redirE164))
- redirE164 = "";
- /* Use common alias formatting routine */
- FormatAliases(sourceAliases);
- FormatAliases(destAliases);
+ /* Convert complex strings */
+ // FIXME: deal more than one source alias
+ char *s;
+ if ((s = strchr(sourceAliases, ' ')) != NULL)
+ *s = '\0';
+ if ((s = strchr(sourceAliases, '\t')) != NULL)
+ *s = '\0';
+ char *s1;
+ if ((s1 = strchr(destAliases, ' ')) != NULL)
+ *s1 = '\0';
+ if ((s1 = strchr(destAliases, '\t')) != NULL)
+ *s1 = '\0';
GetSignallingChannel()->GetRemoteAddress().GetIpAndPort(Ip, sourcePort);
@@ -801,24 +557,20 @@
cd.call_reference = GetCallReference();
cd.call_token = (const char *)GetCallToken();
- cd.call_source_aliases = (const char *)sourceAliases;
+ cd.call_source_aliases = (const char *)sourceAliases;
cd.call_dest_alias = (const char *)destAliases;
cd.call_source_e164 = (const char *)sourceE164;
cd.call_dest_e164 = (const char *)destE164;
- cd.call_redir_e164 = (const char *)redirE164;
- cd.sourceIp = (const char *)sourceIp;
+ cd.sourceIp = (const char *)sourceIp;
/* Notify Asterisk of the request */
- call_options_t *res = on_incoming_call(cd);
+ int res = on_incoming_call(cd);
if (!res) {
if (h323debug)
cout << " -- Call Failed" << endl;
return FALSE;
}
-
- progressSetup = res->progress_setup;
- progressAlert = res->progress_alert;
return H323Connection::OnReceivedSignalSetup(setupPDU);
}
@@ -838,13 +590,22 @@
destE164 = "";
setupPDU.GetDestinationE164(destE164);
- /* Use common alias formatting routine */
- FormatAliases(sourceAliases);
- FormatAliases(destAliases);
+ /* Convert complex strings */
+ // FIXME: deal more than one source alias
+ char *s;
+ if ((s = strchr(sourceAliases, ' ')) != NULL)
+ *s = '\0';
+ if ((s = strchr(sourceAliases, '\t')) != NULL)
+ *s = '\0';
+ char *s1;
+ if ((s1 = strchr(destAliases, ' ')) != NULL)
+ *s1 = '\0';
+ if ((s1 = strchr(destAliases, '\t')) != NULL)
+ *s1 = '\0';
cd.call_reference = GetCallReference();
cd.call_token = (const char *)GetCallToken();
- cd.call_source_aliases = (const char *)sourceAliases;
+ cd.call_source_aliases = (const char *)sourceAliases;
cd.call_dest_alias = (const char *)destAliases;
cd.call_source_e164 = (const char *)sourceE164;
cd.call_dest_e164 = (const char *)destE164;
@@ -857,10 +618,6 @@
return FALSE;
}
- if(progressSetup)
- setupPDU.GetQ931().SetProgressIndicator(progressSetup);
-// setupPDU.GetQ931().SetProgressIndicator(Q931::ProgressInbandInformationAvailable);
-// setupPDU.GetQ931().SetProgressIndicator(Q931::ProgressOriginNotISDN);
return H323Connection::OnSendSignalSetup(setupPDU);
}
@@ -951,7 +708,7 @@
cout << " -- SessionID: " << sessionID << endl;
cout << " -- Direction: " << dir << endl;
}
- return new MyH323_ExternalRTPChannel(*this, capability, dir, sessionID, externalIpAddress, externalPort);
+ return new H323_ExternalRTPChannel(*this, capability, dir, sessionID, externalIpAddress, externalPort);
}
/** This callback function is invoked once upon creation of each
@@ -960,8 +717,7 @@
BOOL MyH323Connection::OnStartLogicalChannel(H323Channel & channel)
{
if (h323debug) {
- /* Show H.323 channel number to make debugging more comfortable */
- cout << " -- Started logical channel " << channel.GetNumber() << ": ";
+ cout << " -- Started logical channel: ";
cout << ((channel.GetDirection()==H323Channel::IsTransmitter)?"sending ":((channel.GetDirection()==H323Channel::IsReceiver)?"receiving ":" "));
cout << (const char *)(channel.GetCapability()).GetFormatName() << endl;
}
@@ -970,10 +726,8 @@
if (h323debug)
cout << " -- channelsOpen = " << channelsOpen << endl;
-#if 0
H323_ExternalRTPChannel & external = (H323_ExternalRTPChannel &)channel;
- if(!external.GetRemoteAddress(remoteIpAddress, remotePort) && h323debug)
- cout << " ** Unable to get remote IP address" << endl;
+ external.GetRemoteAddress(remoteIpAddress, remotePort);
if (h323debug) {
cout << " -- remoteIpAddress: " << remoteIpAddress << endl;
@@ -981,49 +735,8 @@
cout << " -- ExternalIpAddress: " << externalIpAddress << endl;
cout << " -- ExternalPort: " << externalPort << endl;
}
-
- /* Try to determine negotiated RTP payload format to configure
- * RTP stack more quickly (not to wait at least one packet with
- * filled RTP payload
- */
- RTP_DataFrame::PayloadTypes payloadType = channel.GetCapability().GetPayloadType();
- cout << " *** channel's payload is " << payloadType << endl;
- if (payloadType == RTP_DataFrame::IllegalPayloadType) {
- payloadType = channel.GetCodec()->GetMediaFormat().GetPayloadType();
- cout << " *** channel's codec payload is " << payloadType << endl;
- }
- if ((payloadType == RTP_DataFrame::IllegalPayloadType) || (payloadType >= RTP_DataFrame::DynamicBase)) {
- OpalMediaFormat mediaFormat = channel.GetCodec()->GetMediaFormat();
-// if (mediaFormat.GetPayloadType() < RTP_DataFrame::DynamicBase)
- {
- payloadType = mediaFormat.GetPayloadType();
- cout << " *** channel's Opal media payload is " << payloadType << endl;
- }
- }
-// if ((payloadType == RTP_DataFrame::IllegalPayloadType)) {
-// OpalMediaFormat OMF((const char *)(channel.GetCapability()).GetFormatName(), 1);
-// if (OMF.IsValid())
-// {
-// payloadType = OMF.GetPayloadType();
-// cout << " *** channel's OMF payload is " << payloadType << endl;
-// }
-// }
-
- /* Deduce direction of starting channel */
- int direction;
- if (channel.GetDirection()==H323Channel::IsTransmitter)
- direction = 1;
- else if (channel.GetDirection()==H323Channel::IsReceiver)
- direction = 0;
- else
- direction = -1;
-
/* Notify Asterisk of remote RTP information */
- /* direction and payload arguments needs to
- * correctly setup RTP transport
- */
- on_start_logical_channel(GetCallReference(), (const char *)remoteIpAddress.AsString(), remotePort, direction, (int)payloadType);
-#endif
+ on_start_logical_channel(GetCallReference(), (const char *)remoteIpAddress.AsString(), remotePort);
return TRUE;
}
@@ -1086,6 +799,7 @@
cout << " ERROR: [h323_gk_urq] No Endpoint, this is bad" << endl;
return;
}
+
endPoint->RemoveGatekeeper();
}
@@ -1109,8 +823,7 @@
start_logchan_cb lfunc,
clear_con_cb clfunc,
con_established_cb efunc,
- send_digit_cb dfunc,
- progress_cb pgfunc)
+ send_digit_cb dfunc)
{
on_incoming_call = ifunc;
on_outgoing_call = sfunc;
@@ -1119,7 +832,6 @@
on_connection_cleared = clfunc;
on_connection_established = efunc;
on_send_digit = dfunc;
- on_progress = pgfunc;
}
/**
@@ -1128,8 +840,7 @@
int h323_set_capability(int cap, int dtmfMode)
{
int g711Frames = 30;
- int gsmFrames = 4;
- PINDEX last_cap = -1; /* last common capability block index */
+ int gsmFrames = 4;
if (!h323_end_point_exist()) {
@@ -1137,74 +848,61 @@
return 1;
}
- /* User input mode moved to the end of procedure */
+ mode = dtmfMode;
+ if (dtmfMode == H323_DTMF_INBAND)
+ endPoint->SetSendUserInputMode(H323Connection::SendUserInputAsTone);
+ else
+ endPoint->SetSendUserInputMode(H323Connection::SendUserInputAsInlineRFC2833);
+
/* Hardcode this for now (Someone tell me if T.38 works now
or provide me with some debug so we can make this work */
-// last_cap = endPoint->SetCapability(0, 0, new H323_T38Capability(H323_T38Capability::e_UDP));
+// endPoint->SetCapability(0, 0, new H323_T38Capability(H323_T38Capability::e_UDP));
if (cap & AST_FORMAT_SPEEX) {
/* Not real sure if Asterisk acutally supports all
of the various different bit rates so add them
all and figure it out later*/
- last_cap = endPoint->SetCapability(0, 0, new SpeexNarrow2AudioCapability());
- last_cap = endPoint->SetCapability(0, 0, new SpeexNarrow3AudioCapability());
- last_cap = endPoint->SetCapability(0, 0, new SpeexNarrow4AudioCapability());
- last_cap = endPoint->SetCapability(0, 0, new SpeexNarrow5AudioCapability());
- last_cap = endPoint->SetCapability(0, 0, new SpeexNarrow6AudioCapability());
+ endPoint->SetCapability(0, 0, new SpeexNarrow2AudioCapability());
+ endPoint->SetCapability(0, 0, new SpeexNarrow3AudioCapability());
+ endPoint->SetCapability(0, 0, new SpeexNarrow4AudioCapability());
+ endPoint->SetCapability(0, 0, new SpeexNarrow5AudioCapability());
+ endPoint->SetCapability(0, 0, new SpeexNarrow6AudioCapability());
}
if (cap & AST_FORMAT_G729A) {
AST_G729ACapability *g729aCap;
AST_G729Capability *g729Cap;
- last_cap = endPoint->SetCapability(0, 0, g729aCap = new AST_G729ACapability);
- last_cap = endPoint->SetCapability(0, 0, g729Cap = new AST_G729Capability);
+ endPoint->SetCapability(0, 0, g729aCap = new AST_G729ACapability);
+ endPoint->SetCapability(0, 0, g729Cap = new AST_G729Capability);
}
if (cap & AST_FORMAT_G723_1) {
- H323_G7231Capability *g7231Cap, *g7231Cap1;
- last_cap = endPoint->SetCapability(0, 0, g7231Cap = new H323_G7231Capability);
- last_cap = endPoint->SetCapability(0, 0, g7231Cap1 = new H323_G7231Capability(FALSE));
+ H323_G7231Capability *g7231Cap;
+ endPoint->SetCapability(0, 0, g7231Cap = new H323_G7231Capability);
}
if (cap & AST_FORMAT_GSM) {
H323_GSM0610Capability *gsmCap;
- last_cap = endPoint->SetCapability(0, 0, gsmCap = new H323_GSM0610Capability);
- gsmCap->SetTxFramesInPacket(gsmFrames);
+ endPoint->SetCapability(0, 0, gsmCap = new H323_GSM0610Capability);
+ gsmCap->SetTxFramesInPacket(gsmFrames);
}
if (cap & AST_FORMAT_ULAW) {
+
H323_G711Capability *g711uCap;
- last_cap = endPoint->SetCapability(0, 0, g711uCap = new H323_G711Capability(H323_G711Capability::muLaw));
+ endPoint->SetCapability(0, 0, g711uCap = new H323_G711Capability(H323_G711Capability::muLaw));
g711uCap->SetTxFramesInPacket(g711Frames);
}
if (cap & AST_FORMAT_ALAW) {
H323_G711Capability *g711aCap;
- last_cap = endPoint->SetCapability(0, 0, g711aCap = new H323_G711Capability(H323_G711Capability::ALaw));
+ endPoint->SetCapability(0, 0, g711aCap = new H323_G711Capability(H323_G711Capability::ALaw));
g711aCap->SetTxFramesInPacket(g711Frames);
}
- /* Add HookFlash capability - not used yet now */
- last_cap++;
- last_cap = endPoint->SetCapability(0, last_cap, new H323_UserInputCapability(H323_UserInputCapability::HookFlashH245));
-
- /* Add correct UserInputMode capability
- * This allows remote party to send UserIput
- * correctly embedded into protocol
- */
- last_cap++;
- mode = dtmfMode;
- if (dtmfMode == H323_DTMF_INBAND) {
- endPoint->SetCapability(0, last_cap, new H323_UserInputCapability(H323_UserInputCapability::SignalToneH245));
- endPoint->SetSendUserInputMode(H323Connection::SendUserInputAsTone);
- } else {
- endPoint->SetCapability(0, last_cap, new H323_UserInputCapability(H323_UserInputCapability::SignalToneRFC2833));
- endPoint->SetSendUserInputMode(H323Connection::SendUserInputAsInlineRFC2833);
- }
-
return 0;
}
@@ -1356,7 +1054,7 @@
/** Make a call to the remote endpoint.
*/
-int h323_make_call(char *host, call_details_t *cd, call_options_t *call_options)
+int h323_make_call(char *host, call_details_t *cd, call_options_t call_options)
{
int res;
PString token;
@@ -1367,7 +1065,7 @@
PString dest(host);
- res = endPoint->MakeCall(dest, token, &cd->call_reference, call_options);
+ res = endPoint->MakeCall(dest, token, &cd->call_reference, call_options.port, call_options.callerid);
memcpy((char *)(cd->call_token), (const unsigned char *)token, token.GetLength());
return res;
@@ -1444,3 +1142,6 @@
}
} /* extern "C" */
+
+
+
Index: ast_h323.h
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/h323/ast_h323.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- ast_h323.h 23 Dec 2003 23:00:59 -0000 1.13
+++ ast_h323.h 24 Dec 2003 22:36:57 -0000 1.14
@@ -88,7 +88,7 @@
H245_AudioCapability & pdu, /// PDU to set information on
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
@@ -198,7 +198,7 @@
public:
- int MakeCall(const PString &, PString &, unsigned int *, call_options_t *);
+ int MakeCall(const PString &, PString &, unsigned int *, unsigned int, char *);
BOOL ClearCall(const PString &);
void OnClosedLogicalChannel(H323Connection &, const H323Channel &);
@@ -213,8 +213,9 @@
PStringArray SupportedPrefixes;
- void SetEndpointTypeInfo( H225_EndpointType & info ) const;
- void SetGateway(void);
+ void SetEndpointTypeInfo( H225_EndpointType & info ) const;
+ void SetGateway(void);
+
};
@@ -224,7 +225,6 @@
public:
MyH323Connection(MyH323EndPoint &, unsigned, unsigned);
- MyH323Connection(MyH323EndPoint &, unsigned, unsigned, call_options_t *);
~MyH323Connection();
H323Channel * CreateRealTimeLogicalChannel(const H323Capability &, H323Channel::Directions, unsigned,
@@ -241,9 +241,6 @@
void SendUserInputTone(char, unsigned);
void OnUserInputTone(char, unsigned, unsigned, unsigned);
void OnUserInputString(const PString &value);
- BOOL OnReceivedProgress(const H323SignalPDU &);
- /* Set up H.323 caller id */
- void SetCID(const char *callerid);
PString sourceAliases;
PString destAliases;
@@ -251,53 +248,11 @@
PString destE164;
PIPSocket::Address externalIpAddress; // IP address of media server
- PIPSocket::Address remoteIpAddress; // IP Address of remote endpoint
- WORD externalPort; // local media server Data port (control is dataPort+1)
- WORD remotePort; // remote endpoint Data port (control is dataPort+1)
- WORD sessionId;
- BOOL bridging; // Used to help determine which IP to use
- unsigned progressSetup; // ProgressIndicator IE value for SETUP message
- unsigned progressAlert; // ProgressIndicator IE value for ALERT message
-};
-
-class MyH323_ExternalRTPChannel : public H323_ExternalRTPChannel
-{
- PCLASSINFO(MyH323_ExternalRTPChannel, H323_ExternalRTPChannel);
-
-public:
- /**@name Construction */
- //@{
- /**Create a new channel.
- */
- MyH323_ExternalRTPChannel(
- H323Connection & connection, /// Connection to endpoint for channel
- const H323Capability & capability, /// Capability channel is using
- Directions direction, /// Direction of channel
- unsigned sessionID /// Session ID for channel
- );
- /**Create a new channel.
- */
- MyH323_ExternalRTPChannel(
- H323Connection & connection, /// Connection to endpoint for channel
- const H323Capability & capability, /// Capability channel is using
- Directions direction, /// Direction of channel
- unsigned sessionID, /// Session ID for channel
- const H323TransportAddress & data, /// Data address
- const H323TransportAddress & control/// Control address
- );
- /**Create a new channel.
- */
- MyH323_ExternalRTPChannel(
- H323Connection & connection, /// Connection to endpoint for channel
- const H323Capability & capability, /// Capability channel is using
- Directions direction, /// Direction of channel
- unsigned sessionID, /// Session ID for channel
- const PIPSocket::Address & ip, /// IP address of media server
- WORD dataPort /// Data port (control is dataPort+1)
- );
- //@}
-// BOOL OnReceivedAckPDU(const H245_H2250LogicalChannelAckParameters & param);
- BOOL Start(void);
+ PIPSocket::Address remoteIpAddress; // IP Address of remote endpoint
+ WORD externalPort; // local media server Data port (control is dataPort+1)
+ WORD remotePort; // remote endpoint Data port (control is dataPort+1)
+ WORD sessionId;
+ BOOL bridging; // Used to help determine which IP to use
};
@@ -393,3 +348,5 @@
protected:
PString token;
};
+
+
Index: chan_h323.h
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/h323/chan_h323.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- chan_h323.h 23 Dec 2003 23:00:59 -0000 1.13
+++ chan_h323.h 24 Dec 2003 22:36:57 -0000 1.14
@@ -28,23 +28,7 @@
#include <arpa/inet.h>
-//static struct sockaddr_in bindaddr;
-
-/** call_option struct is filled from the
- PBX application and passed through make_call
- function*/
-typedef struct call_options {
- char *callerid;
- int noFastStart;
- int noH245Tunnelling;
- int noSilenceSuppression;
- int progress_setup;
- int progress_alert;
- int progress_audio;
- unsigned int port;
-} call_options_t;
-
-extern call_options_t global_options;
+static struct sockaddr_in bindaddr;
/* structure to hold the valid asterisk users */
struct oh323_user {
@@ -54,13 +38,15 @@
char callerid[80];
char accountcode[20];
int amaflags;
+ int noFastStart;
+ int noH245Tunneling;
+ int noSilenceSuppression;
int inUse;
int incominglimit;
int bridge;
int nat;
int dtmfmode;
int host;
- call_options_t call_options;
struct ast_ha *ha;
struct sockaddr_in addr;
struct oh323_user *next;
@@ -71,6 +57,9 @@
struct oh323_peer {
char name[80];
char context[80];
+ int noFastStart;
+ int noH245Tunneling;
+ int noSilenceSuppression;
int inUse;
int outgoinglimit;
int bridge;
@@ -78,7 +67,6 @@
int dtmfmode;
struct sockaddr_in addr;
int delme;
- call_options_t call_options;
struct oh323_peer *next;
};
@@ -93,6 +81,17 @@
struct oh323_alias *next;
};
+/** call_option struct is filled from the
+ PBX application and passed through make_call
+ function*/
+typedef struct call_options {
+ char *callerid;
+ int noFastStart;
+ int noH245Tunnelling;
+ int noSilenceSuppression;
+ unsigned int port;
+} call_options_t;
+
/** call_details struct call detail records
to asterisk for processing and used for matching up
asterisk channels to acutal h.323 connections */
@@ -104,7 +103,6 @@
const char *call_dest_alias;
const char *call_source_e164;
const char *call_dest_e164;
- const char *call_redir_e164;
const char *sourceIp;
} call_details_t;
@@ -125,7 +123,7 @@
/* This is a callback prototype function, called upon
an incoming call happens. */
-typedef call_options_t *(*setup_incoming_cb)(call_details_t);
+typedef int (*setup_incoming_cb)(call_details_t);
setup_incoming_cb on_incoming_call;
/* This is a callback prototype function, called upon
@@ -134,10 +132,8 @@
setup_outbound_cb on_outgoing_call;
/* This is a callback prototype function, called when the openh323
- OnStartLogicalChannel is invoked.
- 2 more arguments - direction and payload type.
- */
-typedef void (*start_logchan_cb)(unsigned int, const char *, int, int, int);
+ OnStartLogicalChannel is invoked. */
+typedef void (*start_logchan_cb)(unsigned int, const char *, int);
start_logchan_cb on_start_logical_channel;
/* This is a callback protoype function, called when the openh323
@@ -150,33 +146,15 @@
typedef void (*clear_con_cb)(call_details_t);
clear_con_cb on_connection_cleared;
-/* This is a callback prototype function, called when the openh323
- OnReceivedAckPDU is invoked. */
-typedef void (*setup_rtp_cb)(unsigned int, const char *, int);
-setup_rtp_cb on_setup_rtp_peer;
-
-typedef int (*progress_cb)(unsigned, int);
-progress_cb on_progress;
-
/* debug flag */
int h323debug;
#define H323_DTMF_RFC2833 (1 << 0)
#define H323_DTMF_INBAND (1 << 1)
-/* Required to declare global variables from chan_h323.c */
-#ifndef BOOL
-#define BOOL int
-#endif
-
#ifdef __cplusplus
extern "C" {
#endif
-
- /* chan_h323 global parameters */
- extern BOOL noFastStart;
- extern BOOL noH245Tunnelling;
- extern BOOL noSilenceSuppression;
void h323_gk_urq(void);
void h323_end_point_create(void);
@@ -187,13 +165,13 @@
/* callback function handler*/
void h323_callback_register(setup_incoming_cb,
- setup_outbound_cb,
- on_connection_cb,
- start_logchan_cb,
- clear_con_cb,
- con_established_cb,
- send_digit_cb,
- progress_cb);
+ setup_outbound_cb,
+ on_connection_cb,
+ start_logchan_cb,
+ clear_con_cb,
+ con_established_cb,
+ send_digit_cb);
+
int h323_set_capability(int, int);
int h323_set_alias(struct oh323_alias *);
@@ -210,7 +188,7 @@
void h323_send_tone(const char *call_token, char tone);
/* H323 create and destroy sessions */
- int h323_make_call(char *host, call_details_t *cd, call_options_t *call_options);
+ int h323_make_call(char *host, call_details_t *cd, call_options_t);
int h323_clear_call(const char *);
int h323_answering_call(const char *token, int);
Index: h323.conf.sample
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/h323/h323.conf.sample,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- h323.conf.sample 23 Dec 2003 23:00:59 -0000 1.7
+++ h323.conf.sample 24 Dec 2003 22:36:57 -0000 1.8
@@ -52,13 +52,6 @@
; use user authentication at all.
;
;context=default
-;noFastStart = no
-;noH245Tunneling = no
-;noSilenceSuppression = yes
-;progress_setup = 3
-;progress_alert = 8
-;progress_audio = yes
-
;
; H.323 Alias definitions
;
More information about the svn-commits
mailing list