| 391 | |
| 392 | |
| 393 | static inline unsigned int count_local_rr(struct sip_msg *req) |
| 394 | { |
| 395 | unsigned int cnt = 0; |
| 396 | struct lump *r; |
| 397 | |
| 398 | /* we look for the RR anchors only |
| 399 | * in the main list (no after or before) */ |
| 400 | for( r=req->add_rm ; r ; r=r->next ) |
| 401 | if ( r->type==HDR_RECORDROUTE_T && r->op==LUMP_NOP && r->after) { |
| 402 | /* only the master RR anchor has "after" */ |
| 403 | if (r->after->op==LUMP_ADD_OPT && |
| 404 | r->after->u.cond==COND_IF_DIFF_REALMS) { |
| 405 | /* conditional second RR hdr (when doing double RR) */ |
| 406 | if (r->after->flags&LUMPFLAG_COND_TRUE) { |
| 407 | cnt++; |
| 408 | } |
| 409 | } else { |
| 410 | /* mandatory first RR hdr */ |
| 411 | cnt++; |
| 412 | } |
| 413 | } |
| 414 | |
| 415 | return cnt; |
| 416 | } |
| 417 | |
| 418 | |
| 419 | /* introduce a new uac to transaction; returns its branch id (>=0) |