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

Function tr_eval_sdp

transformations.c:1612–1816  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1610static str _tr_sdp_str;
1611
1612int tr_eval_sdp(struct sip_msg *msg, tr_param_t *tp,int subtype,
1613 pv_value_t *val)
1614{
1615 str media;
1616 char *bodylimit;
1617 char *answer;
1618 char *answerEnd;
1619 char searchLine;
1620 int entryNo,i,lenoff;
1621
1622 pv_value_t v;
1623 sdp_info_t sdp;
1624 sdp_session_cell_t *session;
1625 sdp_stream_cell_t *stream;
1626
1627 if (!val)
1628 return -1;
1629
1630 if (val->flags & PV_VAL_NULL)
1631 return 0;
1632
1633 if(!(val->flags&PV_VAL_STR) || val->rs.len<=0)
1634 goto error;
1635
1636 if (!tp)
1637 goto error;
1638
1639 if(_tr_sdp_str.len==0 || _tr_sdp_str.len!=val->rs.len ||
1640 strncmp(_tr_sdp_str.s, val->rs.s, val->rs.len)!=0)
1641 {
1642 if (pkg_str_extend(&_tr_sdp_str, val->rs.len + 3 /* \r\n\0 */) != 0)
1643 {
1644 LM_ERR("no more private memory\n");
1645 goto error;
1646 }
1647
1648 _tr_sdp_str.len = val->rs.len + 2;
1649 _tr_sdp_str.s[0] = '\r';
1650 _tr_sdp_str.s[1] = '\n';
1651 memcpy(_tr_sdp_str.s + 2, val->rs.s, val->rs.len);
1652 _tr_sdp_str.s[_tr_sdp_str.len] = '\0';
1653
1654 }
1655
1656 switch (subtype)
1657 {
1658 case TR_SDP_LINEAT:
1659
1660 /* line index is mandatory */
1661 if (!tp->next)
1662 goto error;
1663 bodylimit = _tr_sdp_str.s + _tr_sdp_str.len;
1664 searchLine = *(tp->v.s.s);
1665 if(tp->next->type==TR_PARAM_NUMBER)
1666 entryNo = tp->next->v.n;
1667 else
1668 {
1669 if(pv_get_spec_value(msg, (pv_spec_p)tp->next->v.data, &v)!=0

Callers

nothing calls this directly

Calls 8

pkg_str_extendFunction · 0.85
pv_get_spec_valueFunction · 0.85
find_sdp_lineFunction · 0.85
pv_get_nullFunction · 0.85
find_next_sdp_lineFunction · 0.85
str2sintFunction · 0.85
parse_sdp_sessionFunction · 0.85
free_sdp_contentFunction · 0.85

Tested by

no test coverage detected