From 6bb88bdcc055ab7eb4e1efe90228bf8fbc2d3fda Mon Sep 17 00:00:00 2001
From: Jeremy McNamara <jj@nufone.net>
Date: Thu, 24 Jul 2003 18:28:40 +0000
Subject: [PATCH] try this crazy idea to make callerid work with no name

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

diff --git a/channels/h323/ast_h323.cpp b/channels/h323/ast_h323.cpp
index 0e8d86d954..a827452abe 100755
--- a/channels/h323/ast_h323.cpp
+++ b/channels/h323/ast_h323.cpp
@@ -206,11 +206,8 @@ int MyH323EndPoint::MakeCall(const PString & dest, PString & token,
 	*callReference = connection->GetCallReference();
 	
 	if (strlen(callerid)) {
-		cout << "Setting callerid: [" << callerid << "]" << endl;
 		connection->SetLocalPartyName(PString(callerid));
-	} else {
-		cout << "Callerid NOT SET!" << endl; 
-	}
+	} 
 	connection->Unlock(); 	
 
 	if (h323debug) {
diff --git a/channels/h323/chan_h323.c b/channels/h323/chan_h323.c
index 017a164361..29c1396471 100755
--- a/channels/h323/chan_h323.c
+++ b/channels/h323/chan_h323.c
@@ -406,7 +406,13 @@ static int oh323_call(struct ast_channel *c, char *dest, int timeout)
 
 	/* Copy callerid, if there is any */
 	if (strlen(c->callerid)) {
-		p->calloptions.callerid = strdup(c->callerid);
+		char *tmp = strchr(c->callerid, '"');
+		if (tmp) {
+			p->calloptions.callerid = malloc(sizeof(c->callerid+20)); // evil
+			sprintf(p->calloptions.callerid, "\"Unknown Name\" <%s>", c->callerid);
+		} else {
+			p->calloptions.callerid = strdup(c->callerid);
+		}
 	}
 
 	res = h323_make_call(called_addr, &(p->cd), p->calloptions);
-- 
GitLab