/** 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; }
/* alas, this doesn't work :( */ void h323_native_bridge(const char *token, const char *them, char *capability) { H323Channel *channel; MyH323Connection *connection = (MyH323Connection *)endPoint->FindConnectionWithLock(token); if (!connection) { cout << "ERROR: No connection found, this is bad\n"; return; } cout << "Native Bridge: them [" << them << "]" << endl; channel = connection->FindChannel(connection->sessionId, TRUE); connection->bridging = TRUE; connection->CloseLogicalChannelNumber(channel->GetNumber()); connection->Unlock(); return; }
int h323_clear_call(const char *call_token, int cause) { H225_ReleaseCompleteReason dummy; H323Connection::CallEndReason r = H323Connection::EndedByLocalUser; MyH323Connection *connection; const PString currentToken(call_token); if (!h323_end_point_exist()) { return 1; } if (cause) { r = H323TranslateToCallEndReason((Q931::CauseValues)(cause), dummy); } connection = (MyH323Connection *)endPoint->FindConnectionWithLock(currentToken); if (connection) { connection->SetCause(cause); connection->SetCallEndReason(r); connection->Unlock(); } endPoint->ClearCall(currentToken, r); return 0; };
/** * Add capability to the capability table of the end point. */ int h323_set_capabilities(const char *token, int cap, int dtmfMode, struct ast_codec_pref *prefs) { MyH323Connection *conn; if (!h323_end_point_exist()) { cout << " ERROR: [h323_set_capablities] No Endpoint, this is bad" << endl; return 1; } if (!token || !*token) { cout << " ERROR: [h323_set_capabilities] Invalid call token specified." << endl; return 1; } PString myToken(token); conn = (MyH323Connection *)endPoint->FindConnectionWithLock(myToken); if (!conn) { cout << " ERROR: [h323_set_capabilities] Unable to find connection " << token << endl; return 1; } conn->SetCapabilities(cap, dtmfMode, prefs); conn->Unlock(); return 0; }