/* MyH323_ExternalRTPChannel */ MyH323_ExternalRTPChannel::MyH323_ExternalRTPChannel(MyH323Connection & connection, const H323Capability & capability, Directions direction, unsigned id) : H323_ExternalRTPChannel::H323_ExternalRTPChannel(connection, capability, direction, id) { struct rtp_info *info; /* Determine the Local (A side) IP Address and port */ info = on_external_rtp_create(connection.GetCallReference(), (const char *)connection.GetCallToken()); if (!info) { cout << "\tERROR: on_external_rtp_create failure" << endl; return; } else { /* Request our peer to send RTP packets to the same address we * use for signalling. We rely on OpenH323 to determine this * address. */ connection.GetSignallingChannel()->GetLocalAddress().GetIpAddress(localIpAddr); localPort = info->port; /* tell the H.323 stack */ SetExternalAddress(H323TransportAddress(localIpAddr, localPort), H323TransportAddress(localIpAddr, localPort + 1)); /* clean up allocated memory */ free(info); } /* Get the payload code */ OpalMediaFormat format(capability.GetFormatName(), FALSE); payloadCode = format.GetPayloadType(); }
/** MyH323EndPoint * The fullAddress parameter is used directly in the MakeCall method so * the General form for the fullAddress argument is : * [alias@][transport$]host[:port] * default values: alias = the same value as host. * transport = ip. * port = 1720. */ int MyH323EndPoint::MakeCall(const PString & dest, PString & token, unsigned int *callReference, unsigned int port, char *callerid, char *callername) { PString fullAddress; MyH323Connection * connection; /* Determine whether we are using a gatekeeper or not. */ if (GetGatekeeper() != NULL) { fullAddress = dest; if (h323debug) cout << " -- Making call to " << fullAddress << " using gatekeeper." << endl; } else { fullAddress = dest; /* host */ if (h323debug) cout << " -- Making call to " << fullAddress << "." << endl; } if (!(connection = (MyH323Connection *)H323EndPoint::MakeCallLocked(fullAddress, token))) { if (h323debug) cout << "Error making call to \"" << fullAddress << '"' << endl; return 1; } *callReference = connection->GetCallReference(); if (callerid) connection->SetLocalPartyName(PString(callerid)); if (callername) { localAliasNames.RemoveAll(); connection->SetLocalPartyName(PString(callername)); if (callerid) localAliasNames.AppendString(PString(callerid)); } else if (callerid) { localAliasNames.RemoveAll(); connection->SetLocalPartyName(PString(callerid)); } connection->AST_Outgoing = TRUE; connection->Unlock(); if (h323debug) { cout << " -- " << GetLocalUserName() << " is calling host " << fullAddress << endl; cout << " -- " << "Call token is " << (const char *)token << endl; cout << " -- Call reference is " << *callReference << endl; } return 0; }
/** The fullAddress parameter is used directly in the MakeCall method so * the General form for the fullAddress argument is : * [alias@][transport$]host[:port] * default values: alias = the same value as host. * transport = ip. * port = 1720. */ int MyH323EndPoint::MakeCall(const PString & dest, PString & token, unsigned int *callReference, call_options_t *opts) { PString fullAddress; MyH323Connection * connection; /* Determine whether we are using a gatekeeper or not. */ if (GetGatekeeper()) { fullAddress = dest; if (h323debug) { cout << " -- Making call to " << fullAddress << " using gatekeeper." << endl; } } else { fullAddress = dest; if (h323debug) { cout << " -- Making call to " << fullAddress << " without gatekeeper." << endl; } } if (!(connection = (MyH323Connection *)H323EndPoint::MakeCallLocked(fullAddress, token, opts))) { if (h323debug) { cout << "Error making call to \"" << fullAddress << '"' << endl; } return 1; } *callReference = connection->GetCallReference(); if (opts->cid_num) { connection->ast_cid_num = PString(opts->cid_num); } if (opts->cid_name) { connection->ast_cid_name = PString(opts->cid_name); connection->SetLocalPartyName(connection->ast_cid_name); } connection->dtmfCodec = (RTP_DataFrame::PayloadTypes)opts->dtmfcodec; if (h323debug) { cout << "\t-- " << GetLocalUserName() << " is calling host " << fullAddress << endl; cout << "\t-- Call token is " << (const char *)token << endl; cout << "\t-- Call reference is " << *callReference << endl; cout << "\t-- DTMF Payload is " << connection->dtmfCodec << endl; } connection->Unlock(); return 0; }