Browse Source

- Copyright statement added to dlg.c and dlg.h
- Updated to support loose routing (a message
is not necessary forwarded to its R-URI)

Jan Janak 22 years ago
parent
commit
179e36373e
5 changed files with 52 additions and 12 deletions
  1. 23 0
      modules/tm/dlg.c
  2. 22 0
      modules/tm/dlg.h
  3. 2 4
      modules/tm/t_funcs.c
  4. 4 7
      modules/tm/t_fwd.c
  5. 1 1
      modules/tm/t_fwd.h

+ 23 - 0
modules/tm/dlg.c

@@ -1,6 +1,29 @@
 /*
 /*
  * $Id$
  * $Id$
  *
  *
+ * Copyright (C) 2001-2003 Fhg Fokus
+ *
+ * This file is part of ser, a free SIP server.
+ *
+ * ser is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version
+ *
+ * For a license to use the ser software under conditions
+ * other than those described here, or to purchase support for this
+ * software, please contact iptel.org by e-mail at the following addresses:
+ *   [email protected]
+ *
+ * ser is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
  * History:
  * History:
  * -------
  * -------
  * 2003-03-29 Created by janakj
  * 2003-03-29 Created by janakj

+ 22 - 0
modules/tm/dlg.h

@@ -1,5 +1,27 @@
 /*
 /*
  * $Id$
  * $Id$
+ * Copyright (C) 2001-2003 Fhg Fokus
+ *
+ * This file is part of ser, a free SIP server.
+ *
+ * ser is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version
+ *
+ * For a license to use the ser software under conditions
+ * other than those described here, or to purchase support for this
+ * software, please contact iptel.org by e-mail at the following addresses:
+ *   [email protected]
+ *
+ * ser is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  *
  * History:
  * History:
  * -------
  * -------

+ 2 - 4
modules/tm/t_funcs.c

@@ -228,10 +228,8 @@ int t_relay_to( struct sip_msg  *p_msg , struct proxy_l *proxy, int proto,
 	if ( p_msg->REQ_METHOD==METHOD_ACK) {
 	if ( p_msg->REQ_METHOD==METHOD_ACK) {
 		DBG( "SER: forwarding ACK  statelessly \n");
 		DBG( "SER: forwarding ACK  statelessly \n");
 		if (proxy==0) {
 		if (proxy==0) {
-			uri=(p_msg->new_uri.s==0 || p_msg->new_uri.len==0) ?
-				&p_msg->first_line.u.request.uri :
-				&p_msg->new_uri;
-			proxy=uri2proxy( uri, proto );
+			uri = &GET_RURI(p_msg);
+			proxy=uri2proxy(&GET_NEXT_HOP(p_msg), proto);
 			if (proxy==0) {
 			if (proxy==0) {
 					ret=E_BAD_ADDRESS;
 					ret=E_BAD_ADDRESS;
 					goto done;
 					goto done;

+ 4 - 7
modules/tm/t_fwd.c

@@ -160,7 +160,7 @@ int add_blind_uac( /*struct cell *t*/ )
    or error (<0); it doesn't send a message yet -- a reply to it
    or error (<0); it doesn't send a message yet -- a reply to it
    might interfere with the processes of adding multiple branches
    might interfere with the processes of adding multiple branches
 */
 */
-int add_uac( struct cell *t, struct sip_msg *request, str *uri, 
+int add_uac( struct cell *t, struct sip_msg *request, str *uri, str* next_hop,
 	struct proxy_l *proxy, int proto )
 	struct proxy_l *proxy, int proto )
 {
 {
 
 
@@ -188,7 +188,7 @@ int add_uac( struct cell *t, struct sip_msg *request, str *uri,
 
 
 	/* check DNS resolution */
 	/* check DNS resolution */
 	if (proxy) temp_proxy=0; else {
 	if (proxy) temp_proxy=0; else {
-		proxy=uri2proxy( uri, proto );
+		proxy=uri2proxy( next_hop ? next_hop : uri, proto );
 		if (proxy==0)  {
 		if (proxy==0)  {
 			ret=E_BAD_ADDRESS;
 			ret=E_BAD_ADDRESS;
 			goto error;
 			goto error;
@@ -414,10 +414,7 @@ int t_forward_nonack( struct cell *t, struct sip_msg* p_msg ,
 	   is in additional branches (which may be continuously refilled
 	   is in additional branches (which may be continuously refilled
 	*/
 	*/
 	if (first_branch==0) {
 	if (first_branch==0) {
-		branch_ret=add_uac( t, p_msg, 
-			p_msg->new_uri.s ? &p_msg->new_uri :  
-				&p_msg->first_line.u.request.uri,
-				proxy, proto );
+		branch_ret=add_uac( t, p_msg, &GET_RURI(p_msg), &GET_NEXT_HOP(p_msg), proxy, proto );
 		if (branch_ret>=0) 
 		if (branch_ret>=0) 
 			added_branches |= 1<<branch_ret;
 			added_branches |= 1<<branch_ret;
 		else
 		else
@@ -426,7 +423,7 @@ int t_forward_nonack( struct cell *t, struct sip_msg* p_msg ,
 
 
 	init_branch_iterator();
 	init_branch_iterator();
 	while((current_uri.s=next_branch( &current_uri.len))) {
 	while((current_uri.s=next_branch( &current_uri.len))) {
-		branch_ret=add_uac( t, p_msg, &current_uri, proxy, proto);
+		branch_ret=add_uac( t, p_msg, &current_uri, 0, proxy, proto);
 		/* pick some of the errors in case things go wrong;
 		/* pick some of the errors in case things go wrong;
 		   note that picking lowest error is just as good as
 		   note that picking lowest error is just as good as
 		   any other algorithm which picks any other negative
 		   any other algorithm which picks any other negative

+ 1 - 1
modules/tm/t_fwd.h

@@ -47,7 +47,7 @@ char *print_uac_request( struct cell *t, struct sip_msg *i_req,
     int branch, str *uri, unsigned int *len, struct socket_info *send_sock );
     int branch, str *uri, unsigned int *len, struct socket_info *send_sock );
 void e2e_cancel( struct sip_msg *cancel_msg, struct cell *t_cancel, struct cell *t_invite );
 void e2e_cancel( struct sip_msg *cancel_msg, struct cell *t_cancel, struct cell *t_invite );
 int e2e_cancel_branch( struct sip_msg *cancel_msg, struct cell *t_cancel, struct cell *t_invite, int branch );
 int e2e_cancel_branch( struct sip_msg *cancel_msg, struct cell *t_cancel, struct cell *t_invite, int branch );
-int add_uac(	struct cell *t, struct sip_msg *request, str *uri,
+int add_uac(	struct cell *t, struct sip_msg *request, str *uri, str* next_hop,
 				struct proxy_l *proxy, int proto );
 				struct proxy_l *proxy, int proto );
 int add_blind_uac( /* struct cell *t */ );
 int add_blind_uac( /* struct cell *t */ );
 int t_forward_nonack( struct cell *t, struct sip_msg* p_msg,
 int t_forward_nonack( struct cell *t, struct sip_msg* p_msg,