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

Function assemble_msg

modules/tm/t_fifo.c:475–707  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

473
474
475static int assemble_msg(struct sip_msg* msg, struct tw_info *twi)
476{
477 static char id_buf[IDBUF_LEN];
478 static char route_buffer[ROUTE_BUFFER_MAX];
479 static char append_buf[APPEND_BUFFER_MAX];
480 static char cmd_buf[CMD_BUFFER_MAX];
481 static str empty_param = {".",1};
482 unsigned int hash_index, label;
483 contact_body_t* cb=0;
484 contact_t* c=0;
485 name_addr_t na;
486 rr_t* record_route;
487 struct hdr_field* p_hdr;
488 param_hooks_t hooks;
489 int l;
490 char* s, fproxy_lr;
491 str route, next_hop, append, tmp_s, body, str_uri;
492
493 if(msg->first_line.type != SIP_REQUEST){
494 LM_ERR("called for something else then a SIP request\n");
495 goto error;
496 }
497
498 /* parse all -- we will need every header field for a UAS */
499 if ( parse_headers(msg, HDR_EOH_F, 0)==-1) {
500 LM_ERR("parse_headers failed\n");
501 goto error;
502 }
503
504 /* find index and hash; (the transaction can be safely used due
505 * to refcounting till script completes) */
506 if( t_get_trans_ident(msg,&hash_index,&label) == -1 ) {
507 LM_ERR("t_get_trans_ident failed\n");
508 goto error;
509 }
510
511 /* parse from header */
512 if (msg->from->parsed==0 && parse_from_header(msg)<0 ) {
513 LM_ERR("failed to parse <From:> header\n");
514 goto error;
515 }
516
517 /* parse the RURI (doesn't make any malloc) */
518 msg->parsed_uri_ok = 0; /* force parsing */
519 if (parse_sip_msg_uri(msg)<0) {
520 LM_ERR("uri has not been parsed\n");
521 goto error;
522 }
523
524 /* parse contact header */
525 str_uri.s = 0;
526 str_uri.len = 0;
527 if(msg->contact) {
528 if (msg->contact->parsed==0 && parse_contact(msg->contact)<0) {
529 LM_ERR("failed to parse <Contact:> header\n");
530 goto error;
531 }
532 cb = (contact_body_t*)msg->contact->parsed;

Callers 2

t_write_reqFunction · 0.85
t_write_unixFunction · 0.85

Calls 13

t_get_trans_identFunction · 0.85
parse_from_headerFunction · 0.85
parse_sip_msg_uriFunction · 0.85
parse_contactFunction · 0.85
find_not_quotedFunction · 0.85
parse_nameaddrFunction · 0.85
parse_rrFunction · 0.85
parse_paramsFunction · 0.85
get_bodyFunction · 0.85
append_strFunction · 0.85
int2reverse_hexFunction · 0.85
append2bufFunction · 0.85

Tested by

no test coverage detected