Index: asterisk/res/res_osp.c =================================================================== RCS file: /usr/cvsroot/asterisk/res/res_osp.c,v retrieving revision 1.23 diff -u -r1.23 res_osp.c --- asterisk/res/res_osp.c 14 Sep 2005 21:24:50 -0000 1.23 +++ asterisk/res/res_osp.c 21 Sep 2005 18:14:02 -0000 @@ -531,7 +531,8 @@ char destination[2048]=""; char token[2000]; char tmp[256]="", *l, *n; - OSPTCALLID *callid; + unsigned int callidnum=0; + OSPTCALLID *callid=NULL; OSPE_DEST_PROT prot; OSPE_DEST_OSP_ENABLED ospenabled; @@ -559,7 +560,11 @@ if (chan) { sipcallid = pbx_builtin_getvar_helper (chan, "SIPCALLID"); - ast_copy_string(callidstr, sipcallid, sizeof(callidstr)); + if (sipcallid != NULL) { + callidnum = 1; + ast_copy_string(callidstr, sipcallid, sizeof(callidstr)); + callid = OSPPCallIdNew(strlen(callidstr), callidstr); + } cres = ast_autoservice_start(chan); if (cres < 0) return cres; @@ -581,14 +586,13 @@ ast_mutex_unlock(&osplock); if (res) { res = 0; - callid = OSPPCallIdNew(strlen(callidstr), callidstr); - if (callid) { + if ((callidnum == 0) || (callid != NULL)) { /* No more than 10 back */ counts = 10; dummy = 0; callidlen = sizeof(callidstr); if (!OSPPTransactionRequestAuthorisation(result->handle, source, "", - callerid,OSPC_E164, extension, OSPC_E164, NULL, 1, &callid, NULL, &counts, &dummy, NULL)) { + callerid,OSPC_E164, extension, OSPC_E164, NULL, callidnum, &callid, NULL, &counts, &dummy, NULL)) { if (counts) { tokenlen = sizeof(token); result->numresults = counts - 1; @@ -641,7 +645,9 @@ } } - OSPPCallIdDelete(&callid); + if (callid != NULL) { + OSPPCallIdDelete(&callid); + } } if (!res) { OSPPTransactionDelete(result->handle);