summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2005-09-01 22:06:23 +0000
committerKevin P. Fleming <kpfleming@digium.com>2005-09-01 22:06:23 +0000
commit421ceff1717357e7725dd3b13821240f0ef72785 (patch)
tree41b3c6354846c9e3c485524b06eb06f172254e20 /res
parentdd88d578fd1341eb152f5143bb45e7d27462665f (diff)
don't send OSP tokens do devices that are not OSP aware (issue #5093)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6493 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res')
-rwxr-xr-xres/res_osp.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/res/res_osp.c b/res/res_osp.c
index 57e80f9ab..e820264f5 100755
--- a/res/res_osp.c
+++ b/res/res_osp.c
@@ -506,6 +506,7 @@ int ast_osp_lookup(struct ast_channel *chan, char *provider, char *extension, ch
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 @@ int ast_osp_lookup(struct ast_channel *chan, char *provider, char *extension, ch
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 @@ int ast_osp_next(struct ast_osp_result *result, int cause)
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 @@ int ast_osp_next(struct ast_osp_result *result, int cause)
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 */