uses uri_buff above, since contact is still an uri */
| 2976 | |
| 2977 | /* uses uri_buff above, since contact is still an uri */ |
| 2978 | char *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 | } |
no test coverage detected