MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / contact_builder

Function contact_builder

msg_translator.c:2978–3014  ·  view source on GitHub ↗

uses uri_buff above, since contact is still an uri */

Source from the content-addressed store, hash-verified

2976
2977/* uses uri_buff above, since contact is still an uri */
2978char *contact_builder(const struct socket_info* send_sock, int *ct_len)
2979{
2980 char *p;
2981 int proto_len = 0;
2982 const str* address_str = get_adv_host(send_sock);
2983 const str* port_str = get_adv_port(send_sock);
2984
2985 /* sip: */
2986 p = uri_buff;
2987 memcpy(p, "sip:", 4);
2988 p += 4;
2989
2990 /* host */
2991 memcpy(p, address_str->s, address_str->len);
2992 p += address_str->len;
2993
2994 /* :port */
2995 *p++ = ':';
2996 memcpy(p, port_str->s, port_str->len);
2997 p += port_str->len;
2998
2999 /* transport if needed */
3000 if (send_sock->proto != PROTO_UDP) {
3001 memcpy(p, ";transport=", 11);
3002 p += 11;
3003 proto_len = strlen(protos[send_sock->proto].name);
3004 memcpy(p, protos[send_sock->proto].name, proto_len);
3005 p += proto_len;
3006 }
3007
3008 *p = '\0';
3009
3010 if (ct_len)
3011 *ct_len = p - uri_buff;
3012
3013 return uri_buff;
3014}

Callers 8

srs_send_inviteFunction · 0.85
b2b_sdp_demux_startFunction · 0.85
msrpua_init_uasFunction · 0.85
b2b_ua_server_initFunction · 0.85
media_get_client_infoFunction · 0.85
media_fork_from_callFunction · 0.85
media_exchange_to_callFunction · 0.85

Calls 2

get_adv_hostFunction · 0.85
get_adv_portFunction · 0.85

Tested by

no test coverage detected