rem: if (rq->to && (pto=get_to(rq))
add: if (rq_rp->to && (pto=get_to(rq_rp))
context: static int fmt2strar( char *fmt, /* what would you like to account ? */		struct sip_msg *rq, /* accounted message */		struct hdr_field *to, 		str *phrase, 		int *total_len, /* total length of accounted values */		int *attr_len,  /* total length of accounted attribute names */		str **val_arr, /* that's the output -- must have MAX_ACC_COLUMNS */		str *atr_arr){	int cnt, tl, al;	struct to_body* from, *pto;	static struct sip_uri from_uri, to_uri;	static str mycode;	str *cr;	struct cseq_body *cseq;	cnt=tl=al=0;	/* we don't care about parsing here; either the function	 * was called from script, in which case the wrapping function	 * is supposed to parse, or from reply processing in which case	 * TM should have preparsed from REQUEST_IN callback; what's not	 * here is replaced with NA	 */	while(*fmt) {		if (cnt==ALL_LOG_FMT_LEN) {			LOG(L_ERR, "ERROR: fmt2strar: too long formatting string\n");			return 0;		}		switch(*fmt) {			case 'n': /* CSeq number */				if (rq->cseq && (cseq=get_cseq(rq)) && cseq->number.len) 					val_arr[cnt]=&cseq->number;				else val_arr[cnt]=&na;				ATR(CSEQ);				break;			case 'c':	/* Callid */				val_arr[cnt]=rq->callid && rq->callid->body.len						? &rq->callid->body : &na;				ATR(CALLID);				break;			case 'i': /* incoming uri */				val_arr[cnt]=&rq->first_line.u.request.uri;				ATR(IURI);				break;			case 'm': /* method */				val_arr[cnt]=&rq->first_line.u.request.method;				ATR(METHOD);				break;			case 'o':				if (rq->new_uri.len) val_arr[cnt]=&rq->new_uri;				else val_arr[cnt]=&rq->first_line.u.request.uri;				ATR(OURI);				break;			case 'f':				val_arr[cnt]=(rq->from && rq->from->body.len) 					? &rq->from->body : &na;				ATR(FROM);				break;			case 'r': /* from-tag */				if (rq->from && (from=get_from(rq))							&& from->tag_value.len) {						val_arr[cnt]=&from->tag_value;				} else val_arr[cnt]=&na;				ATR(FROMTAG);				break;			case 'U': /* digest, from-uri otherwise */				cr=cred_user(rq);				if (cr) {					ATR(UID);					val_arr[cnt]=cr;					break;				}				/* fallback to from-uri if digest unavailable ... */			case 'F': /* from-uri */				if (rq->from && (from=get_from(rq))							&& from->uri.len) {						val_arr[cnt]=&from->uri;				} else val_arr[cnt]=&na;				ATR(FROMURI);				break;			case '0': /* from user */				val_arr[cnt]=&na;				if (rq->from && (from=get_from(rq))						&& from->uri.len) {					parse_uri(from->uri.s, from->uri.len, &from_uri);					if (from_uri.user.len) 							val_arr[cnt]=&from_uri.user;				} 				ATR(FROMUSER);				break;			case 'X': /* from user */				val_arr[cnt]=&na;				if (rq->from && (from=get_from(rq))						&& from->uri.len) {					parse_uri(from->uri.s, from->uri.len, &from_uri);					if (from_uri.host.len) 							val_arr[cnt]=&from_uri.host;				} 				ATR(FROMDOMAIN);				break;			case 't':				val_arr[cnt]=(to && to->body.len) ? &to->body : &na;				ATR(TO);				break;			case 'd':					val_arr[cnt]=(to && (pto=(struct to_body*)(to->parsed))					&& pto->tag_value.len) ? 					& pto->tag_value : &na;				ATR(TOTAG);				break;			case 'T': /* to-uri */				if (rq->to && (pto=get_to(rq))							&& pto->uri.len) {						val_arr[cnt]=&pto->uri;				} else val_arr[cnt]=&na;				ATR(TOURI);				break;			case '1': /* to user */ 				val_arr[cnt]=&na;				if (rq->to && (pto=get_to(rq))							&& pto->uri.len) {					parse_uri(pto->uri.s, pto->uri.len, &to_uri);					if (to_uri.user.len)						val_arr[cnt]=&to_uri.user;				} 				ATR(TOUSER);				break;			case 'S':				if (phrase->len>=3) {					mycode.s=phrase->s;mycode.len=3;					val_arr[cnt]=&mycode;				} else val_arr[cnt]=&na;				ATR(CODE);				break;			case 's':				val_arr[cnt]=phrase;				ATR(STATUS);				break;			case 'u':				cr=cred_user(rq);				val_arr[cnt]=cr?cr:&na;				ATR(UID);				break;			case 'p': /* user part of request-uri */				val_arr[cnt]=rq->parsed_orig_ruri.user.len ?					& rq->parsed_orig_ruri.user : &na;				ATR(UP_IURI);				break;			case 'D': /* domain part of request-uri */				val_arr[cnt]=rq->parsed_orig_ruri.host.len ?					& rq->parsed_orig_ruri.host : &na;				ATR(RURI_DOMAIN);				break;			default:				LOG(L_CRIT, "BUG: acc_log_request: unknown char: %c\n",					*fmt);				return 0;		} /* switch (*fmt) */		tl+=val_arr[cnt]->len;		al+=atr_arr[cnt].len;		fmt++;		cnt++;	} /* while (*fmt) */	*total_len=tl;	*attr_len=al;	return cnt;}