* replicates a confirmed dialog from another OpenSIPS instance * by reading the relevant information using the Binary Packet Interface */
| 169 | * by reading the relevant information using the Binary Packet Interface |
| 170 | */ |
| 171 | int 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 |
no test coverage detected