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

Function dlg_replicated_create

modules/dialog/dlg_replication.c:171–431  ·  view source on GitHub ↗

* replicates a confirmed dialog from another OpenSIPS instance * by reading the relevant information using the Binary Packet Interface */

Source from the content-addressed store, hash-verified

169 * by reading the relevant information using the Binary Packet Interface
170 */
171int dlg_replicated_create(bin_packet_t *packet, struct dlg_cell *cell,
172 str *ftag, str *ttag, unsigned int hid, int safe, int from_sync)
173{
174 int h_entry, rc;
175 str callid = { NULL, 0 }, from_uri, to_uri, from_tag, to_tag;
176 str cseq1, cseq2, contact1, contact2, adv_ct1, adv_ct2;
177 str rroute1, rroute2, mangled_fu, mangled_tu;
178 str sdp1, sdp2, sdp3, sdp4;
179 str sock, vars, profiles;
180 struct dlg_cell *dlg = NULL;
181 const struct socket_info *caller_sock, *callee_sock;
182 struct dlg_entry *d_entry;
183 int_str tag_name;
184 unsigned int h_id;
185 unsigned int state;
186 unsigned int start_ts;
187 short pkg_ver = get_bin_pkg_version(packet);
188 int dlg_val_type;
189
190 LM_DBG("Received replicated dialog!\n");
191
192 if (!cell) {
193 DLG_BIN_POP(str, packet, callid, malformed);
194 DLG_BIN_POP(str, packet, from_tag, malformed);
195 DLG_BIN_POP(str, packet, to_tag, malformed);
196 DLG_BIN_POP(str, packet, from_uri, malformed);
197 DLG_BIN_POP(str, packet, to_uri, malformed);
198 DLG_BIN_POP(int, packet, h_id, malformed);
199 }
200
201 DLG_BIN_POP(int, packet, start_ts, malformed);
202 DLG_BIN_POP(int, packet, state, malformed);
203
204 if (!cell) {
205 h_entry = dlg_hash(&callid);
206 d_entry = &d_table->entries[h_entry];
207
208 if (!safe)
209 dlg_lock(d_table, d_entry);
210
211 if (pkg_ver == DLG_BIN_V4)
212 dlg = lookup_dlg_unsafe(h_entry, h_id);
213 else
214 get_dlg_unsafe(d_entry, &callid, &from_tag, &to_tag, &dlg);
215
216 if (dlg) {
217 LM_DBG("Dialog with ci '%.*s' is already created\n",
218 callid.len, callid.s);
219 /* unmark dlg as loaded from DB (otherwise it would have been
220 * dropped later when syncing from cluster is done) */
221 dlg->flags &= ~DLG_FLAG_FROM_DB;
222 if (from_sync || *dlg_sync_in_progress)
223 dlg->flags |= DLG_FLAG_SYNCED;
224
225 dlg_unlock(d_table, d_entry);
226 return 0;
227 }
228

Callers 2

dlg_replicated_updateFunction · 0.85
receive_dlg_replFunction · 0.85

Calls 15

get_bin_pkg_versionFunction · 0.85
lookup_dlg_unsafeFunction · 0.85
get_dlg_unsafeFunction · 0.85
build_new_dlgFunction · 0.85
dlg_update_leg_infoFunction · 0.85
insert_dlg_timerFunction · 0.85
read_dialog_varsFunction · 0.85
run_dlg_callbacksFunction · 0.85
fetch_dlg_valueFunction · 0.85
get_shtag_sync_statusFunction · 0.85
insert_ping_timerFunction · 0.85

Tested by

no test coverage detected