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

Function t_local_replied

modules/tm/tm.c:1186–1237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1184
1185
1186static int t_local_replied(struct sip_msg* msg, void *type)
1187{
1188 struct cell *t;
1189 int branch;
1190 int i;
1191
1192 t = get_t();
1193 if (t==0 || t==T_UNDEFINED) {
1194 LM_ERR("no trasaction created\n");
1195 return -1;
1196 }
1197
1198 switch ( (int)(long)type ) {
1199 /* check all */
1200 case 0:
1201 for( i=t->first_branch ; i<t->nr_of_outgoings ; i++ ) {
1202 if (TM_BRANCH(t,i).flags&T_UAC_HAS_RECV_REPLY)
1203 return -1;
1204 }
1205 return 1;
1206 /* check branch */
1207 case 1:
1208 if (route_type==FAILURE_ROUTE) {
1209 /* use the winning reply */
1210 if ( (branch=t_get_picked_branch())<0 ) {
1211 LM_CRIT("no picked branch (%d) for"
1212 " a final response in MODE_ONFAILURE\n", branch);
1213 return -1;
1214 }
1215 if (TM_BRANCH(t,branch).flags&T_UAC_HAS_RECV_REPLY)
1216 return -1;
1217 return 1;
1218 }
1219 return -1;
1220 /* check last */
1221 case 2:
1222 if (route_type==FAILURE_ROUTE) {
1223 /* use the winning reply */
1224 if ( (branch=t_get_picked_branch())<0 ) {
1225 LM_CRIT("no picked branch (%d) for"
1226 " a final response in MODE_ONFAILURE\n", branch);
1227 return -1;
1228 }
1229 if (TM_BRANCH(t,branch).reply==FAKED_REPLY)
1230 return 1;
1231 return -1;
1232 }
1233 return (t->relaied_reply_branch==-2)?1:-1;
1234 default:
1235 return -1;
1236 }
1237}
1238
1239
1240static int t_was_cancelled(struct sip_msg* msg)

Callers

nothing calls this directly

Calls 2

get_tFunction · 0.85
t_get_picked_branchFunction · 0.85

Tested by

no test coverage detected