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

Function uri2proxy

modules/tm/ut.h:73–103  ·  view source on GitHub ↗

* Convert a URI into a proxy structure */

Source from the content-addressed store, hash-verified

71 * Convert a URI into a proxy structure
72 */
73inline static struct proxy_l *uri2proxy( str *uri, int forced_proto )
74{
75 struct sip_uri parsed_uri;
76 struct proxy_l *p;
77 enum sip_protos proto;
78
79 if (parse_uri(uri->s, uri->len, &parsed_uri) < 0) {
80 LM_ERR("bad_uri: %.*s\n", uri->len, uri->s );
81 return 0;
82 }
83
84 if (parsed_uri.type==SIPS_URI_T && ((parsed_uri.proto!=PROTO_WSS) &&
85 (parsed_uri.proto!=PROTO_TLS) && (parsed_uri.proto!=PROTO_NONE)) ) {
86 LM_ERR("bad transport for sips uri: %d\n", parsed_uri.proto);
87 return 0;
88 }
89 proto=parsed_uri.proto;
90 if (forced_proto==PROTO_BOND) forced_proto = PROTO_NONE;
91
92 proto = get_proto(forced_proto, proto);
93
94 p = mk_proxy(
95 parsed_uri.maddr_val.len?&parsed_uri.maddr_val:&parsed_uri.host,
96 parsed_uri.port_no, proto, (parsed_uri.type==SIPS_URI_T)?1:0 );
97 if (p == 0) {
98 LM_ERR("bad host name in URI <%.*s>\n", uri->len, ZSW(uri->s));
99 return 0;
100 }
101
102 return p;
103}
104
105
106static inline int uri2su(str *uri, union sockaddr_union *to_su, int proto)

Callers 5

t_relay_toFunction · 0.85
uri2suFunction · 0.85
run_local_routeFunction · 0.85
t_uacFunction · 0.85
add_uacFunction · 0.85

Calls 3

parse_uriFunction · 0.85
get_protoFunction · 0.85
mk_proxyFunction · 0.85

Tested by

no test coverage detected