[Asterisk-cvs] asterisk/res res_osp.c,1.17,1.18

kpfleming kpfleming
Thu Sep 1 17:52:52 CDT 2005


Update of /usr/cvsroot/asterisk/res
In directory mongoose.digium.com:/tmp/cvs-serv6302/res

Modified Files:
	res_osp.c 
Log Message:
send the correct Call-ID when using OSP (issue #5095)


Index: res_osp.c
===================================================================
RCS file: /usr/cvsroot/asterisk/res/res_osp.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- res_osp.c	10 Jul 2005 23:21:39 -0000	1.17
+++ res_osp.c	1 Sep 2005 21:53:52 -0000	1.18
@@ -45,6 +45,7 @@
 #include "asterisk/lock.h"
 #include "asterisk/causes.h"
 #include "asterisk/callerid.h"
+#include "asterisk/pbx.h"
 
 #define MAX_CERTS 10
 #define MAX_SERVICEPOINTS 10
@@ -493,10 +494,11 @@
 	int tokenlen;
 	unsigned int dummy=0;
 	unsigned int timelimit;
+	char* sipcallid;
 	unsigned int callidlen;
+	char callidstr[OSPC_CALLID_MAXSIZE] = "";
 	struct osp_provider *osp;
 	char source[OSP_MAX] = ""; /* Same length as osp->source */
-	char uniqueid[32] = "";
 	char callednum[2048]="";
 	char callingnum[2048]="";
 	char destination[2048]="";
@@ -528,7 +530,8 @@
 	callerid = l;
 
 	if (chan) {
-		ast_copy_string(uniqueid, chan->uniqueid, sizeof(uniqueid));
+		sipcallid = pbx_builtin_getvar_helper (chan, "SIPCALLID");
+		ast_copy_string(callidstr, sipcallid, sizeof(callidstr));
 		cres = ast_autoservice_start(chan);
 		if (cres < 0)
 			return cres;
@@ -550,18 +553,18 @@
 	ast_mutex_unlock(&osplock);
 	if (res) {
 		res = 0;
-		callid = OSPPCallIdNew(strlen(uniqueid), uniqueid);
+		callid = OSPPCallIdNew(strlen(callidstr), callidstr);
 		if (callid) {
 			/* No more than 10 back */
 			counts = 10;
 			dummy = 0;
-			callidlen = sizeof(uniqueid);
+			callidlen = sizeof(callidstr);
 			if (!OSPPTransactionRequestAuthorisation(result->handle, source, "", 
 				  callerid,OSPC_E164, extension, OSPC_E164, NULL, 1, &callid, NULL, &counts, &dummy, NULL)) {
 				if (counts) {
 					tokenlen = sizeof(token);
 					result->numresults = counts - 1;
-					if (!OSPPTransactionGetFirstDestination(result->handle, 0, NULL, NULL, &timelimit, &callidlen, uniqueid, 
+					if (!OSPPTransactionGetFirstDestination(result->handle, 0, NULL, NULL, &timelimit, &callidlen, callidstr, 
 						sizeof(callednum), callednum, sizeof(callingnum), callingnum, sizeof(destination), destination, 0, NULL, &tokenlen, token)) {
 						ast_log(LOG_DEBUG, "Got destination '%s' and called: '%s' calling: '%s' for '%s' (provider '%s')\n",
 							destination, callednum, callingnum, extension, provider);
@@ -590,7 +593,7 @@
 								}
 								if (!res && result->numresults) {
 									result->numresults--;
-									if (OSPPTransactionGetNextDestination(result->handle, OSPC_FAIL_INCOMPATIBLE_DEST, 0, NULL, NULL, &timelimit, &callidlen, uniqueid, 
+									if (OSPPTransactionGetNextDestination(result->handle, OSPC_FAIL_INCOMPATIBLE_DEST, 0, NULL, NULL, &timelimit, &callidlen, callidstr, 
 											sizeof(callednum), callednum, sizeof(callingnum), callingnum, sizeof(destination), destination, 0, NULL, &tokenlen, token)) {
 											break;
 									}
@@ -629,7 +632,7 @@
 	unsigned int dummy=0;
 	unsigned int timelimit;
 	unsigned int callidlen;
-	char uniqueid[32] = "";
+	char callidstr[OSPC_CALLID_MAXSIZE] = "";
 	char callednum[2048]="";
 	char callingnum[2048]="";
 	char destination[2048]="";
@@ -642,12 +645,12 @@
 
 	if (result->handle > -1) {
 		dummy = 0;
-		callidlen = sizeof(uniqueid);
+		callidlen = sizeof(callidstr);
 		if (result->numresults) {
 			tokenlen = sizeof(token);
 			while(!res && result->numresults) {
 				result->numresults--;
-				if (!OSPPTransactionGetNextDestination(result->handle, OSPC_FAIL_INCOMPATIBLE_DEST, 0, NULL, NULL, &timelimit, &callidlen, uniqueid, 
+				if (!OSPPTransactionGetNextDestination(result->handle, OSPC_FAIL_INCOMPATIBLE_DEST, 0, NULL, NULL, &timelimit, &callidlen, callidstr, 
 									sizeof(callednum), callednum, sizeof(callingnum), callingnum, sizeof(destination), destination, 0, NULL, &tokenlen, token)) {
 					ast_base64encode(result->token, token, tokenlen, sizeof(result->token) - 1);
 					if ((strlen(destination) > 2) && !OSPPTransactionGetDestProtocol(result->handle, &prot)) {




More information about the svn-commits mailing list