@dst_uri and @next_hop select calls are introduced:
authorMiklos Tirpak <miklos@iptel.org>
Tue, 12 Dec 2006 14:12:14 +0000 (14:12 +0000)
committerMiklos Tirpak <miklos@iptel.org>
Tue, 12 Dec 2006 14:12:14 +0000 (14:12 +0000)
 - @dst_uri returns the destination uri
 - @next_hop returns the dst_uri/new_uri/ruri

select_core.c
select_core.h

index 53144d2..bdada33 100644 (file)
@@ -78,6 +78,29 @@ int select_ruri(str* res, select_t* s, struct sip_msg* msg)
        return -1;
 }
 
+int select_dst_uri(str* res, select_t* s, struct sip_msg* msg)
+{
+       if (msg->first_line.type!=SIP_REQUEST)
+               return -1;
+       RETURN0_res(msg->dst_uri);
+}
+
+int select_next_hop(str* res, select_t* s, struct sip_msg* msg)
+{
+       if (msg->first_line.type==SIP_REQUEST) {
+               if(msg->dst_uri.s) {
+                       RETURN0_res(msg->dst_uri);
+               }
+               else if(msg->new_uri.s) {
+                       RETURN0_res(msg->new_uri);
+               }
+               else {
+                       RETURN0_res(msg->first_line.u.request.uri);
+               }
+       }
+       return -1;
+}
+
 int select_from(str* res, select_t* s, struct sip_msg* msg)
 {
        if (parse_from_header(msg)<0)
index a3e7ea1..6144c41 100644 (file)
@@ -73,6 +73,8 @@ enum {
 
 SELECT_F(select_method)
 SELECT_F(select_ruri)
+SELECT_F(select_dst_uri)
+SELECT_F(select_next_hop)
 SELECT_F(select_from)
 SELECT_F(select_from_uri)
 SELECT_F(select_from_tag)
@@ -142,6 +144,10 @@ static select_row_t select_core[] = {
        { NULL, SEL_PARAM_STR, STR_STATIC_INIT("method"), select_method, 0},
        { NULL, SEL_PARAM_STR, STR_STATIC_INIT("ruri"), select_ruri, 0},
        { select_ruri, SEL_PARAM_STR, STR_NULL, select_any_uri, NESTED},
+       { NULL, SEL_PARAM_STR, STR_STATIC_INIT("dst_uri"), select_dst_uri, 0},
+       { select_dst_uri, SEL_PARAM_STR, STR_NULL, select_any_uri, NESTED},
+       { NULL, SEL_PARAM_STR, STR_STATIC_INIT("next_hop"), select_next_hop, 0},
+       { select_next_hop, SEL_PARAM_STR, STR_NULL, select_any_uri, NESTED},
        { NULL, SEL_PARAM_STR, STR_STATIC_INIT("from"), select_from, 0},
        { NULL, SEL_PARAM_STR, STR_STATIC_INIT("f"), select_from, 0},
        { select_from, SEL_PARAM_STR, STR_STATIC_INIT("uri"), select_from_uri, 0},