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

Function response2dlg

modules/tm/dlg.c:343–372  ·  view source on GitHub ↗

* Extract all necessary information from a response and put it * in a dialog structure */

Source from the content-addressed store, hash-verified

341 * in a dialog structure
342 */
343static inline int response2dlg(struct sip_msg* _m, dlg_t* _d)
344{
345 str contact, rtag;
346
347 /* Parse the whole message, we will need all Record-Route headers */
348 if (parse_headers(_m, HDR_EOH_F, 0) == -1) {
349 LM_ERR("failed to parse headers\n");
350 return -1;
351 }
352
353 if (get_contact_uri(_m, &contact) < 0) return -2;
354 if (contact.len && shm_str_dup(&_d->rem_target, &contact) < 0) return -3;
355
356 if (get_to_tag(_m, &rtag) < 0) goto err1;
357 if (rtag.len && shm_str_dup(&_d->id.rem_tag, &rtag) < 0) goto err1;
358
359 if (get_route_set(_m, &_d->route_set, REVERSE_ORDER) < 0) goto err2;
360
361 return 0;
362 err2:
363 if (_d->id.rem_tag.s) shm_free(_d->id.rem_tag.s);
364 _d->id.rem_tag.s = 0;
365 _d->id.rem_tag.len = 0;
366
367 err1:
368 if (_d->rem_target.s) shm_free(_d->rem_target.s);
369 _d->rem_target.s = 0;
370 _d->rem_target.len = 0;
371 return -4;
372}
373
374
375/*

Callers 2

dlg_new_resp_uacFunction · 0.85
dlg_early_resp_uacFunction · 0.85

Calls 4

shm_freeFunction · 0.85
get_contact_uriFunction · 0.70
get_to_tagFunction · 0.70
get_route_setFunction · 0.70

Tested by

no test coverage detected