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

Function branch_prio

modules/tm/t_reply.c:759–800  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

757
758
759static inline int branch_prio( short ret_code, unsigned int is_cancelled)
760{
761 int first_digit;
762
763 first_digit = ret_code / 100;
764
765 switch(first_digit){
766 case 1: /* 100 - 199 */
767 case 2: /* 200 - 299 */
768 return ret_code;
769 case 6:
770 return ret_code - 300; /* 300 - 399 */
771 case 3:
772 return ret_code + 100; /* 400 - 499 */
773 case 5:
774 if (ret_code==503)
775 return 801; /* 801 */
776 return ret_code + 200; /* 700 - 799 */
777 case 4:
778 switch(ret_code){
779 case 401:
780 return 500; /* 500 - 599 */
781 case 407:
782 return 501;
783 case 415:
784 return 502;
785 case 420:
786 return 503;
787 case 484:
788 return 504;
789 case 408:
790 return 800; /* 800 */
791 case 487:
792 if(is_cancelled)
793 return 0;
794 default: /* the rest of ret codes in the 4xx class */
795 return ret_code + 200; /* 600 - 699 */
796 }
797 default:
798 return ret_code + 200; /* > 900 */
799 }
800}
801
802
803/* select a branch for forwarding; returns:

Callers 1

t_pick_branchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected