aboutsummaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-01-05 15:15:12 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-01-05 15:15:12 +0000
commitdbe6ddeb43ade81974f82f1cecac1637a547d6dc (patch)
treeeb09a6dcc54d0fb34cb3560b6b21601ebf1f1a97 /res
parent6928c4450a8c321796a66f93de5f74d52819c427 (diff)
Merge OSP updates from matt nicholson (with changes)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4674 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rwxr-xr-xres/res_osp.c33
1 files changed, 27 insertions, 6 deletions
diff --git a/res/res_osp.c b/res/res_osp.c
index f3711b32f..a9571ee7f 100755
--- a/res/res_osp.c
+++ b/res/res_osp.c
@@ -496,6 +496,7 @@ int ast_osp_lookup(struct ast_channel *chan, char *provider, char *extension, ch
char source[OSP_MAX] = ""; /* Same length as osp->source */
char uniqueid[32] = "";
char callednum[2048]="";
+ char callingnum[2048]="";
char destination[2048]="";
char token[2000];
char tmp[256]="", *l, *n;
@@ -559,9 +560,9 @@ int ast_osp_lookup(struct ast_channel *chan, char *provider, char *extension, ch
tokenlen = sizeof(token);
result->numresults = counts - 1;
if (!OSPPTransactionGetFirstDestination(result->handle, 0, NULL, NULL, &timelimit, &callidlen, uniqueid,
- sizeof(callednum), callednum, sizeof(destination), destination, 0, NULL, &tokenlen, token)) {
- ast_log(LOG_DEBUG, "Got destination '%s' and '%s' for '%s' (provider '%s')\n",
- destination, callednum, extension, provider);
+ 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);
do {
ast_base64encode(result->token, token, tokenlen, sizeof(result->token) - 1);
if ((strlen(destination) > 2) && !OSPPTransactionGetDestProtocol(result->handle, &prot)) {
@@ -577,6 +578,10 @@ int ast_osp_lookup(struct ast_channel *chan, char *provider, char *extension, ch
strncpy(result->tech, "SIP", sizeof(result->tech) - 1);
snprintf(result->dest, sizeof(result->dest), "%s@%s", callednum, destination + 1);
break;
+ case OSPE_DEST_PROT_IAX:
+ strncpy(result->tech, "IAX", sizeof(result->tech) - 1);
+ snprintf(result->dest, sizeof(result->dest), "%s@%s", callednum, destination + 1);
+ break;
default:
ast_log(LOG_DEBUG, "Unknown destination protocol '%d', skipping...\n", prot);
res = 0;
@@ -584,7 +589,7 @@ int ast_osp_lookup(struct ast_channel *chan, char *provider, char *extension, ch
if (!res && result->numresults) {
result->numresults--;
if (OSPPTransactionGetNextDestination(result->handle, OSPC_FAIL_INCOMPATIBLE_DEST, 0, NULL, NULL, &timelimit, &callidlen, uniqueid,
- sizeof(callednum), callednum, sizeof(destination), destination, 0, NULL, &tokenlen, token)) {
+ sizeof(callednum), callednum, sizeof(callingnum), callingnum, sizeof(destination), destination, 0, NULL, &tokenlen, token)) {
break;
}
}
@@ -624,6 +629,7 @@ int ast_osp_next(struct ast_osp_result *result, int cause)
unsigned int callidlen;
char uniqueid[32] = "";
char callednum[2048]="";
+ char callingnum[2048]="";
char destination[2048]="";
char token[2000];
OSPE_DEST_PROT prot;
@@ -640,7 +646,7 @@ int ast_osp_next(struct ast_osp_result *result, int cause)
while(!res && result->numresults) {
result->numresults--;
if (!OSPPTransactionGetNextDestination(result->handle, OSPC_FAIL_INCOMPATIBLE_DEST, 0, NULL, NULL, &timelimit, &callidlen, uniqueid,
- sizeof(callednum), callednum, sizeof(destination), destination, 0, NULL, &tokenlen, token)) {
+ 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)) {
res = 1;
@@ -655,6 +661,10 @@ int ast_osp_next(struct ast_osp_result *result, int cause)
strncpy(result->tech, "SIP", sizeof(result->tech) - 1);
snprintf(result->dest, sizeof(result->dest), "%s@%s", callednum, destination + 1);
break;
+ case OSPE_DEST_PROT_IAX:
+ strncpy(result->tech, "IAX", sizeof(result->tech) - 1);
+ snprintf(result->dest, sizeof(result->dest), "%s@%s", callednum, destination + 1);
+ break;
default:
ast_log(LOG_DEBUG, "Unknown destination protocol '%d', skipping...\n", prot);
res = 0;
@@ -700,10 +710,21 @@ int ast_osp_terminate(int handle, int cause, time_t start, time_t duration)
unsigned int dummy = 0;
int res = -1;
enum OSPEFAILREASON reason;
+
+ time_t endTime = 0;
+ time_t alertTime = 0;
+ time_t connectTime = 0;
+ unsigned isPddInfoPresent = 0;
+ unsigned pdd = 0;
+ unsigned releaseSource = 0;
+ unsigned char *confId = "";
+
reason = cause2reason(cause);
if (OSPPTransactionRecordFailure(handle, reason))
ast_log(LOG_WARNING, "Failed to record call termination for handle %d\n", handle);
- else if (OSPPTransactionReportUsage(handle, duration, start, 0, 0, 0, 0, &dummy, NULL))
+ else if (OSPPTransactionReportUsage(handle, duration, start,
+ endTime,alertTime,connectTime,isPddInfoPresent,pdd,releaseSource,confId,
+ 0, 0, 0, 0, &dummy, NULL))
ast_log(LOG_WARNING, "Failed to report duration for handle %d\n", handle);
else {
ast_log(LOG_DEBUG, "Completed recording handle %d\n", handle);