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

Function calculate_hooks

modules/tm/dlg.c:83–127  ·  view source on GitHub ↗

* Calculate dialog hooks */

Source from the content-addressed store, hash-verified

81 * Calculate dialog hooks
82 */
83static inline int calculate_hooks(dlg_t* _d)
84{
85 str* uri;
86 struct sip_uri puri;
87
88 if (_d->route_set) {
89 uri = &_d->route_set->nameaddr.uri;
90 if (parse_uri(uri->s, uri->len, &puri) < 0) {
91 LM_ERR("failed parse to URI\n");
92 return -1;
93 }
94
95 if (puri.lr.s) {
96 if (_d->rem_target.s) _d->hooks.request_uri = &_d->rem_target;
97 else _d->hooks.request_uri = &_d->rem_uri;
98 _d->hooks.next_hop = &_d->route_set->nameaddr.uri;
99 _d->hooks.first_route = _d->route_set;
100 } else {
101 _d->hooks.request_uri = &_d->route_set->nameaddr.uri;
102 _d->hooks.next_hop = _d->hooks.request_uri;
103 _d->hooks.first_route = _d->route_set->next;
104 _d->hooks.last_route = &_d->rem_target;
105 }
106 } else {
107 if (_d->rem_target.s) _d->hooks.request_uri = &_d->rem_target;
108 else _d->hooks.request_uri = &_d->rem_uri;
109 if(_d->hooks.next_hop==NULL)
110 _d->hooks.next_hop = _d->hooks.request_uri;
111 }
112
113 if ((_d->hooks.request_uri) && (_d->hooks.request_uri->s) && (_d->hooks.request_uri->len)) {
114 _d->hooks.ru.s = _d->hooks.request_uri->s;
115 _d->hooks.ru.len = _d->hooks.request_uri->len;
116 _d->hooks.request_uri = &_d->hooks.ru;
117 get_raw_uri(_d->hooks.request_uri);
118 }
119 if ((_d->hooks.next_hop) && (_d->hooks.next_hop->s) && (_d->hooks.next_hop->len)) {
120 _d->hooks.nh.s = _d->hooks.next_hop->s;
121 _d->hooks.nh.len = _d->hooks.next_hop->len;
122 _d->hooks.next_hop = &_d->hooks.nh;
123 get_raw_uri(_d->hooks.next_hop);
124 }
125
126 return 0;
127}
128
129/*
130 * wrapper to calculate_hooks

Callers 4

w_calculate_hooksFunction · 0.85
_internal_new_dlg_uacFunction · 0.85
dlg_new_resp_uacFunction · 0.85
dlg_early_resp_uacFunction · 0.85

Calls 2

parse_uriFunction · 0.85
get_raw_uriFunction · 0.85

Tested by

no test coverage detected