From 3fabe9006782fb35e0c8ff7fe79a57574563f9cd Mon Sep 17 00:00:00 2001
From: Jeremy McNamara <jj@nufone.net>
Date: Wed, 23 Jul 2003 02:27:44 +0000
Subject: [PATCH] finish that thought

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1204 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 channels/h323/ast_h323.cpp | 12 ++++++++----
 channels/h323/ast_h323.h   |  2 +-
 channels/h323/chan_h323.h  |  2 +-
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/channels/h323/ast_h323.cpp b/channels/h323/ast_h323.cpp
index 15b7dbd8b1..a3a75b299b 100755
--- a/channels/h323/ast_h323.cpp
+++ b/channels/h323/ast_h323.cpp
@@ -181,7 +181,7 @@ H323Codec * H323_G7231Capability::CreateCodec(H323Codec::Direction direction) co
   *					port = 1720.
   */
 int MyH323EndPoint::MakeCall(const PString & dest, PString & token, 
-							  			unsigned int *callReference, unsigned int port)
+							  			unsigned int *callReference, unsigned int port, char *callerid)
 {
 	PString fullAddress;
 	MyH323Connection * connection;
@@ -195,7 +195,7 @@ int MyH323EndPoint::MakeCall(const PString & dest, PString & token,
 			fullAddress = dest; /* host */
 			if (h323debug)
 				cout << " -- Making call to " << fullAddress << "." << endl;
-		}
+	}
 
 	if (!(connection = (MyH323Connection *)H323EndPoint::MakeCallLocked(fullAddress, token))) {
 		if (h323debug)
@@ -204,8 +204,12 @@ int MyH323EndPoint::MakeCall(const PString & dest, PString & token,
 	}
 	
 	*callReference = connection->GetCallReference();
-	connection->Unlock();
 	
+	if (strlen(callerid))
+		connection->SetLocalPartyName(PString(callerid));
+
+	connection->Unlock(); 	
+
 	if (h323debug) {
 		cout << "	-- " << GetLocalUserName() << " is calling host " << fullAddress << endl;
 		cout << "	-- " << "Call token is " << (const char *)token << endl;
@@ -969,7 +973,7 @@ int h323_make_call(char *host, call_details_t *cd, call_options_t call_options)
 	
 	PString dest(host);
 
-	res = endPoint->MakeCall(dest, token, &cd->call_reference, call_options.port);
+	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;
diff --git a/channels/h323/ast_h323.h b/channels/h323/ast_h323.h
index 2478b7a4ec..468f778155 100755
--- a/channels/h323/ast_h323.h
+++ b/channels/h323/ast_h323.h
@@ -103,7 +103,7 @@ class MyH323EndPoint : public H323EndPoint {
 
 	public:
 
-	int MakeCall(const PString &, PString &, unsigned int *, unsigned int);
+	int MakeCall(const PString &, PString &, unsigned int *, unsigned int, char *);
 	BOOL ClearCall(const PString &);
 
 	void OnClosedLogicalChannel(H323Connection &, const H323Channel &);
diff --git a/channels/h323/chan_h323.h b/channels/h323/chan_h323.h
index 23e0b468a6..926a2ea4ab 100755
--- a/channels/h323/chan_h323.h
+++ b/channels/h323/chan_h323.h
@@ -84,7 +84,7 @@ struct oh323_alias {
 	PBX application and passed through make_call 
 	function*/
 typedef struct call_options {
-	const char     *callerid;
+	char		   *callerid;
 	int				noFastStart;
 	int				noH245Tunnelling;
 	int				noSilenceSuppression;
-- 
GitLab