From be021d67dd8af908faba45e3b96c3ad9219791c3 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Mon, 28 Jan 2013 16:48:49 +0000 Subject: [PATCH] convert received-from field to list --- modules/rtpproxy-ng/rtpproxy.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/modules/rtpproxy-ng/rtpproxy.c b/modules/rtpproxy-ng/rtpproxy.c index 57c4ed034..aedef06b9 100644 --- a/modules/rtpproxy-ng/rtpproxy.c +++ b/modules/rtpproxy-ng/rtpproxy.c @@ -1759,7 +1759,7 @@ static int force_rtp_proxy(struct sip_msg* msg, char* str1, char* str2, int offer, int forcedIP) { bencode_buffer_t bencbuf; - bencode_item_t *dict; + bencode_item_t *dict, *item; int ret, create; str body, newbody; str callid, from_tag, to_tag, viabranch, tmp; @@ -1798,8 +1798,22 @@ force_rtp_proxy(struct sip_msg* msg, char* str1, char* str2, int offer, int forc LM_ERR("can't extract body from the message\n"); goto error; } - if (!bencode_dictionary_add_string(dict, "received-from", ip_addr2a(&msg->rcv.src_ip))) + + if (!(item = bencode_list(&bencbuf))) + goto benc_error; + + if (!bencode_dictionary_add(dict, "received-from", item)) goto benc_error; + if (!bencode_list_add_string(dict, (msg->rcv.src_ip.af == AF_INET) ? "IP4" : ( +#ifdef USE_IPV6 + (msg->rcv.src_ip.af == AF_INET6) ? "IP6" : +#endif + "?" + ) )) + goto benc_error; + if (!bencode_list_add_string(dict, ip_addr2a(&msg->rcv.src_ip))) + goto benc_error; + if (!bencode_dictionary_add_str(dict, "sdp", &body)) goto benc_error; if (get_callid(msg, &callid) == -1 || callid.len == 0) {