sync any left over changes

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1428 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Jeremy McNamara
2003-08-25 18:34:10 +00:00
parent 194998be61
commit 822d556924
3 changed files with 43 additions and 22 deletions

View File

@@ -23,6 +23,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* Version Info: $Id$
*/ */
#include "ast_h323.h" #include "ast_h323.h"
#include "h323t38.h" #include "h323t38.h"
@@ -601,21 +602,29 @@ H323Channel * MyH323Connection::CreateRealTimeLogicalChannel(const H323Capabilit
unsigned sessionID, unsigned sessionID,
const H245_H2250LogicalChannelParameters * /*param*/) const H245_H2250LogicalChannelParameters * /*param*/)
{ {
struct rtp_info *info;
WORD port; WORD port;
/* Establish the Local (A side) IP Address */ /* Determine the Local (A side) IP Address and port */
GetControlChannel().GetLocalAddress().GetIpAndPort(externalIpAddress, port); info = on_create_connection(GetCallReference());
/* Notify Asterisk of the request and get the port */ // if (bridging) {
externalPort = on_create_connection(GetCallReference()); // externalIpAddress = PIPSocket::Address(info->addr);
// } else {
GetControlChannel().GetLocalAddress().GetIpAndPort(externalIpAddress, port);
// }
// externalIpAddress = PIPSocket::Address("192.168.1.50");
externalPort = info->port;
if (h323debug) { if (h323debug) {
cout << " =*= In CreateRealTimeLogicalChannel for call " << GetCallReference() << endl; cout << " =*= In CreateRealTimeLogicalChannel for call " << GetCallReference() << endl;
cout << " -- externalIpAddress: " << externalIpAddress << endl; cout << " -- externalIpAddress: " << externalIpAddress << endl;
cout << " -- externalPort: " << externalPort << endl; cout << " -- externalPort: " << externalPort << endl;
cout << " -- SessionID: " << sessionID << endl;
cout << " -- Direction: " << dir << endl; cout << " -- Direction: " << dir << endl;
} }
return new H323_ExternalRTPChannel(*this, capability, dir, sessionID, externalIpAddress, externalPort); return new H323_ExternalRTPChannel(*this, capability, dir, sessionID, externalIpAddress, externalPort);
} }
@@ -1028,23 +1037,28 @@ int h323_show_codec(int fd, int argc, char *argv[])
/* alas, this doesn't work :( */ /* alas, this doesn't work :( */
void h323_native_bridge(const char *token, char *them, char *us) void h323_native_bridge(const char *token, char *them, char *capability)
{ {
H323Channel *channel; H323Channel *channel;
H323Connection *connection = endPoint->FindConnectionWithLock(token); MyH323Connection *connection = (MyH323Connection *)endPoint->FindConnectionWithLock(token);
PString mode(capability);
if (!mode) {
cout << "Native Bridge: them [" << them << "] us [" << us << "]" << endl;
if (!connection){
cout << "ERROR: No connection active.\n";
return; return;
} }
connection->Unlock(); if (!connection){
channel = connection->FindChannel(RTP_Session::DefaultAudioSessionID, TRUE); cout << "ERROR: No connection found, this is bad\n";
H323_ExternalRTPChannel *external = (H323_ExternalRTPChannel *)channel; return;
external->SetExternalAddress(them, us); // data (RTP), control (Asterisk) }
cout << "Native Bridge: them [" << them << "]" << endl;
channel = connection->FindChannel(connection->sessionId, TRUE);
connection->bridging = TRUE;
connection->CloseLogicalChannelNumber(channel->GetNumber());
connection->RequestModeChange(mode);
connection->Unlock();
return; return;
} }

View File

@@ -23,6 +23,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* Version Info: $Id$
*/ */
@@ -153,8 +154,8 @@ class MyH323Connection : public H323Connection {
PIPSocket::Address remoteIpAddress; // IP Address of remote endpoint PIPSocket::Address remoteIpAddress; // IP Address of remote endpoint
WORD externalPort; // local media server Data port (control is dataPort+1) WORD externalPort; // local media server Data port (control is dataPort+1)
WORD remotePort; // remote endpoint Data port (control is dataPort+1) WORD remotePort; // remote endpoint Data port (control is dataPort+1)
WORD sessionId;
PSyncPoint bridgeFlag; BOOL bridging; // Used to help determine which IP to use
}; };

View File

@@ -23,6 +23,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* Version Info: $Id$
*/ */
#include <arpa/inet.h> #include <arpa/inet.h>
@@ -105,6 +106,11 @@ typedef struct call_details {
const char *sourceIp; const char *sourceIp;
} call_details_t; } call_details_t;
typedef struct rtp_info {
char *addr;
unsigned int port;
} rtp_info_t;
/* This is a callback prototype function, called pass /* This is a callback prototype function, called pass
DTMF down the RTP. */ DTMF down the RTP. */
typedef int (*send_digit_cb)(unsigned, char); typedef int (*send_digit_cb)(unsigned, char);
@@ -112,7 +118,7 @@ send_digit_cb on_send_digit;
/* This is a callback prototype function, called to collect /* This is a callback prototype function, called to collect
the external RTP port from Asterisk. */ the external RTP port from Asterisk. */
typedef int (*on_connection_cb)(unsigned); typedef rtp_info_t *(*on_connection_cb)(unsigned);
on_connection_cb on_create_connection; on_connection_cb on_create_connection;
/* This is a callback prototype function, called upon /* This is a callback prototype function, called upon