From: Mark Spencer Date: Fri, 25 Jun 2004 04:27:55 +0000 (+0000) Subject: Small outgoing OSP cleanups X-Git-Tag: 1.0.0-rc1~159 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f421a55da9b9e2f19bb1d02237f2d7d6846df5b;p=thirdparty%2Fasterisk.git Small outgoing OSP cleanups git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3299 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/apps/app_osplookup.c b/apps/app_osplookup.c index 7e6e0105b9..55216d4ebf 100755 --- a/apps/app_osplookup.c +++ b/apps/app_osplookup.c @@ -192,7 +192,10 @@ static int ospfinished_exec(struct ast_channel *chan, void *data) } if (chan->cdr) { start = chan->cdr->answer.tv_sec; - duration = time(NULL) - start; + if (start) + duration = time(NULL) - start; + else + duration = 0; } else ast_log(LOG_WARNING, "OSPFinish called on channel '%s' with no CDR!\n", chan->name); LOCAL_USER_ADD(u); diff --git a/res/res_osp.c b/res/res_osp.c index deac15c7bb..6270c4a72a 100755 --- a/res/res_osp.c +++ b/res/res_osp.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -434,6 +435,7 @@ int ast_osp_lookup(struct ast_channel *chan, char *provider, char *extension, ch char callednum[2048]=""; char destination[2048]=""; char token[2000]; + char tmp[256]="", *l, *n; OSPTCALLID *callid; OSPE_DEST_PROT prot; @@ -448,6 +450,16 @@ int ast_osp_lookup(struct ast_channel *chan, char *provider, char *extension, ch if (!callerid) callerid = ""; + strncpy(tmp, callerid, sizeof(tmp) - 1); + ast_callerid_parse(tmp, &n, &l); + if (!l) + l = ""; + else { + ast_shrink_phone_number(l); + if (!ast_isphonenumber(l)) + l = ""; + } + callerid = l; if (chan) { strncpy(uniqueid, chan->uniqueid, sizeof(uniqueid) - 1);