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

Function b2bl_api_init

modules/b2b_logic/logic.c:3414–3478  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3412}
3413
3414str* b2bl_api_init(struct sip_msg* msg, str *scen_name,
3415 b2bl_init_params_t *scen_params, b2bl_cback_f cbf, void* cb_param,
3416 unsigned int cb_mask, str* custom_hdrs)
3417{
3418 struct b2b_params init_params;
3419 struct b2bl_new_entity *new_ent;
3420
3421 if (b2bl_key_avp_name >= 0)
3422 destroy_avps( b2bl_key_avp_type, b2bl_key_avp_name, 1);
3423
3424 memset(&init_params, 0, sizeof init_params);
3425 init_params.init_timeout = b2bl_th_init_timeout;
3426
3427 if (scen_name->len == B2B_TOP_HIDING_SCENARY_LEN &&
3428 !memcmp(B2B_TOP_HIDING_SCENARY, scen_name->s, scen_name->len))
3429 init_params.id = B2B_TOP_HIDING_ID_PTR;
3430 else
3431 init_params.id = B2B_INTERNAL_ID_PTR;
3432
3433 if (init_params.id == B2B_TOP_HIDING_ID_PTR ||
3434 scen_params->e1_type == B2B_SERVER || scen_params->e2_type == B2B_SERVER) {
3435 if (!msg) {
3436 LM_ERR("No SIP message for server entity\n");
3437 goto error;
3438 }
3439
3440 if (init_params.id == B2B_INTERNAL_ID_PTR) {
3441 new_ent = pkg_malloc(sizeof(struct b2bl_new_entity));
3442 if (!new_ent) {
3443 LM_ERR("No more pkg memory!\n");
3444 goto error;
3445 }
3446 memset(new_ent, 0, sizeof(struct b2bl_new_entity));
3447
3448 new_ent->type = scen_params->e1_type;
3449 new_ent->dest_uri = scen_params->e1_to;
3450 new_ent->from_dname = scen_params->e1_from_dname;
3451
3452 context_put_ptr(CONTEXT_GLOBAL, current_processing_ctx,
3453 new_ent_1_ctx_idx, new_ent);
3454
3455 new_ent = pkg_malloc(sizeof(struct b2bl_new_entity));
3456 if (!new_ent) {
3457 LM_ERR("No more pkg memory!\n");
3458 goto error;
3459 }
3460 memset(new_ent, 0, sizeof(struct b2bl_new_entity));
3461
3462 new_ent->type = scen_params->e2_type;
3463 new_ent->dest_uri = scen_params->e2_to;
3464 new_ent->from_dname = scen_params->e2_from_dname;
3465
3466 context_put_ptr(CONTEXT_GLOBAL, current_processing_ctx,
3467 new_ent_2_ctx_idx, new_ent);
3468 }
3469
3470 return b2bl_init_request(msg, &init_params, cbf, cb_param, cb_mask, custom_hdrs);
3471 } else {

Callers

nothing calls this directly

Calls 4

destroy_avpsFunction · 0.85
context_put_ptrFunction · 0.85
b2bl_init_requestFunction · 0.85
b2bl_init_externFunction · 0.85

Tested by

no test coverage detected