Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

- rolled back at rev 6135 for files from core and changed the impleme…

…ntation for special routes for B2B server-

- now the routes are of type 'route' and have names that have to be given as module parameter; there are different routes for requests and replies.
  • Loading branch information...
commit 132ec979067a2f9f6f8b39049379a4b772bccb83 1 parent c8c11c2
anca_vamanu authored
View
3  cfg.lex
@@ -120,7 +120,6 @@ ROUTE_ERROR error_route
ROUTE_LOCAL local_route
ROUTE_STARTUP startup_route
ROUTE_TIMER timer_route
-ROUTE_B2B b2b_route
FORCE_RPORT "force_rport"|"add_rport"
FORCE_LOCAL_RPORT "force_local_rport"|"add_local_rport"
FORCE_TCP_ALIAS "force_tcp_alias"|"add_tcp_alias"
@@ -393,8 +392,6 @@ WHITESPACE [ \t\r\n]
<INITIAL>{ROUTE_LOCAL} { count(); yylval.strval=yytext; return ROUTE_LOCAL; }
<INITIAL>{ROUTE_STARTUP} { count(); yylval.strval=yytext;
return ROUTE_STARTUP; }
-<INITIAL>{ROUTE_B2B} { count(); yylval.strval=yytext;
- return ROUTE_B2B; }
<INITIAL>{ROUTE_TIMER} { count(); yylval.strval=yytext;
return ROUTE_TIMER; }
<INITIAL>{SET_HOST} { count(); yylval.strval=yytext; return SET_HOST; }
View
13 cfg.y
@@ -209,7 +209,6 @@ extern int line;
%token ROUTE_ERROR
%token ROUTE_LOCAL
%token ROUTE_STARTUP
-%token ROUTE_B2B
%token ROUTE_TIMER
%token SET_HOST
%token SET_HOSTPORT
@@ -454,7 +453,6 @@ statement: assign_stm
| {rt=ERROR_ROUTE;} error_route_stm
| {rt=LOCAL_ROUTE;} local_route_stm
| {rt=STARTUP_ROUTE;} startup_route_stm
- | {rt=B2B_ROUTE;} b2b_route_stm
| {rt=TIMER_ROUTE;} timer_route_stm
| CR /* null statement*/
@@ -1455,17 +1453,6 @@ startup_route_stm: ROUTE_STARTUP LBRACE actions RBRACE {
| ROUTE_STARTUP error { yyerror("invalid startup_route statement"); }
;
-b2b_route_stm: ROUTE_B2B LBRACE actions RBRACE {
- if (b2b_rlist.a!=0) {
- yyerror("re-definition of b2b "
- "route detected");
- YYABORT;
- }
- push($3, &b2b_rlist.a);
- }
- | ROUTE_B2B error { yyerror("invalid b2b_route statement"); }
- ;
-
timer_route_stm: ROUTE_TIMER LBRACK route_name COMMA NUMBER RBRACK LBRACE actions RBRACE {
i_tmp = 0;
while (timer_rlist[i_tmp].a!=0 && i_tmp < TIMER_RT_NO) {
View
28 modules/b2b_entities/README
@@ -29,7 +29,9 @@ Anca-Maria Vamanu
1.3.1. server_address (str)
1.3.2. server_hsize (int)
1.3.3. client_hsize (int)
- 1.3.4. Exported Functions
+ 1.3.4. script_req_route (str)
+ 1.3.5. script_reply_route (str)
+ 1.3.6. Exported Functions
2. Developer Guide
@@ -44,6 +46,8 @@ Anca-Maria Vamanu
1.1. Set server_address parameter
1.2. Set server_hsize parameter
1.3. Set client_hsize parameter
+ 1.4. Set script_req_route parameter
+ 1.5. Set script_repl_route parameter
2.1. b2b_api_t structure
Chapter 1. Admin Guide
@@ -121,7 +125,27 @@ modparam("b2b_entities", "server_hsize", 10)
modparam("b2b_entities", "client_hsize", 10)
...
-1.3.4. Exported Functions
+1.3.4. script_req_route (str)
+
+ The name of the b2b script route that will be called when B2B
+ requests are received.
+
+ Example 1.4. Set script_req_route parameter
+...
+modparam("b2b_entities", "script_req_route", "b2b_request")
+...
+
+1.3.5. script_reply_route (str)
+
+ The name of the b2b script route that will be called when B2B
+ replies are received.
+
+ Example 1.5. Set script_repl_route parameter
+...
+modparam("b2b_entities", "script_reply_route", "b2b_reply")
+...
+
+1.3.6. Exported Functions
The module does not export functions to be used in
configuration script.
View
35 modules/b2b_entities/b2b_entities.c
@@ -54,6 +54,11 @@ int b2b_bind(b2b_api_t* api);
unsigned int server_hsize = 9;
unsigned int client_hsize = 9;
str server_address = {0, 0};
+static char* script_req_route = NULL;
+static char* script_reply_route = NULL;
+int req_routeid = -1;
+int reply_routeid = -1;
+
/* TM bind */
struct tm_binds tmb;
@@ -67,10 +72,12 @@ static cmd_export_t cmds[]=
/** Exported parameters */
static param_export_t params[]={
- { "server_address", STR_PARAM, &server_address.s},
- { "server_hsize", INT_PARAM, &server_hsize },
- { "client_hsize", INT_PARAM, &client_hsize },
- { 0, 0, 0 }
+ { "server_address", STR_PARAM, &server_address.s },
+ { "server_hsize", INT_PARAM, &server_hsize },
+ { "client_hsize", INT_PARAM, &client_hsize },
+ { "script_req_route", STR_PARAM, &script_req_route },
+ { "script_reply_route", STR_PARAM, &script_reply_route },
+ { 0, 0, 0 }
};
/** Module interface */
@@ -134,6 +141,26 @@ static int mod_init(void)
return -1;
}
+ if (script_req_route)
+ {
+ req_routeid = get_script_route_ID_by_name( script_req_route, rlist, RT_NO);
+ if (req_routeid < 1)
+ {
+ LM_ERR("route <%s> does not exist\n",script_req_route);
+ return -1;
+ }
+ }
+
+ if (script_reply_route)
+ {
+ reply_routeid = get_script_route_ID_by_name( script_reply_route, rlist, RT_NO);
+ if (reply_routeid < 1)
+ {
+ LM_ERR("route <%s> does not exist\n",script_reply_route);
+ return -1;
+ }
+ }
+
return 0;
}
View
3  modules/b2b_entities/b2b_entities.h
@@ -53,6 +53,9 @@ extern unsigned int server_hsize;
extern unsigned int client_hsize;
extern str server_address;
extern struct tm_binds tmb;
+extern int req_routeid;
+extern int reply_routeid;
+
int b2b_load_api(b2b_api_t* api);
typedef int(*load_b2b_f) (b2b_api_t* api);
View
6 modules/b2b_entities/dlg.c
@@ -405,7 +405,8 @@ int b2b_prescript_f(struct sip_msg *msg, void *uparam)
b2b_cback(msg, &b2b_key, B2B_REQUEST, param);
- run_top_route(b2b_rlist.a, msg);
+ if(req_routeid > 0)
+ run_top_route(rlist[req_routeid].a, msg);
return 0;
}
@@ -1138,7 +1139,8 @@ void b2b_tm_cback(b2b_table htable, struct tmcb_params *ps)
b2b_cback(msg, b2b_key, B2B_REPLY, param);
/* run the b2b route */
- run_top_route(b2b_rlist.a, msg);
+ if(reply_routeid > 0)
+ run_top_route(rlist[reply_routeid].a, msg);
return;
}
View
33 modules/b2b_entities/doc/b2b_entities_admin.xml
@@ -123,6 +123,39 @@ modparam("b2b_entities", "client_hsize", 10)
</section>
<section>
+ <title><varname>script_req_route</varname> (str)</title>
+ <para>
+ The name of the b2b script route that will be called when
+ B2B requests are received.
+ </para>
+ <example>
+ <title>Set <varname>script_req_route</varname> parameter</title>
+ <programlisting format="linespecific">
+...
+modparam("b2b_entities", "script_req_route", "b2b_request")
+...
+ </programlisting>
+ </example>
+ </section>
+
+ <section>
+ <title><varname>script_reply_route</varname> (str)</title>
+ <para>
+ The name of the b2b script route that will be called when
+ B2B replies are received.
+ </para>
+ <example>
+ <title>Set <varname>script_repl_route</varname> parameter</title>
+ <programlisting format="linespecific">
+...
+modparam("b2b_entities", "script_reply_route", "b2b_reply")
+...
+ </programlisting>
+ </example>
+ </section>
+
+
+ <section>
<title>Exported Functions</title>
<para>The module does not export functions to be used
in configuration script.</para>
View
31 route.c
@@ -92,8 +92,6 @@ struct script_route startup_rlist;
/* startup route */
struct script_timer_route timer_rlist[TIMER_RT_NO];
-struct script_route b2b_rlist;
-
int route_type = REQUEST_ROUTE;
@@ -107,14 +105,13 @@ extern int return_code;
void init_route_lists(void)
{
memset(rlist, 0, sizeof(rlist));
- memset(onreply_rlist, 0, sizeof(onreply_rlist));
- memset(failure_rlist, 0, sizeof(failure_rlist));
- memset(branch_rlist, 0, sizeof(branch_rlist));
- memset(&local_rlist, 0, sizeof(local_rlist));
- memset(&error_rlist, 0, sizeof(error_rlist));
+ memset(onreply_rlist, 0, sizeof(onreply_rlist));
+ memset(failure_rlist, 0, sizeof(failure_rlist));
+ memset(branch_rlist, 0, sizeof(branch_rlist));
+ memset(&local_rlist, 0, sizeof(local_rlist));
+ memset(&error_rlist, 0, sizeof(error_rlist));
memset(&startup_rlist, 0, sizeof(startup_rlist));
- memset(&b2b_rlist, 0, sizeof(b2b_rlist));
- memset(timer_rlist, 0, sizeof(timer_rlist));
+ memset(timer_rlist, 0, sizeof(timer_rlist));
rlist[DEFAULT_RT].name = "0";
onreply_rlist[DEFAULT_RT].name = "0";
}
@@ -1663,12 +1660,6 @@ int fix_rls(void)
}
}
- if(b2b_rlist.a){
- if ((ret=fix_actions(b2b_rlist.a))!=0){
- return ret;
- }
- }
-
return 0;
}
@@ -1808,16 +1799,10 @@ int check_rls(void)
break;
if ((ret=check_actions(timer_rlist[i].a,TIMER_ROUTE))!=0){
- LM_ERR("check failed for timer_route\n");
- return ret;
- }
- }
-
- if(b2b_rlist.a){
- if ((ret=check_actions(b2b_rlist.a, B2B_ROUTE))!=0){
- LM_ERR("check failed for b2b_route\n");
+ LM_ERR("check failed for startup_route\n");
return ret;
}
+
}
return rcheck_status;
View
8 route.h
@@ -59,18 +59,16 @@ extern struct script_route branch_rlist[BRANCH_RT_NO]; /*!< Branch routes table
extern struct script_route local_rlist; /*!< Local route table */
extern struct script_route error_rlist; /*!< Error route table */
extern struct script_route startup_rlist; /*!< Startup route table */
-extern struct script_route b2b_rlist; /*!< B2B route table */
extern struct script_timer_route timer_rlist[TIMER_RT_NO]; /*!< Timer route table */
#define REQUEST_ROUTE 1 /*!< Request route block */
#define FAILURE_ROUTE 2 /*!< Negative-reply route block */
#define ONREPLY_ROUTE 4 /*!< Received-reply route block */
#define BRANCH_ROUTE 8 /*!< Sending-branch route block */
-#define ERROR_ROUTE 16 /*!< Error-handling route block */
-#define LOCAL_ROUTE 32 /*!< Local-requests route block */
+#define ERROR_ROUTE 16 /*!< Error-handling route block */
+#define LOCAL_ROUTE 32 /*!< Local-requests route block */
#define STARTUP_ROUTE 64 /*!< Startup route block */
-#define TIMER_ROUTE 128 /*!< Timer route block */
-#define B2B_ROUTE 256 /*!< Timer route block */
+#define TIMER_ROUTE 128 /*!< Timer route block */
extern int route_type;
Please sign in to comment.
Something went wrong with that request. Please try again.