... | ... |
@@ -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 | 83 |
char *new_uri, *end, *crt; |
83 | 84 |
int len; |
84 | 85 |
int user; |
85 |
- struct sip_uri uri; |
|
86 |
+ struct sip_uri uri, next_hop; |
|
86 | 87 |
struct sip_uri* u; |
87 | 88 |
unsigned short port; |
88 | 89 |
int proto; |
... | ... |
@@ -112,13 +113,21 @@ int do_action(struct action* a, struct sip_msg* msg) |
112 | 113 |
else proto=msg->rcv.proto; |
113 | 114 |
if (a->p1_type==URIHOST_ST){ |
114 | 115 |
/*parse uri*/ |
115 |
- ret=parse_sip_msg_uri(msg); |
|
116 |
+ |
|
117 |
+ if (msg->dst_uri.len) { |
|
118 |
+ ret = parse_uri(msg->dst_uri.s, msg->dst_uri.len, &next_hop); |
|
119 |
+ u = &next_hop; |
|
120 |
+ } else { |
|
121 |
+ ret = parse_sip_msg_uri(msg); |
|
122 |
+ u = &msg->parsed_uri; |
|
123 |
+ } |
|
124 |
+ |
|
116 | 125 |
if (ret<0) { |
117 | 126 |
LOG(L_ERR, "ERROR: do_action: forward: bad_uri " |
118 | 127 |
" dropping packet\n"); |
119 | 128 |
break; |
120 | 129 |
} |
121 |
- u=&msg->parsed_uri; |
|
130 |
+ |
|
122 | 131 |
switch (a->p2_type){ |
123 | 132 |
case URIPORT_ST: |
124 | 133 |
port=u->port_no; |