Browse code

- Added support for loose routing in forward action.

Jan Janak authored on 01/04/2003 11:58:06
Showing 1 changed files
... ...
@@ -31,6 +31,7 @@
31 31
  * 2003-03-19  fixed set* len calculation bug & simplified a little the code
32 32
  *              (should be a little faster now) (andrei)
33 33
  *             replaced all mallocs/frees w/ pkg_malloc/pkg_free (andrei)
34
+ * 2003-04-01  Added support for loose routing in forward (janakj)
34 35
  */
35 36
 
36 37
 
... ...
@@ -82,7 +83,7 @@ int do_action(struct action* a, struct sip_msg* msg)
82 82
 	char *new_uri, *end, *crt;
83 83
 	int len;
84 84
 	int user;
85
-	struct sip_uri uri;
85
+	struct sip_uri uri, next_hop;
86 86
 	struct sip_uri* u;
87 87
 	unsigned short port;
88 88
 	int proto;
... ...
@@ -112,13 +113,21 @@ int do_action(struct action* a, struct sip_msg* msg)
112 112
 			else proto=msg->rcv.proto;
113 113
 			if (a->p1_type==URIHOST_ST){
114 114
 				/*parse uri*/
115
-				ret=parse_sip_msg_uri(msg);
115
+
116
+				if (msg->dst_uri.len) {
117
+					ret = parse_uri(msg->dst_uri.s, msg->dst_uri.len, &next_hop);
118
+					u = &next_hop;
119
+				} else {
120
+					ret = parse_sip_msg_uri(msg);
121
+					u = &msg->parsed_uri;
122
+				}
123
+
116 124
 				if (ret<0) {
117 125
 					LOG(L_ERR, "ERROR: do_action: forward: bad_uri "
118 126
 								" dropping packet\n");
119 127
 					break;
120 128
 				}
121
-				u=&msg->parsed_uri;
129
+				
122 130
 				switch (a->p2_type){
123 131
 					case URIPORT_ST:
124 132
 									port=u->port_no;