| 1214 | |
| 1215 | |
| 1216 | int t_replicate(struct sip_msg *p_msg, str *dst, int flags) |
| 1217 | { |
| 1218 | /* this is a quite horrible hack -- we just take the message |
| 1219 | as is, including Route-s, Record-route-s, and Vias , |
| 1220 | forward it downstream and prevent replies received |
| 1221 | from relaying by setting the replication/local_trans bit; |
| 1222 | |
| 1223 | nevertheless, it should be good enough for the primary |
| 1224 | customer of this function, REGISTER replication |
| 1225 | |
| 1226 | if we want later to make it thoroughly, we need to |
| 1227 | introduce delete lumps for all the header fields above |
| 1228 | */ |
| 1229 | struct cell *t; |
| 1230 | |
| 1231 | if ( set_dst_uri( p_msg, dst)!=0 ) { |
| 1232 | LM_ERR("failed to set dst uri\n"); |
| 1233 | return -1; |
| 1234 | } |
| 1235 | |
| 1236 | if ( msg_branch_uri2dset( GET_RURI(p_msg) )!=0 ) { |
| 1237 | LM_ERR("failed to convert uri to dst\n"); |
| 1238 | return -1; |
| 1239 | } |
| 1240 | |
| 1241 | t=get_t(); |
| 1242 | |
| 1243 | if (!t || t==T_UNDEFINED) { |
| 1244 | /* no transaction yet */ |
| 1245 | if (route_type==FAILURE_ROUTE) { |
| 1246 | LM_CRIT("BUG - undefined transaction in failure route\n"); |
| 1247 | return -1; |
| 1248 | } |
| 1249 | return t_relay_to( p_msg, NULL, flags|TM_T_RELAY_repl_FLAG); |
| 1250 | } else { |
| 1251 | /* transaction already created */ |
| 1252 | if (p_msg->REQ_METHOD==METHOD_ACK) |
| 1253 | /* local ACK */ |
| 1254 | return -1; |
| 1255 | |
| 1256 | t->flags|=T_IS_LOCAL_FLAG; |
| 1257 | |
| 1258 | return t_forward_nonack( t, p_msg, NULL, 1/*reset*/, 0/*unlocked*/); |
| 1259 | } |
| 1260 | } |
| 1261 | |
| 1262 | |
| 1263 | int get_branch_index(void) |
no test coverage detected