Browse code

- destination uri inits now the location set for OUTGOING branch - default action for OUTGOING branch implemented

Bogdan-Andrei Iancu authored on 20/10/2003 17:38:50
Showing 2 changed files
... ...
@@ -57,6 +57,7 @@
57 57
 #include "cpl_loader.h"
58 58
 #include "cpl_parser.h"
59 59
 #include "cpl_nonsig.h"
60
+#include "loc_set.h"
60 61
 
61 62
 
62 63
 #define MAX_PROXY_RECURSE  10
... ...
@@ -449,6 +450,7 @@ static int cpl_invoke_script(struct sip_msg* msg, char* str1, char* str2)
449 450
 {
450 451
 	struct cpl_interpreter  *cpl_intr;
451 452
 	str  user;
453
+	str  loc;
452 454
 	str  script;
453 455
 
454 456
 	script.s = 0;
... ...
@@ -481,6 +483,14 @@ static int cpl_invoke_script(struct sip_msg* msg, char* str1, char* str2)
481 483
 	cpl_intr->flags = (unsigned int)str1;
482 484
 	/* attache the user */
483 485
 	cpl_intr->user = user;
486
+	/* for OUTGOING we need also the destination user for init. with him
487
+	 * the location set */
488
+	if ( ((unsigned int)str1)&CPL_RUN_OUTGOING ) {
489
+		if (get_dest_user( msg, &loc)==-1)
490
+			goto error;
491
+		if (add_location( &(cpl_intr->loc_set), &loc,10/*prio*/,1/*dup*/)==-1)
492
+			goto error;
493
+	}
484 494
 
485 495
 	/* since the script interpretation can take some time, it will be better to
486 496
 	 * send a 100 back to prevent the UAC to retransmit */
... ...
@@ -796,10 +796,10 @@ static inline int run_default( struct cpl_interpreter *intr )
796 796
 				/* case 2 : no location modifications or signalling operations
797 797
 				 * performed, location set non-empty: (This can only happen 
798 798
 				 * for outgoing calls.) ->
799
-				 * Proxy the call to the addresses in the location set */
800
-				LOG(L_ERR,"ERROR:cpl_c:run_default: case 2 reached -"
801
-					"unimplemented\n");
802
-				return SCRIPT_RUN_ERROR;
799
+				 * Proxy the call to the address in the location set.
800
+				 * With other words, let ser to continue processing the
801
+				 * request as nothing happened */
802
+				return SCRIPT_END;
803 803
 			}
804 804
 		} else {
805 805
 			/* case 3 : location modifications performed, no signalling