@@ -190,7 +190,7 @@ static inline int fix_fake_req_headers(struct sip_msg *req)
190
190
191
191
192
192
static inline int fake_req (struct sip_msg * faked_req , struct sip_msg * shm_msg ,
193
- struct ua_server * uas , struct ua_client * uac , int inherit_br_data )
193
+ struct ua_server * uas , struct ua_client * uac )
194
194
{
195
195
/* on_negative_reply faked msg now copied from shmem msg (as opposed
196
196
* to zero-ing) -- more "read-only" actions (exec in particular) will
@@ -208,8 +208,11 @@ static inline int fake_req(struct sip_msg *faked_req, struct sip_msg *shm_msg,
208
208
209
209
faked_req -> msg_flags |= FL_TM_FAKE_REQ ;
210
210
211
- /* new_uri can change -- make a private copy */
212
211
if (uac ) {
212
+
213
+ /* duplicate some values into private mem
214
+ * so that they can be visible and changed at script level */
215
+ /* RURI / new URI */
213
216
faked_req -> new_uri .s = pkg_malloc ( uac -> uri .len + 1 );
214
217
if (!faked_req -> new_uri .s ) {
215
218
LM_ERR ("no uri/pkg mem\n" );
@@ -218,13 +221,6 @@ static inline int fake_req(struct sip_msg *faked_req, struct sip_msg *shm_msg,
218
221
faked_req -> new_uri .len = uac -> uri .len ;
219
222
memcpy ( faked_req -> new_uri .s , uac -> uri .s , uac -> uri .len );
220
223
faked_req -> new_uri .s [faked_req -> new_uri .len ]= 0 ;
221
- } else {
222
- faked_req -> new_uri .s = NULL ;
223
- faked_req -> new_uri .len = 0 ;
224
- }
225
- faked_req -> parsed_uri_ok = 0 ;
226
-
227
- if (inherit_br_data ) {
228
224
229
225
/* duplicate the dst_uri and path_vec into private mem
230
226
* so that they can be visible and changed at script level */
@@ -245,6 +241,11 @@ static inline int fake_req(struct sip_msg *faked_req, struct sip_msg *shm_msg,
245
241
memcpy (faked_req -> path_vec .s , uac -> path_vec .s , uac -> path_vec .len );
246
242
}
247
243
244
+ /* set the branch flags from the elected branch */
245
+ setb0flags ( faked_req , uac -> br_flags );
246
+ /* Q and force_send_socket values were already copied
247
+ * as part of the sip_msg struct */
248
+
248
249
/* duplicate advertised address and port from UAC into
249
250
* private mem so that they can be changed at script level */
250
251
if (uac -> adv_address .s ) {
@@ -272,16 +273,23 @@ static inline int fake_req(struct sip_msg *faked_req, struct sip_msg *shm_msg,
272
273
faked_req -> set_global_port .len = 0 ;
273
274
}
274
275
275
- /* Q value was already copied as part of the sip_msg struct */
276
276
} else {
277
277
278
+ /* reset new URI value */
279
+ faked_req -> new_uri .s = NULL ;
280
+ faked_req -> new_uri .len = 0 ;
281
+
278
282
/* reset DST URI, PATH vector and Q value */
279
283
faked_req -> dst_uri .s = NULL ;
280
284
faked_req -> dst_uri .len = 0 ;
281
285
faked_req -> path_vec .s = NULL ;
282
286
faked_req -> path_vec .len = 0 ;
283
287
faked_req -> ruri_q = Q_UNSPECIFIED ;
284
288
289
+ /* reset force_send_socket and the per-branch flags */
290
+ faked_req -> force_send_socket = NULL ;
291
+ setb0flags ( faked_req , 0 );
292
+
285
293
/* duplicate advertised address and port from SIP MSG into
286
294
* private mem so that they can be changed at script level */
287
295
if (shm_msg -> set_global_address .s ) {
@@ -318,11 +326,8 @@ static inline int fake_req(struct sip_msg *faked_req, struct sip_msg *shm_msg,
318
326
goto out4 ;
319
327
}
320
328
321
- /* set as flags the global flags and the branch flags from the
322
- * elected branch */
329
+ /* set as flags the global flags */
323
330
faked_req -> flags = uas -> request -> flags ;
324
- if (uac )
325
- setb0flags ( faked_req , uac -> br_flags );
326
331
327
332
return 1 ;
328
333
out4 :
0 commit comments