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

Function pv_get_tm_reply_code

modules/tm/tm.c:1942–1989  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1940}
1941
1942static int pv_get_tm_reply_code(struct sip_msg *msg, pv_param_t *param,
1943 pv_value_t *res)
1944{
1945 struct cell *t;
1946 int code;
1947 int branch;
1948
1949 if(msg==NULL || res==NULL)
1950 return -1;
1951
1952 /* first get the transaction */
1953 if (!(t = get_t()) || t == T_UNDEFINED) {
1954 /* no T */
1955 code = 0;
1956 } else {
1957 switch (route_type) {
1958 case REQUEST_ROUTE:
1959 /* use the status of the last sent reply */
1960 code = t->uas.status;
1961 break;
1962 case ONREPLY_ROUTE:
1963 /* use the status of the current reply */
1964 code = msg->first_line.u.reply.statuscode;
1965 break;
1966 case FAILURE_ROUTE:
1967 /* use the status of the winning reply */
1968 if ( (branch=t_get_picked_branch())<0 ) {
1969 LM_CRIT("no picked branch (%d) for a final response"
1970 " in MODE_ONFAILURE\n", branch);
1971 code = 0;
1972 } else {
1973 code = TM_BRANCH(t,branch).last_received;
1974 }
1975 break;
1976 default:
1977 LM_ERR("unsupported route_type %d\n", route_type);
1978 code = 0;
1979 }
1980 }
1981
1982 LM_DBG("reply code is <%d>\n",code);
1983
1984 res->rs.s = int2str( code, &res->rs.len);
1985
1986 res->ri = code;
1987 res->flags = PV_VAL_STR|PV_VAL_INT|PV_TYPE_INT;
1988 return 0;
1989}
1990
1991static int pv_get_tm_branch_reply_code(struct sip_msg *msg, pv_param_t *param,
1992 pv_value_t *res)

Callers

nothing calls this directly

Calls 3

get_tFunction · 0.85
t_get_picked_branchFunction · 0.85
int2strFunction · 0.85

Tested by

no test coverage detected