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

Function run_local_route

modules/tm/uac.c:165–407  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163
164
165static int run_local_route( struct cell *new_cell, char **buf, int *buf_len,
166 dlg_t *dialog, struct sip_msg **ret_req, char **ret_req_buf)
167{
168 struct sip_msg *req = NULL;
169 struct cell *backup_cell;
170 int backup_route_type;
171 struct retr_buf *request;
172 struct proxy_l *new_proxy = NULL;
173 union sockaddr_union new_to_su;
174 const struct socket_info *new_send_sock;
175 unsigned short dst_changed;
176 char *buf1=NULL, *sipmsg_buf;
177 int buf_len1, sip_msg_len;
178 str h_to, h_from, h_cseq, h_callid;
179 struct ua_client* uac;
180
181 /* do not build buffer if callbacks are not needed and
182 * there are no local routes */
183 if (!has_tran_tmcbs(new_cell, TMCB_LOCAL_REQUEST_OUT) &&
184 !sroutes->local.a)
185 return 0;
186
187 LM_DBG("building sip_msg from buffer\n");
188 sipmsg_buf = *buf; /* remember the buffer used to get the sip_msg */
189 req = buf_to_sip_msg( *buf, *buf_len, dialog);
190 if (req==NULL) {
191 LM_ERR("failed to build sip_msg from buffer\n");
192 return -1;
193 }
194
195 /* set this transaction as active one */
196 backup_cell = get_t();
197 set_t( new_cell );
198 /* disable parallel forking */
199 set_dset_state( 0 /*disable*/);
200
201 /* run the route */
202 swap_route_type( backup_route_type, LOCAL_ROUTE);
203 if (sroutes && sroutes->local.a)
204 run_top_route( sroutes->local, req);
205 if (has_tran_tmcbs(new_cell, TMCB_LOCAL_REQUEST_OUT) ) {
206 run_trans_callbacks(TMCB_LOCAL_REQUEST_OUT, new_cell,
207 req, 0, 0);
208 }
209 set_route_type( backup_route_type );
210
211 uac = & TM_BRANCH( new_cell, 0);
212
213 /* transfer current message context back to t */
214 uac->br_flags = getb0flags(req);
215 /* restore the prevoius active transaction */
216 set_t( backup_cell );
217
218 set_dset_state( 1 /*enable*/);
219
220 /* check for changes - if none, do not regenerate the buffer */
221 dst_changed = 1;
222 if (req->new_uri.s || req->force_send_socket!=dialog->send_sock ||

Callers 1

t_uacFunction · 0.85

Calls 15

buf_to_sip_msgFunction · 0.85
get_tFunction · 0.85
set_tFunction · 0.85
set_dset_stateFunction · 0.85
run_top_routeFunction · 0.85
run_trans_callbacksFunction · 0.85
should_update_sip_bodyFunction · 0.85
uri2proxyFunction · 0.85
hostent2suFunction · 0.85
get_send_socketFunction · 0.85
free_proxyFunction · 0.85
del_lumpFunction · 0.85

Tested by

no test coverage detected