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

Function w_t_new_request

modules/tm/tm.c:1543–1659  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1541
1542
1543static int w_t_new_request(struct sip_msg* msg, str *method,
1544 str *ruri, str *from, str *to, str *body, str *p_ctx)
1545{
1546#define CONTENT_TYPE_HDR "Content-Type: "
1547#define CONTENT_TYPE_HDR_LEN (sizeof(CONTENT_TYPE_HDR)-1)
1548 static dlg_t dlg;
1549 struct usr_avp **avp_list;
1550 str headers;
1551 int_str ctx;
1552 char *p;
1553
1554 memset( &dlg, 0, sizeof(dlg_t));
1555
1556 LM_DBG("setting METHOD to <%.*s>\n", method->len, method->s);
1557
1558 /* ruri - next hop is the same as RURI */
1559 dlg.hooks.next_hop = dlg.hooks.request_uri = ruri;
1560 LM_DBG("setting RURI to <%.*s>\n",
1561 dlg.hooks.next_hop->len, dlg.hooks.next_hop->s);
1562
1563 /* FROM URI + display */
1564 if ( (p=q_memrchr(from->s, ' ', from->len))==NULL ) {
1565 /* no display, only FROM URI */
1566 dlg.loc_uri = *from;
1567 dlg.loc_dname.s = NULL;
1568 dlg.loc_dname.len = 0;
1569 } else {
1570 /* display + URI */
1571 dlg.loc_uri.s = p+1;
1572 dlg.loc_uri.len = from->s+from->len - dlg.loc_uri.s;
1573 dlg.loc_dname.s = from->s;
1574 dlg.loc_dname.len = p - from->s;
1575 }
1576 LM_DBG("setting FROM to <%.*s> + <%.*s>\n",
1577 dlg.loc_dname.len, dlg.loc_dname.s,
1578 dlg.loc_uri.len, dlg.loc_uri.s);
1579
1580 /* TO URI + display */
1581 if ( (p=q_memrchr(to->s, ' ', to->len))==NULL ) {
1582 /* no display, only TO URI */
1583 dlg.rem_uri = *to;
1584 dlg.rem_dname.s = NULL;
1585 dlg.rem_dname.len = 0;
1586 } else {
1587 /* display + URI */
1588 dlg.rem_uri.s = p+1;
1589 dlg.rem_uri.len = to->s+to->len - dlg.rem_uri.s;
1590 dlg.rem_dname.s = to->s;
1591 dlg.rem_dname.len = p - to->s;
1592 }
1593 LM_DBG("setting TO to <%.*s> + <%.*s>\n",
1594 dlg.rem_dname.len, dlg.rem_dname.s,
1595 dlg.rem_uri.len, dlg.rem_uri.s);
1596
1597 /* BODY and Content-Type */
1598 if (body!=NULL) {
1599 if ( (p=q_memchr(body->s, ' ', body->len))==NULL ) {
1600 LM_ERR("Content Type not found in the beginning of body <%.*s>\n",

Callers

nothing calls this directly

Calls 8

q_memrchrFunction · 0.85
q_memchrFunction · 0.85
set_avp_listFunction · 0.85
add_avpFunction · 0.85
generate_callidFunction · 0.85
generate_fromtagFunction · 0.85
t_uacFunction · 0.85
destroy_avp_listFunction · 0.85

Tested by

no test coverage detected