Browse code

modules: readme files regenerated - dispatcher ...

Kamailio Dev authored on 11/11/2016 11:31:18
Showing 1 changed files
... ...
@@ -1299,7 +1299,7 @@ r,opt)
1299 1299
 
1300 1300
 7.2. Kamailio config file
1301 1301
 
1302
-   Next picture shows a sample usage of the dispatcher module.
1302
+   Next listing shows a sample config for using the dispatcher module.
1303 1303
 
1304 1304
    Example 1.41. Kamailio config script - sample dispatcher usage
1305 1305
 ...
... ...
@@ -1310,9 +1310,9 @@ r,opt)
1310 1310
 # - no TPC listening
1311 1311
 # - don't dispatch REGISTER and presence requests
1312 1312
 #
1313
-# Kamailio (OpenSER) SIP Server v3.2
1313
+# Kamailio SIP Server
1314 1314
 #     - web: http://www.kamailio.org
1315
-#     - git: http://sip-router.org
1315
+#     - git: http://github.com/kamailio/
1316 1316
 #
1317 1317
 # Direct your questions about this file to: sr-users@lists.sip-router.org
1318 1318
 #
... ...
@@ -1329,6 +1329,13 @@ r,opt)
1329 1329
 #!define DBURL "mysql://kamailio:kamailiorw@localhost/kamailio"
1330 1330
 #!endif
1331 1331
 
1332
+# - flags
1333
+#   FLT_ - per transaction (message) flags
1334
+#       FLB_ - per branch flags
1335
+#!define FLT_ACC 1
1336
+#!define FLT_ACCMISSED 2
1337
+#!define FLT_ACCFAILED 3
1338
+
1332 1339
 ####### Global Parameters #########
1333 1340
 
1334 1341
 #!ifdef WITH_DEBUG
... ...
@@ -1367,8 +1374,8 @@ sip_warning=no
1367 1367
 
1368 1368
 ####### Modules Section ########
1369 1369
 
1370
-#set module path
1371
-mpath="/usr/local/lib/kamailio/modules_k/:/usr/local/lib/kamailio/modules/"
1370
+# set module path
1371
+mpath="/usr/local/lib/kamailio/modules/"
1372 1372
 
1373 1373
 loadmodule "db_mysql.so"
1374 1374
 loadmodule "mi_fifo.so"
... ...
@@ -1392,10 +1399,6 @@ loadmodule "dispatcher.so"
1392 1392
 # ----------------- setting module-specific parameters ---------------
1393 1393
 
1394 1394
 
1395
-# ----- mi_fifo params -----
1396
-modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")
1397
-
1398
-
1399 1395
 # ----- rr params -----
1400 1396
 # add value to ;lr param to cope with most of the UAs
1401 1397
 modparam("rr", "enable_full_lr", 1)
... ...
@@ -1404,8 +1407,8 @@ modparam("rr", "append_fromtag", 0)
1404 1404
 
1405 1405
 
1406 1406
 # ----- acc params -----
1407
-modparam("acc", "log_flag", 1)
1408
-modparam("acc", "failed_transaction_flag", 3)
1407
+modparam("acc", "log_flag", FLT_ACC)
1408
+modparam("acc", "failed_transaction_flag", FLT_ACCFAILED)
1409 1409
 modparam("acc", "log_extra",
1410 1410
         "src_user=$fU;src_domain=$fd;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd;s
1411 1411
 rc_ip=$si")
... ...
@@ -1428,7 +1431,7 @@ modparam("dispatcher", "sock_avp", "$avp(AVP_SOCK)")
1428 1428
 
1429 1429
 # main request routing logic
1430 1430
 
1431
-route {
1431
+request_route {
1432 1432
 
1433 1433
         # per request initial checks
1434 1434
         route(REQINIT);
... ...
@@ -1446,6 +1449,11 @@ route {
1446 1446
                 exit;
1447 1447
         }
1448 1448
 
1449
+        # handle retransmissions
1450
+        if(t_precheck_trans()) {
1451
+                t_check_trans();
1452
+                exit;
1453
+        }
1449 1454
         t_check_trans();
1450 1455
 
1451 1456
         # record routing for dialog forming requests (in case they are routed)
... ...
@@ -1455,9 +1463,8 @@ route {
1455 1455
                 record_route();
1456 1456
 
1457 1457
         # account only INVITEs
1458
-        if (is_method("INVITE"))
1459
-        {
1460
-                setflag(1); # do accounting
1458
+        if (is_method("INVITE")) {
1459
+                setflag(FLT_ACC); # do accounting
1461 1460
         }
1462 1461
 
1463 1462
         # handle presence related requests
... ...
@@ -1466,8 +1473,7 @@ route {
1466 1466
         # handle registrations
1467 1467
         route(REGISTRAR);
1468 1468
 
1469
-        if ($rU==$null)
1470
-        {
1469
+        if ($rU==$null) {
1471 1470
                 # request with no Username in RURI
1472 1471
                 sl_send_reply("484","Address Incomplete");
1473 1472
                 exit;
... ...
@@ -1492,8 +1498,7 @@ route[REQINIT] {
1492 1492
                 exit;
1493 1493
         }
1494 1494
 
1495
-        if(!sanity_check("1511", "7"))
1496
-        {
1495
+        if(!sanity_check("1511", "7")) {
1497 1496
                 xlog("Malformed SIP message from $si:$sp\n");
1498 1497
                 exit;
1499 1498
         }
... ...
@@ -1506,8 +1511,9 @@ route[WITHINDLG] {
1506 1506
                 # take the path determined by record-routing
1507 1507
                 if (loose_route()) {
1508 1508
                         if (is_method("BYE")) {
1509
-                                setflag(1); # do accounting ...
1510
-                                setflag(3); # ... even if the transaction fails
1509
+                                setflag(FLT_ACC); # do accounting ...
1510
+                                setflag(FLT_ACCFAILED); # ... even if the transa
1511
+ction fails
1511 1512
                         }
1512 1513
                         route(RELAY);
1513 1514
                 } else {
... ...
@@ -1555,8 +1561,7 @@ route[PRESENCE] {
1555 1555
 # Dispatch requests
1556 1556
 route[DISPATCH] {
1557 1557
         # round robin dispatching on gateways group '1'
1558
-        if(!ds_select_dst("1", "4"))
1559
-        {
1558
+        if(!ds_select_dst("1", "4")) {
1560 1559
                 send_reply("404", "No destination");
1561 1560
                 exit;
1562 1561
         }
... ...
@@ -1566,17 +1571,15 @@ route[DISPATCH] {
1566 1566
         exit;
1567 1567
 }
1568 1568
 
1569
-# Sample failure route
1569
+# Try next destionations in failure route
1570 1570
 failure_route[RTF_DISPATCH] {
1571 1571
         if (t_is_canceled()) {
1572 1572
                 exit;
1573 1573
         }
1574 1574
         # next DST - only for 500 or local timeout
1575 1575
         if (t_check_status("500")
1576
-                        or (t_branch_timeout() and !t_branch_replied()))
1577
-        {
1578
-                if(ds_next_dst())
1579
-                {
1576
+                        or (t_branch_timeout() and !t_branch_replied())) {
1577
+                if(ds_next_dst()) {
1580 1578
                         t_on_failure("RTF_DISPATCH");
1581 1579
                         route(RELAY);
1582 1580
                         exit;
... ...
@@ -1584,8 +1587,6 @@ failure_route[RTF_DISPATCH] {
1584 1584
         }
1585 1585
 }
1586 1586
 
1587
-
1588
-
1589 1587
 ...
1590 1588
 
1591 1589
 8. Event routes