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

Function t_lookup_request

modules/tm/t_lookup.c:391–559  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

389 */
390
391int t_lookup_request( struct sip_msg* p_msg , int leave_new_locked )
392{
393 struct cell *p_cell;
394 unsigned int isACK;
395 struct sip_msg *t_msg;
396 struct via_param *branch;
397 int match_status;
398
399 isACK = p_msg->REQ_METHOD==METHOD_ACK;
400
401 if (isACK) {
402 if (e2eack_T==NULL)
403 return -1;
404 if (e2eack_T!=T_UNDEFINED)
405 return -2;
406 }
407
408 /* parse all*/
409 if (check_transaction_quadruple(p_msg)==0) {
410 LM_ERR("too few headers\n");
411 set_t(0);
412 /* stop processing */
413 return 0;
414 }
415
416 /* start searching into the table */
417 if (!p_msg->hash_index)
418 p_msg->hash_index=tm_hash( p_msg->callid->body ,
419 get_cseq(p_msg)->number ) ;
420 LM_DBG("start searching: hash=%d, isACK=%d\n",
421 p_msg->hash_index,isACK);
422
423
424 /* first of all, look if there is RFC3261 magic cookie in branch; if
425 * so, we can do very quick matching and skip the old-RFC bizzar
426 * comparison of many header fields
427 */
428 if (!p_msg->via1) {
429 LM_ERR("no via\n");
430 set_t(0);
431 return 0;
432 }
433 branch=p_msg->via1->branch;
434 if (branch && branch->value.s && branch->value.len>MCOOKIE_LEN
435 && memcmp(branch->value.s,MCOOKIE,MCOOKIE_LEN)==0) {
436 /* huhuhu! the cookie is there -- let's proceed fast */
437 LOCK_HASH(p_msg->hash_index);
438 match_status=matching_3261(p_msg,&p_cell,
439 /* skip transactions with different method; otherwise CANCEL
440 * would match the previous INVITE trans. */
441 isACK ? ~METHOD_INVITE: ~p_msg->REQ_METHOD);
442 switch(match_status) {
443 case 0: goto notfound; /* no match */
444 case 1: goto found; /* match */
445 case 2: goto e2e_ack; /* e2e proxy ACK */
446 }
447 }
448

Callers 4

t_check_transFunction · 0.85
tm_existing_ack_transFunction · 0.85
t_checkFunction · 0.85
t_newtranFunction · 0.85

Calls 7

set_tFunction · 0.85
matching_3261Function · 0.85
get_tm_tableFunction · 0.85
dlg_matchingFunction · 0.85
set_krFunction · 0.85
run_trans_callbacksFunction · 0.85

Tested by

no test coverage detected