Explorar el Código

- 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 hace 22 años
padre
commit
179e36373e
Se han modificado 5 ficheros con 52 adiciones y 12 borrados
  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$
  *
+ * 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:
  * -------
  * 2003-03-29 Created by janakj

+ 22 - 0
modules/tm/dlg.h

@@ -1,5 +1,27 @@
 /*
  * $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:
  * -------

+ 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) {
 		DBG( "SER: forwarding ACK  statelessly \n");
 		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) {
 					ret=E_BAD_ADDRESS;
 					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
    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 )
 {
 
@@ -188,7 +188,7 @@ int add_uac( struct cell *t, struct sip_msg *request, str *uri,
 
 	/* check DNS resolution */
 	if (proxy) temp_proxy=0; else {
-		proxy=uri2proxy( uri, proto );
+		proxy=uri2proxy( next_hop ? next_hop : uri, proto );
 		if (proxy==0)  {
 			ret=E_BAD_ADDRESS;
 			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
 	*/
 	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) 
 			added_branches |= 1<<branch_ret;
 		else
@@ -426,7 +423,7 @@ int t_forward_nonack( struct cell *t, struct sip_msg* p_msg ,
 
 	init_branch_iterator();
 	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;
 		   note that picking lowest error is just as good as
 		   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 );
 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 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 );
 int add_blind_uac( /* struct cell *t */ );
 int t_forward_nonack( struct cell *t, struct sip_msg* p_msg,