Browse code

@dst_uri and @next_hop select calls are introduced: - @dst_uri returns the destination uri - @next_hop returns the dst_uri/new_uri/ruri

Miklos Tirpak authored on 12/12/2006 14:12:14
Showing 2 changed files
... ...
@@ -78,6 +78,29 @@ int select_ruri(str* res, select_t* s, struct sip_msg* msg)
78 78
 	return -1;
79 79
 }
80 80
 
81
+int select_dst_uri(str* res, select_t* s, struct sip_msg* msg)
82
+{
83
+	if (msg->first_line.type!=SIP_REQUEST)
84
+		return -1;
85
+	RETURN0_res(msg->dst_uri);
86
+}
87
+
88
+int select_next_hop(str* res, select_t* s, struct sip_msg* msg)
89
+{
90
+	if (msg->first_line.type==SIP_REQUEST) {
91
+		if(msg->dst_uri.s) {
92
+			RETURN0_res(msg->dst_uri);
93
+		}
94
+		else if(msg->new_uri.s) {
95
+			RETURN0_res(msg->new_uri);
96
+		}
97
+		else {
98
+			RETURN0_res(msg->first_line.u.request.uri);
99
+		}
100
+	}
101
+	return -1;
102
+}
103
+
81 104
 int select_from(str* res, select_t* s, struct sip_msg* msg)
82 105
 {
83 106
 	if (parse_from_header(msg)<0)
... ...
@@ -73,6 +73,8 @@ enum {
73 73
 
74 74
 SELECT_F(select_method)
75 75
 SELECT_F(select_ruri)
76
+SELECT_F(select_dst_uri)
77
+SELECT_F(select_next_hop)
76 78
 SELECT_F(select_from)
77 79
 SELECT_F(select_from_uri)
78 80
 SELECT_F(select_from_tag)
... ...
@@ -142,6 +144,10 @@ static select_row_t select_core[] = {
142 142
 	{ NULL, SEL_PARAM_STR, STR_STATIC_INIT("method"), select_method, 0},
143 143
 	{ NULL, SEL_PARAM_STR, STR_STATIC_INIT("ruri"), select_ruri, 0},
144 144
 	{ select_ruri, SEL_PARAM_STR, STR_NULL, select_any_uri, NESTED},
145
+	{ NULL, SEL_PARAM_STR, STR_STATIC_INIT("dst_uri"), select_dst_uri, 0},
146
+	{ select_dst_uri, SEL_PARAM_STR, STR_NULL, select_any_uri, NESTED},
147
+	{ NULL, SEL_PARAM_STR, STR_STATIC_INIT("next_hop"), select_next_hop, 0},
148
+	{ select_next_hop, SEL_PARAM_STR, STR_NULL, select_any_uri, NESTED},
145 149
 	{ NULL, SEL_PARAM_STR, STR_STATIC_INIT("from"), select_from, 0},
146 150
 	{ NULL, SEL_PARAM_STR, STR_STATIC_INIT("f"), select_from, 0},
147 151
 	{ select_from, SEL_PARAM_STR, STR_STATIC_INIT("uri"), select_from_uri, 0},