rem: int comment_len;  comment_len = strlen(comment);  printf("rad_acc_request(): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ CALLED!!!\n");    if ( parse_headers(rq, HDR_FROM | HDR_CALLID, 0)==-1 || !(rq->from && rq->callid) ) { LOG(L_ERR, "ERROR: acc_missed: From not dounf\n"); return -1; } LOG( log_level, "ACC: call missed: " "i-uri=%.*s, o-uri=%.*s, call_id=%.*s, " "from=%.*s, reason=%.*s\n", rq->first_line.u.request.uri.len, rq->first_line.u.request.uri.s, rq->new_uri.len, rq->new_uri.s, rq->callid->body.len, rq->callid->body.s, rq->from->body.len, rq->from->body.s, comment_len, comment); return 1;
add: UINT4 av_type;							 int result;                           	 VALUE_PAIR *send = NULL;              	 UINT4 client_port;                    	 struct sip_uri uri;                   	 int len, ret;							 char *tmp;								 char *buf;								 int stop = 0;                         	 struct to_body *to;						  struct to_body *from; struct cseq_body *cseq;					 auth_body_t *cred;						 str	username;							  DBG("**************rad_acc_request() CALLED \n");    av_type = CALL_MISSED; if (rc_avpair_add(&send, PW_ACCT_STATUS_TYPE, &av_type, 0) == NULL) { DBG("rad_acc_request(): ERROR:PW_ACCT_STATUS_TYPE \n"); return(ERROR_RC); }   av_type = SIP_SERVICE_TYPE; if (rc_avpair_add(&send, PW_SERVICE_TYPE, &av_type, 0) == NULL) { DBG("rad_acc_request(): ERROR:PW_SERVICE_TYPE \n"); return(ERROR_RC); }   if (rq->first_line.type == SIP_REQUEST) { av_type = rq->REQ_METHOD; if (rc_avpair_add(&send, PW_SIP_METHOD, &av_type, 0) == NULL) { DBG("rad_acc_request(): ERROR:PW_SIP_METHOD \n"); return(ERROR_RC); } }   if (rq->first_line.type == SIP_REPLY) {  av_type = rq->REPLY_STATUS; if (rc_avpair_add(&send, PW_SIP_RESPONSE_CODE, &av_type, 0) == NULL) { DBG("rad_acc_request(): ERROR:PW_SIP_RESPONSE_CODE \n"); return(ERROR_RC); } }   if (rq->from->parsed == 0) {  parse_from_header(rq->from); }  from = (struct to_body *)rq->from->parsed;  if (from->error == PARSE_OK) { tmp = cleanbody(from->uri);   if (rc_avpair_add(&send,PW_SIP_FROM_TAG, &from->tag_value.s[0], 0) == NULL) { DBG("rad_acc_request(): ERROR:PW_SIP_FROM_TAG \n"); return(ERROR_RC); } } else { DBG("rad_acc_request(): Error parsing from body \n");  tmp = &rq->from->body.s[0]; }  if (rc_avpair_add(&send, PW_CALLING_STATION_ID, tmp, 0) == NULL) { DBG("rad_acc_request(): ERROR:PW_CALLING_STATION_ID %s \n", rq->from->body.s); return(ERROR_RC); }   to = (struct to_body *) rq->to->parsed; if (to->error == PARSE_OK) { tmp = cleanbody(to->uri);   if (rq->REQ_METHOD != METHOD_INVITE) { if (rc_avpair_add(&send,PW_SIP_TO_TAG, &to->tag_value.s[0], 0) == NULL) { DBG("rad_acc_request(): ERROR:PW_SIP_TO_TAG\n"); return(ERROR_RC); } } } else { DBG("rad_acc_request(): Error parsing to body \n");  tmp = &rq->to->body.s[0]; }  if (rc_avpair_add(&send, PW_CALLED_STATION_ID, tmp, 0) == NULL) { DBG("rad_acc_request(): ERROR:PW_CALLED_STATION_ID %.*s]\n", rq->to->body.len, rq->to->body.s); return(ERROR_RC); }   cseq = get_cseq(rq); tmp = cleanbody(cseq->number); if (rc_avpair_add(&send,PW_SIP_CSEQ , tmp, 0) == NULL) { DBG("rad_acc_request(): ERROR:PW_SIP_CSEQ \n"); return(ERROR_RC); }   av_type = rq->REPLY_STATUS; if (rc_avpair_add(&send, PW_SIP_RESPONSE_CODE, &av_type, 0) == NULL) { DBG("radius_log_ack(): ERROR:PW_SIP_RESPONSE_CODE \n"); return(ERROR_RC); }   if (rq->new_uri.s) { buf = rq->new_uri.s; len = rq->new_uri.len; } else{ buf = rq->first_line.u.request.uri.s; len = rq->first_line.u.request.uri.len; } ret = parse_uri(buf, len, &uri); if (ret < 0) { LOG(L_ERR, "ERROR: Accounting bad_uri <%s>," " dropping packet\n",tmp); return(ERROR_RC); }    if (!(rq->authorization)) {  if (parse_headers(rq, HDR_AUTHORIZATION, 0) == -1) { LOG(L_ERR, "radis_log_reply: Error while parsing auth headers\n"); return -2; } }   if (rq->authorization) { if (parse_credentials(rq->authorization) != -1) { cred = (auth_body_t*)(rq->authorization->parsed); if (check_dig_cred(&(cred->digest)) != E_DIG_OK) { LOG(L_ERR, "rad_acc_request: Credentials missing\n"); return(ERROR_RC); } else {  username.s = from->uri.s; username.len = from->uri.len; if (auth_get_username(&username) < 0) { LOG(L_ERR, "rad_acc_request: " "Error while extracting username\n"); return(ERROR_RC); } tmp = cleanbody(username); } } } else {  username.s = from->uri.s; username.len = from->uri.len; if (auth_get_username(&username) < 0) { LOG(L_ERR, "rad_acc_request: " "Error while extracting username\n"); return(ERROR_RC); } tmp = cleanbody(username); }  if (rc_avpair_add(&send, PW_USER_NAME, tmp, 0) == NULL) { DBG("rad_acc_request(): ERROR: \n"); return(ERROR_RC); }   if (rq->new_uri.s) tmp = cleanbody(rq->new_uri); else tmp = cleanbody(rq->first_line.u.request.uri);  if (rc_avpair_add(&send, PW_SIP_TRANSLATED_REQ_URI, tmp, 0) == NULL) { DBG("rad_acc_request(): ERROR:PW_SIP_TRANSLATED_REQ_URI \n"); return(ERROR_RC); }   tmp = cleanbody(rq->callid->body); if (rc_avpair_add(&send, PW_ACCT_SESSION_ID, tmp, 0) == NULL) { DBG("rad_acc_request(): ERROR:PW_ACCT_SESSION_ID \n"); return(ERROR_RC); }   if (stop) { av_type = 0;  if (rc_avpair_add(&send, PW_ACCT_SESSION_TIME, &av_type, 0) == NULL) { DBG("rad_acc_request(): ERROR:PW_ACCT_SESSION_TIME \n"); return(ERROR_RC); } }   if (stop) { av_type = 0;  if (rc_avpair_add(&send, PW_ACCT_TERMINATE_CAUSE, &av_type, 0) == NULL) { DBG("rad_acc_request(): ERROR:PW_ACCT_TERMINATE_CAUSE \n"); return(ERROR_RC); } }   av_type = PW_RADIUS; if (rc_avpair_add(&send, PW_ACCT_AUTHENTIC, &av_type, 0) == NULL) { DBG("rad_acc_request(): ERROR:PW_ACCT_AUTHENTIC \n"); return(ERROR_RC); }   client_port = SIP_PORT; result = rc_acct(client_port, send);   rc_avpair_free(send);  if (result != OK_RC) {  DBG("rad_acc_request(): Error: Accounting Request Rejected\n"); } else { DBG("RADIUS Accounting Request Received... \n"); }  return result;
context: int rad_acc_request( struct sip_msg *rq, char * comment, char  *foo){	int comment_len;	comment_len = strlen(comment);	printf("rad_acc_request(): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ CALLED!!!\n");	/* we can parse here even if we do not knwo whether the	   request is an incmoing pkg_mem message or stoed  shmem_msg;	   thats because acc_missed_report operating over shmem never	   enters acc_missed if the header fields are not parsed	   and entering the function from script gives pkg_mem,	   which can be parsed	*/	   	if ( parse_headers(rq, HDR_FROM | HDR_CALLID, 0)==-1 				|| !(rq->from && rq->callid) ) {		LOG(L_ERR, "ERROR: acc_missed: From not dounf\n");		return -1;	}	LOG( log_level,		"ACC: call missed: "		"i-uri=%.*s, o-uri=%.*s, call_id=%.*s, "		"from=%.*s, reason=%.*s\n",        rq->first_line.u.request.uri.len,        rq->first_line.u.request.uri.s,		rq->new_uri.len, rq->new_uri.s,		rq->callid->body.len, rq->callid->body.s,		rq->from->body.len, rq->from->body.s,        comment_len, comment);	return 1;}