Пример #1
0
/** 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;
}