rem: db_key_t db_keys[2] = { sc_uri_user, sc_uri_host };
add: db_key_t db_keys[2];
context: static int m_dump(struct sip_msg* msg, char* str1, char* str2){	struct to_body to, *pto = NULL;	db_key_t db_keys[2] = { sc_uri_user, sc_uri_host };	db_val_t db_vals[2];	db_key_t db_cols[] = {					sc_mid      /* 0 */, sc_from      /* 1 */,					sc_to       /* 2 */, sc_body      /* 3 */,					sc_ctype    /* 4 */, sc_inc_time  /* 5 */				};	db_res_t* db_res = NULL;	int i, db_no_cols = 6, db_no_keys = 2, mid, n;	char hdr_buf[1024], body_buf[1024];	struct sip_uri puri;	str str_vals[4], hdr_str , body_str;	time_t rtime;	DBG("MSILO:m_dump: ------------ start ------------\n");	hdr_str.s=hdr_buf;	hdr_str.len=1024;	body_str.s=body_buf;	body_str.len=1024;		/* check for TO header */	if(msg->to==NULL && (parse_headers(msg, HDR_TO, 0)==-1				|| msg->to==NULL || msg->to->body.s==NULL))	{		LOG(L_ERR,"MSILO:m_dump: ERROR cannot find TO HEADER!\n");		goto error;	}	/* get TO header URI */	if(msg->to->parsed != NULL)	{		pto = (struct to_body*)msg->to->parsed;		DBG("MSILO:m_dump: 'To' header ALREADY PARSED: <%.*s>\n",			pto->uri.len, pto->uri.s );		}	else	{		memset( &to , 0, sizeof(to) );		parse_to(msg->to->body.s,			msg->to->body.s + msg->to->body.len + 1, &to);		if(to.uri.len <= 0) /* || to.error != PARSE_OK) */		{			DBG("MSILO:m_dump: 'To' header NOT parsed\n");			goto error;		}		pto = &to;	}	/**	 * check if has expires=0 (REGISTER)	 */	if(parse_headers(msg, HDR_EXPIRES, 0) >= 0)	{		/* check 'expires' > 0 */		if(msg->expires && msg->expires->body.len > 0)		{			i = atoi(msg->expires->body.s);			if(i <= 0)			{ /* user goes offline */				DBG("MSILO:m_dump: user <%.*s> goes offline - expires=%d\n",						pto->uri.len, pto->uri.s, i);				goto error;			}			else				DBG("MSILO:m_dump: user <%.*s> online - expires=%d\n",						pto->uri.len, pto->uri.s, i);		}	}	else	{		DBG("MSILO:m_dump: 'expires' threw error at parsing\n");		goto error;	}	if(parse_uri(pto->uri.s, pto->uri.len, &puri)!=0)	{		LOG(L_ERR, "MSILO:m_dump: bad R-URI!\n");		goto error;	}	if(puri.user.len<=0 || puri.user.s==NULL			|| puri.host.len<=0 || puri.host.s==NULL)	{		LOG(L_ERR, "MSILO:m_dump: bad URI in To header!\n");		goto error;	}	db_vals[0].type = DB_STR;	db_vals[0].nul = 0;	db_vals[0].val.str_val.s = puri.user.s;	db_vals[0].val.str_val.len = puri.user.len;	db_vals[1].type = DB_STR;	db_vals[1].nul = 0;	db_vals[1].val.str_val.s = puri.host.s;	db_vals[1].val.str_val.len = puri.host.len;	if (msilo_dbf.use_table(db_con, ms_db_table) < 0)	{		LOG(L_ERR, "MSILO:m_dump: Error in use_table\n");		goto error;	}	if((msilo_dbf.query(db_con,db_keys,NULL,db_vals,db_cols,db_no_keys,				db_no_cols, NULL,&db_res)!=0) || (RES_ROW_N(db_res) <= 0))	{		DBG("MSILO:m_dump: no stored message for <%.*s>!\n", pto->uri.len,					pto->uri.s);		goto done;	}			DBG("MSILO:m_dump: dumping [%d] messages for <%.*s>!!!\n", 			RES_ROW_N(db_res), pto->uri.len, pto->uri.s);	for(i = 0; i < RES_ROW_N(db_res); i++) 	{		mid =  RES_ROWS(db_res)[i].values[0].val.int_val;		if(msg_list_check_msg(ml, mid))		{			DBG("MSILO:m_dump: message[%d] mid=%d already sent.\n", 				i, mid);			continue;		}				memset(str_vals, 0, 4*sizeof(str));		SET_STR_VAL(str_vals[0], db_res, i, 1); /* from */		SET_STR_VAL(str_vals[1], db_res, i, 2); /* to */		SET_STR_VAL(str_vals[2], db_res, i, 3); /* body */		SET_STR_VAL(str_vals[3], db_res, i, 4); /* ctype */		hdr_str.len = 1024;		if(m_build_headers(&hdr_str, str_vals[3] /*ctype*/,				str_vals[0]/*from*/) < 0)		{			DBG("MSILO:m_dump: headers building failed!!!\n");			if (msilo_dbf.free_result(db_con, db_res) < 0)				DBG("MSILO:m_dump: Error while freeing result of"					" query\n");			msg_list_set_flag(ml, mid, MS_MSG_ERRO);			goto error;		}					DBG("MSILO:m_dump: msg [%d-%d] for: %.*s\n", i+1, mid,				pto->uri.len, pto->uri.s);					/** sending using TM function: t_uac */		body_str.len = 1024;		rtime = 			(time_t)RES_ROWS(db_res)[i].values[5/*inc time*/].val.int_val;		n = m_build_body(&body_str, rtime, str_vals[2/*body*/]);		if(n<0)			DBG("MSILO:m_dump: sending simple body\n");		else			DBG("MSILO:m_dump: sending composed body\n");					tmb.t_request(&msg_type,  /* Type of the message */					&pto->uri,        /* Request-URI */					&str_vals[1],     /* To */					&str_vals[0],     /* From */					&hdr_str,         /* Optional headers including CRLF */					(n<0)?&str_vals[2]:&body_str, /* Message body */					m_tm_callback,    /* Callback function */					(void*)(long)mid        /* Callback parameter */				);	}done:	/**	 * Free the result because we don't need it	 * anymore	 */	if (db_res!=NULL && msilo_dbf.free_result(db_con, db_res) < 0)		DBG("MSILO:m_dump: Error while freeing result of query\n");	return 1;error:	return -1;}