rem: newport.s = buf; newport.len = sprintf(buf, "%d", port);
context: force_rtp_proxy2_f(struct sip_msg* msg, char* str1, char* str2){	str body, body1, oldport, oldip, oldip1, newport, newip;	str callid, from_tag, to_tag, tmp;	int create, port, len, asymmetric, flookup, argc, proxied, real;	int oidx, pf, pf1, force;	char buf[16], opts[16];	char *cp, *cp1;	char **ap, *argv[10];	struct lump* anchor;	struct iovec v[1 + 6 + 5] = {{NULL, 0}, {opts, 0}, {" ", 1}, {NULL, 0}, {" ", 1}, {NULL, 7}, {" ", 1}, {NULL, 1}, {" ", 1}, {NULL, 0}, {" ", 1}, {NULL, 0}};						/* 1 */    /* 2 */   /* 3 */    /* 4 */   /* 5 */    /* 6 */   /* 7 */    /* 8 */   /* 9 */    /* 10 */  /* 11 */	asymmetric = flookup = force = real = 0;	oidx = 1;	for (cp = str1; *cp != '\0'; cp++) {		switch (*cp) {		case 'a':		case 'A':			opts[oidx++] = 'A';			asymmetric = 1;			real = 1;			break;		case 'i':		case 'I':			opts[oidx++] = 'I';			break;		case 'e':		case 'E':			opts[oidx++] = 'E';			break;		case 'l':		case 'L':			flookup = 1;			break;		case 'f':		case 'F':			force = 1;			break;		case 'r':		case 'R':			real = 1;			break;		default:			LOG(L_ERR, "ERROR: force_rtp_proxy2: unknown option `%c'\n", *cp);			return -1;		}	}	rtpproxy_disable = rtpp_test(rtpproxy_disable, 0);	if (rtpproxy_disable != 0) {		LOG(L_ERR, "ERROR: force_rtp_proxy2: support for RTP proxy "		    "is disabled\n");		return -1;	}	if (msg->first_line.type == SIP_REQUEST &&	    msg->first_line.u.request.method_value == METHOD_INVITE) {		create = 1;	} else if (msg->first_line.type == SIP_REPLY) {		create = 0;	} else {		return -1;	}	/* extract_body will also parse all the headers in the message as	 * a side effect => don't move get_callid/get_to_tag in front of it	 * -- andrei */	if (extract_body(msg, &body) == -1) {		LOG(L_ERR, "ERROR: force_rtp_proxy2: can't extract body "		    "from the message\n");		return -1;	}	if (get_callid(msg, &callid) == -1 || callid.len == 0) {		LOG(L_ERR, "ERROR: force_rtp_proxy2: can't get Call-Id field\n");		return -1;	}	if (get_to_tag(msg, &to_tag) == -1) {		LOG(L_ERR, "ERROR: force_rtp_proxy2: can't get To tag\n");		return -1;	}	if (get_from_tag(msg, &from_tag) == -1 || from_tag.len == 0) {		LOG(L_ERR, "ERROR: force_rtp_proxy2: can't get From tag\n");		return -1;	}	if (flookup != 0) {		if (create == 0 || to_tag.len == 0)			return -1;		create = 0;		tmp = from_tag;		from_tag = to_tag;		to_tag = tmp;	}	proxied = 0;	for (cp = body.s; (len = body.s + body.len - cp) >= ANORTPPROXY_LEN;) {		cp1 = ser_memmem(cp, ANORTPPROXY, len, ANORTPPROXY_LEN);		if (cp1 == NULL)			break;		if (cp1[-1] == '\n' || cp1[-1] == '\r') {			proxied = 1;			break;		}		cp = cp1 + ANORTPPROXY_LEN;	}	if (proxied != 0 && force == 0)		return -1;	if (extract_mediaip(&body, &oldip, &pf) == -1) {		LOG(L_ERR, "ERROR: force_rtp_proxy2: can't extract media IP "		    "from the message\n");		return -1;	}	if (asymmetric != 0 || real != 0) {		newip = oldip;	} else {		newip.s = ip_addr2a(&msg->rcv.src_ip);		newip.len = strlen(newip.s);	}	body1.s = oldip.s + oldip.len;	body1.len = body.s + body.len - body1.s;	if (extract_mediaip(&body1, &oldip1, &pf1) == -1) {		oldip1.len = 0;	}	if (oldip1.len > 0 && pf != pf1) {		LOG(L_ERR, "ERROR: force_rtp_proxy2: mismatching address "		    "families in SDP\n");		return -1;	}	if (extract_mediaport(&body, &oldport) == -1) {		LOG(L_ERR, "ERROR: force_rtp_proxy2: can't extract media port "		    "from the message\n");		return -1;	}	if (pf == AF_INET6) {		opts[oidx] = '6';		oidx++;	}	opts[0] = (create == 0) ? 'L' : 'U';	v[1].iov_len = oidx;	STR2IOVEC(callid, v[3]);	STR2IOVEC(newip, v[5]);	STR2IOVEC(oldport, v[7]);	STR2IOVEC(from_tag, v[9]);	STR2IOVEC(to_tag, v[11]);	cp = send_rtpp_command(v, (to_tag.len > 0) ? 12 : 10);	if (cp == NULL)		return -1;	argc = 0;	memset(argv, 0, sizeof(argv));	for (ap = argv; (*ap = strsep(&cp, "\r\n\t ")) != NULL;)		if (**ap != '\0') {			argc++;			if (++ap >= &argv[10])				break;		}	if (argc < 1)		return -1;	port = atoi(argv[0]);	if (port <= 0 || port > 65535)		return -1;	pf1 = (argc >= 3 && argv[2][0] == '6') ? AF_INET6 : AF_INET;	if (isnulladdr(&oldip, pf)) {		if (pf1 == AF_INET6) {			newip.s = "::";			newip.len = 2;		} else {			newip.s = "0.0.0.0";			newip.len = 7;		}	} else {		newport.s = buf;		newport.len = sprintf(buf, "%d", port);		newip.s = (argc < 2) ? str2 : argv[1];		newip.len = strlen(newip.s);	}	if (alter_mediaip(msg, &body, &oldip, pf, &newip, pf1, 0) == -1)		return -1;	if (oldip1.len > 0 &&	    alter_mediaip(msg, &body1, &oldip1, pf, &newip, pf1, 0) == -1)		return -1;	if (alter_mediaport(msg, &body, &oldport, &newport, 0) == -1)		return -1;	if (proxied == 0) {		cp = pkg_malloc(ANORTPPROXY_LEN * sizeof(char));		if (cp == NULL) {			LOG(L_ERR, "ERROR: force_rtp_proxy2: out of memory\n");			return -1;		}		anchor = anchor_lump(msg, body.s + body.len - msg->buf, 0, 0);		if (anchor == NULL) {			LOG(L_ERR, "ERROR: force_rtp_proxy2: anchor_lump failed\n");			pkg_free(cp);			return -1;		}		memcpy(cp, ANORTPPROXY, ANORTPPROXY_LEN);		if (insert_new_lump_after(anchor, cp, ANORTPPROXY_LEN, 0) == NULL) {			LOG(L_ERR, "ERROR: force_rtp_proxy2: insert_new_lump_after failed\n");			pkg_free(cp);			return -1;		}	}	return 1;}