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

Function dlg_replicated_update

modules/dialog/dlg_replication.c:437–608  ·  view source on GitHub ↗

* replicates the remote update of an ongoing dialog locally * by reading the relevant information using the Binary Packet Interface */

Source from the content-addressed store, hash-verified

435 * by reading the relevant information using the Binary Packet Interface
436 */
437int dlg_replicated_update(bin_packet_t *packet)
438{
439 struct dlg_cell *dlg = NULL;
440 str call_id, from_tag, to_tag, from_uri, to_uri, vars, profiles;
441 int timeout, h_entry;
442 str st;
443 struct dlg_entry *d_entry;
444 int rcv_flags, save_new_flag, save_sync_flag;
445 unsigned int h_id;
446 unsigned int new_state;
447 short pkg_ver = get_bin_pkg_version(packet);
448 int state;
449
450 bin_pop_str(packet, &call_id);
451 bin_pop_str(packet, &from_tag);
452 bin_pop_str(packet, &to_tag);
453 bin_pop_str(packet, &from_uri);
454 bin_pop_str(packet, &to_uri);
455
456 bin_pop_int(packet, &h_id);
457
458 LM_DBG("replicated update for ['%.*s' '%.*s' '%.*s' '%.*s' '%.*s']\n",
459 call_id.len, call_id.s, from_tag.len, from_tag.s, to_tag.len, to_tag.s,
460 from_uri.len, from_uri.s, to_uri.len, to_uri.s);
461
462 h_entry = dlg_hash(&call_id);
463 d_entry = &d_table->entries[h_entry];
464
465 dlg_lock(d_table, d_entry);
466
467 if (pkg_ver == DLG_BIN_V4)
468 dlg = lookup_dlg_unsafe(h_entry, h_id);
469 else
470 get_dlg_unsafe(d_entry, &call_id, &from_tag, &to_tag, &dlg);
471
472 if (!dlg) {
473 LM_DBG("dialog not found, building new\n");
474
475 dlg = build_new_dlg(&call_id, &from_uri, &to_uri, &from_tag);
476 if (!dlg) {
477 LM_ERR("Failed to create replicated dialog!\n");
478 goto error;
479 }
480
481 return dlg_replicated_create(packet ,dlg, &from_tag, &to_tag, h_id, 1, 0);
482 }
483
484 /* discard an update for a deleted dialog */
485 if (dlg->state == DLG_STATE_DELETED) {
486 dlg_unlock(d_table, d_entry);
487 return 0;
488 }
489
490 bin_skip_int(packet, 1);
491 state = dlg->state;
492 bin_pop_int(packet, &new_state);
493 /* Update stats when the dialog moves between confirmed, early, and other states. */
494 if ((state == DLG_STATE_CONFIRMED_NA || state == DLG_STATE_CONFIRMED) !=

Callers 1

receive_dlg_replFunction · 0.85

Calls 15

get_bin_pkg_versionFunction · 0.85
bin_pop_strFunction · 0.85
bin_pop_intFunction · 0.85
lookup_dlg_unsafeFunction · 0.85
get_dlg_unsafeFunction · 0.85
build_new_dlgFunction · 0.85
dlg_replicated_createFunction · 0.85
bin_skip_intFunction · 0.85
update_dlg_statsFunction · 0.85
bin_skip_strFunction · 0.85
dlg_update_cseqFunction · 0.85
update_dlg_timerFunction · 0.85

Tested by

no test coverage detected