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

Function b2b_process_scenario_init

modules/b2b_logic/logic.c:3131–3375  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3129}
3130
3131str* b2b_process_scenario_init(struct sip_msg* msg, b2bl_cback_f cbf,
3132 void* cb_param, unsigned int cb_mask, str* custom_hdrs,
3133 struct b2b_params *init_params)
3134{
3135 str* server_id= NULL, *client_id= NULL;
3136 str body= {NULL, 0};
3137 str method = {INVITE, INVITE_LEN};
3138 str* b2bl_key = NULL;
3139 b2bl_tuple_t* tuple= NULL;
3140 struct b2b_context *ctx;
3141 b2bl_entity_id_t* client_entity = NULL;
3142 client_info_t ci;
3143 unsigned int hash_index;
3144 str to_uri={NULL, 0}, from_uri, from_dname;
3145 int eno = 0;
3146 str *hdrs, *ct_hdrs;
3147 struct b2bl_new_entity *new_entity;
3148 struct b2bl_new_entity *e1, *e2;
3149 int maxfwd;
3150
3151 if(msg == NULL)
3152 {
3153 LM_ERR("NO SIP message\n");
3154 goto error;
3155 }
3156
3157 if (!str_match(&method, &msg->first_line.u.request.method)) {
3158 LM_ERR("Scenario must be initialized on INVITE but got method: %.*s\n",
3159 msg->first_line.u.request.method.len,
3160 msg->first_line.u.request.method.s);
3161 goto error;
3162 }
3163
3164 if(b2b_msg_get_from(msg, &from_uri, &from_dname)< 0 ||
3165 b2b_msg_get_to(msg, &to_uri, init_params->flags)< 0)
3166 {
3167 LM_ERR("Failed to get to or from from the message\n");
3168 goto error;
3169 }
3170 hash_index = core_hash(&to_uri, &from_uri, b2bl_hsize);
3171
3172 method = msg->first_line.u.request.method;
3173
3174 if(msg->content_length)
3175 {
3176 if ( get_body(msg, &body)!=0 )
3177 {
3178 LM_ERR("cannot extract body\n");
3179 goto error;
3180 }
3181 }
3182
3183 /* create new scenario instance record */
3184 tuple = b2bl_insert_new(msg, hash_index, init_params,
3185 custom_hdrs, -1, &b2bl_key, INSERTDB_FLAG, TUPLE_NO_REPL);
3186 if(tuple== NULL)
3187 {
3188 LM_ERR("Failed to insert new scenario instance record\n");

Callers 1

b2bl_init_requestFunction · 0.85

Calls 15

str_matchFunction · 0.85
b2b_msg_get_fromFunction · 0.85
b2b_msg_get_toFunction · 0.85
core_hashFunction · 0.85
get_bodyFunction · 0.85
b2bl_insert_newFunction · 0.85
get_ticksFunction · 0.85
get_new_entitiesFunction · 0.85
b2b_scenario_hdrsFunction · 0.85
b2bl_create_new_entityFunction · 0.85
b2b_msg_get_maxfwdFunction · 0.85
b2b_get_local_contactFunction · 0.85

Tested by

no test coverage detected