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

kpfleming kpfleming
Thu Sep 1 18:05:24 CDT 2005


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

Modified Files:
	res_osp.c 
Log Message:
don't send OSP tokens do devices that are not OSP aware (issue #5093)


Index: res_osp.c
===================================================================
RCS file: /usr/cvsroot/asterisk/res/res_osp.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- res_osp.c	1 Sep 2005 21:53:52 -0000	1.18
+++ res_osp.c	1 Sep 2005 22:06:23 -0000	1.19
@@ -506,6 +506,7 @@
 	char tmp[256]="", *l, *n;
 	OSPTCALLID *callid;
 	OSPE_DEST_PROT prot;
+	OSPE_DEST_OSP_ENABLED ospenabled;
 
 	result->handle = -1;
 	result->numresults = 0;
@@ -569,7 +570,12 @@
 						ast_log(LOG_DEBUG, "Got destination '%s' and called: '%s' calling: '%s' for '%s' (provider '%s')\n",
 							destination, callednum, callingnum, extension, provider);
 						do {
-							ast_base64encode(result->token, token, tokenlen, sizeof(result->token) - 1);
+							if (!OSPPTransactionIsDestOSPEnabled (result->handle, &ospenabled) && (ospenabled == OSPE_OSP_FALSE)) {
+								result->token[0] = 0;
+							}
+							else {
+								ast_base64encode(result->token, token, tokenlen, sizeof(result->token) - 1);
+							}
 							if ((strlen(destination) > 2) && !OSPPTransactionGetDestProtocol(result->handle, &prot)) {
 								res = 1;
 								/* Strip leading and trailing brackets */
@@ -638,6 +644,7 @@
 	char destination[2048]="";
 	char token[2000];
 	OSPE_DEST_PROT prot;
+	OSPE_DEST_OSP_ENABLED ospenabled;
 
 	result->tech[0] = '\0';
 	result->dest[0] = '\0';
@@ -652,7 +659,12 @@
 				result->numresults--;
 				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 (!OSPPTransactionIsDestOSPEnabled (result->handle, &ospenabled) && (ospenabled == OSPE_OSP_FALSE)) {
+						result->token[0] = 0;
+					}
+					else {
+						ast_base64encode(result->token, token, tokenlen, sizeof(result->token) - 1);
+					}
 					if ((strlen(destination) > 2) && !OSPPTransactionGetDestProtocol(result->handle, &prot)) {
 						res = 1;
 						/* Strip leading and trailing brackets */




More information about the svn-commits mailing list