diff --git a/modules/qrouting/doc/qrouting.xml b/modules/qrouting/doc/qrouting.xml new file mode 100644 index 00000000000..362aefb97fa --- /dev/null +++ b/modules/qrouting/doc/qrouting.xml @@ -0,0 +1,27 @@ + + + + + + +%docentities; + +]> + + + + qrouting (Quality-based Routing) Module + + + + &admin; + &contrib; + + &docCopyrights; + ©right; 2020 &osipssol; + + diff --git a/modules/qrouting/doc/qrouting_admin.xml b/modules/qrouting/doc/qrouting_admin.xml new file mode 100644 index 00000000000..fa6237a775b --- /dev/null +++ b/modules/qrouting/doc/qrouting_admin.xml @@ -0,0 +1,220 @@ + + + + +&adminguide; + +
+ Overview + + qrouting is a module which sits on top of + drouting, + dialog and + tm and performs live + tracking of a series of essential gateway signaling quality indicators + (i.e. ASR, CCR, PDD, AST, ACD -- more details below). Thus, qrouting is + able to adjust the prefix routing behavior at runtime, by dynamically + re-ordering the gateways based on how well they perform during live + traffic, such that: + + + well-performing gateways get prioritized for routing + + + gateways which show a degradation in signaling quality are + demoted to the end of the routing list + + + +
+ +
+ Monitored Statistics + + The module keeps track of the following statistics, + for each drouting gateway: + + + ASR (Answer Seizure Ratio) - the percentage of telephone + calls which are answered (200 reply status code). + + + + CCR (Call Completion Ratio) - the percentage of telephone + calls which are answered back by the gateway, excluding + 5xx, 6xx reply codes and internal 408 timeouts. The following + is always true: CCR >= ASR. + + + + PDD (Post Dial Delay) - the duration, in milliseconds, + between the receival of the initial INVITE and the receival + of the first 180/183 provisional reply (the call state + advances to "ringing"). + + + + AST (Average Setup Time) - the duration, in milliseconds, + between the receival of the initial INVITE and the receival + of the first 200 OK reply (the call state advances to + "answered"). The following is always + true: AST >= PDD. + + + + ACD (Average Call Duration) - the duration, in seconds, + between the receival of the initial INVITE and the receival + of the first BYE request from either participant (the call + state advances to "ended"). + + + + +
+ +
+ Dependencies +
+ &osips; Modules + + The following modules must be loaded for this module to work: + + an SQL DB module, offering access to the + "qr_profiles" table + tm + dialog + drouting + + +
+
+ +
+ Exported Parameters + +
+ <varname>db_url</varname> (string) + + An SQL database URL. + + + + Default value is NULL. + + + + Set <varname>db_url</varname> parameter + + +modparam("qrouting", "db_url", "mysql://opensips:opensipsrw@localhost/opensips") + + +
+ +
+ <varname>history_span</varname> (integer) + + The duration (in minutes) that a gateway's statistics for a given call + will be kept for. + + + + Default value is 30 minutes. + + + + Setting the <varname>connection_timeout</varname> parameter + + +modparam("qrouting", "history_span", 15) + + +
+ +
+ <varname>sampling_interval</varname> (integer) + + The duration (in seconds) of the statistics sampling window. Every + seconds, + the accumulated statistics during the most recent sampling windows get + added to each gateway, while the oldest sampled interval statistics are + subtracted (rotated away) from each gateway. + + + A lower value will lead to a closer to realtime adjustment to traffic + changes, but it will also increase CPU usage and internal contention + due to locking. + + + + Default value is 5 seconds. + + + + Setting the <varname>connect_poll_interval</varname> parameter + + +modparam("qrouting", "sampling_interval", 5) + + +
+
+ +
+ Exported MI Functions + +
+ <function moreinfo="none">qr_reload</function> + + + Reload all quality-based routing rules from the SQL database. + + + MI FIFO Command Format: + + + + +opensips-cli -x mi qr_reload + +
+ +
+ <function moreinfo="none">qr_status</function> + + + Inspect the signaling quality statistics of the current + for all drouting gateways in all + partitions, with various levels of filtering. + + Parameters: + + + partition_name (optional) - a specific + drouting partition to list statistics for + + + rule_id (optional) - a specific drouting + rule ID to list statistics for + + + dst_id (optional) - a specific gateway or + carrier ID to list statistics for + + + + MI FIFO Command Format: + + + + +opensips-cli -x mi qr_status +opensips-cli -x mi qr_status pstn +opensips-cli -x mi qr_status pstn MY-GW-3 +opensips-cli -x mi qr_status pstn MY-CARR-7 + +
+ +
+ +
diff --git a/modules/qrouting/qrouting.c b/modules/qrouting/qrouting.c index 11db2a69835..36568b13c31 100644 --- a/modules/qrouting/qrouting.c +++ b/modules/qrouting/qrouting.c @@ -42,7 +42,7 @@ #define QR_TABLE_VER 1 /* modparam */ -static int history = 30; /* the history span in minutes */ +static int history_span = 30; /* the history span in minutes */ static int sampling_interval = 5; /* the sampling interval in seconds */ str db_url; @@ -80,7 +80,7 @@ static cmd_export_t cmds[] = { }; static param_export_t params[] = { - {"history", INT_PARAM, &history}, + {"history_span", INT_PARAM, &history_span}, {"sampling_interval", INT_PARAM, &sampling_interval}, {"db_url", STR_PARAM, &db_url.s}, {0, 0, 0} @@ -141,7 +141,7 @@ struct module_exports exports = { static int qr_init(void) { LM_INFO("qrouting module - initializing\n"); - LM_DBG("history = %d, sampling_interval = %d\n", history, + LM_DBG("history_span = %d, sampling_interval = %d\n", history_span, sampling_interval); if (qr_init_globals() != 0) { @@ -308,8 +308,7 @@ static int qr_init_globals(void) } *qr_main_list = NULL; - /* TODO history in minutes */ - qr_n = (history * 60) / sampling_interval; /* the number of sampling + qr_n = history_span * 60 / sampling_interval; /* the number of sampling intervals in history */ n_sampled = shm_malloc(sizeof *n_sampled);