Browse code

modules: readme files regenerated - kazoo ... [skip ci]

Kamailio Dev authored on 19/11/2021 11:46:21
Showing 1 changed files
... ...
@@ -67,10 +67,10 @@ Luis Azedo
67 67
               5.1. amqp related
68 68
 
69 69
                     5.1.1. kazoo_publish(exchange, routing_key,
70
-                            json_payload)
70
+                            json_payload [, amqp_headers])
71 71
 
72 72
                     5.1.2. kazoo_query(exchange, routing_key, json_payload
73
-                            [, target_var])
73
+                            [, target_var] [, amqp_headers])
74 74
 
75 75
                     5.1.3. kazoo_subscribe(exchange, exchange_type, queue,
76 76
                             routing_key)
... ...
@@ -175,9 +175,11 @@ Chapter 1. Admin Guide
175 175
 
176 176
         5.1. amqp related
177 177
 
178
-              5.1.1. kazoo_publish(exchange, routing_key, json_payload)
178
+              5.1.1. kazoo_publish(exchange, routing_key, json_payload [,
179
+                      amqp_headers])
180
+
179 181
               5.1.2. kazoo_query(exchange, routing_key, json_payload [,
180
-                      target_var])
182
+                      target_var] [, amqp_headers])
181 183
 
182 184
               5.1.3. kazoo_subscribe(exchange, exchange_type, queue,
183 185
                       routing_key)
... ...
@@ -623,9 +625,11 @@ modparam("kazoo", "pua_mode", 0)
623 625
 
624 626
    5.1. amqp related
625 627
 
626
-        5.1.1. kazoo_publish(exchange, routing_key, json_payload)
628
+        5.1.1. kazoo_publish(exchange, routing_key, json_payload [,
629
+                amqp_headers])
630
+
627 631
         5.1.2. kazoo_query(exchange, routing_key, json_payload [,
628
-                target_var])
632
+                target_var] [, amqp_headers])
629 633
 
630 634
         5.1.3. kazoo_subscribe(exchange, exchange_type, queue,
631 635
                 routing_key)
... ...
@@ -643,10 +647,11 @@ modparam("kazoo", "pua_mode", 0)
643 647
 
644 648
 5.1. amqp related
645 649
 
646
-5.1.1.  kazoo_publish(exchange, routing_key, json_payload)
650
+5.1.1.  kazoo_publish(exchange, routing_key, json_payload [, amqp_headers])
647 651
 
648 652
    The function publishes a json payload to rabbitmq. The routing_key
649
-   parameter should be encoded.
653
+   parameter should be encoded. Optional AMQP-Headers are specified in the
654
+   format key1=value1;key2=value2
650 655
 
651 656
    This function can be used from ANY ROUTE.
652 657
 
... ...
@@ -661,12 +666,14 @@ $var(amqp_routing_key) = "registration.success." + $(fd{kz.encode}) + "." + $fU;
661 666
 kazoo_publish("callmgr", $var(amqp_routing_key), $var(amqp_payload_request));
662 667
 ...
663 668
 
664
-5.1.2.  kazoo_query(exchange, routing_key, json_payload [, target_var])
669
+5.1.2.  kazoo_query(exchange, routing_key, json_payload [, target_var] [,
670
+amqp_headers])
665 671
 
666 672
    The function publishes a json payload to rabbitmq, waits for a
667 673
    correlated messageand puts the result in target_var. The routing_key
668 674
    parameter should be encoded. target_var is optional as the function
669
-   also puts the result in pseudo-variable $kzR.
675
+   also puts the result in pseudo-variable $kzR. Optional AMQP-Headers are
676
+   specified in the format key1=value1;key2=value2
670 677
 
671 678
    This function can be used from ANY ROUTE.
672 679
 
Browse code

modules: readme files regenerated - kazoo ... [skip ci]

Kamailio Dev authored on 21/09/2021 19:01:12
Showing 1 changed files
... ...
@@ -443,9 +443,9 @@ modparam("kazoo", "amqp_connection", "kazoo://guest:guest@otherhost:5672")
443 443
    handles control to the next sub-loop.
444 444
 ...
445 445
 while(true) // main  loop
446
- while(ACK or timeout)  // acknowledge from worker process
447
- while(SEND or timeout) // anything to send ?
448
- while(CONSUME or timeout) // any data on consumed exchanges ?
446
+while(ACK or timeout)  // acknowledge from worker process
447
+while(SEND or timeout) // anything to send ?
448
+while(CONSUME or timeout) // any data on consumed exchanges ?
449 449
 ...
450 450
 
451 451
 4.2.1. amqp_consumer_loop_count(int)
... ...
@@ -652,11 +652,11 @@ modparam("kazoo", "pua_mode", 0)
652 652
 
653 653
    Example 1.22. kazoo_publish usage
654 654
 ...
655
-$var(amqp_payload_request) = "{'Event-Category' : 'directory', 'Event-Name' : 'r
656
-eg_success', 'Contact' : '" + $var(fs_contact) + "', 'Call-ID' : '" + $ci + "',
657
-'Realm' : '" + $fd +"', 'Username' : '" + $fU + "', 'From-User' : '" + $fU + "',
658
- 'From-Host' : '" + $fd + "', 'To-User' : '" + $tU +"', 'To-Host' : '" + $td + "
659
-', 'User-Agent' : '" + $ua +"' ," + $var(register_contants)+ " }";
655
+$var(amqp_payload_request) = $_s({"Event-Category" : "directory", "Event-Name" :
656
+ "reg_success", "Contact" : "$(ct{s.escape.common}{s.replace,\','}{s.replace,$$,
657
+})", "Call-ID" : "$ci", "Realm" : "$fd", "Username" : "$fU", "From-User" : "$fU"
658
+, "From-Host" : "$fd", "To-User" : "$tU", "To-Host" : "$td", "User-Agent" : "$(u
659
+a{s.escape.common}{s.replace,\','}{s.replace,$$,})" });
660 660
 $var(amqp_routing_key) = "registration.success." + $(fd{kz.encode}) + "." + $fU;
661 661
 kazoo_publish("callmgr", $var(amqp_routing_key), $var(amqp_payload_request));
662 662
 ...
Browse code

modules: readme files regenerated - kazoo ... [skip ci]

Kamailio Dev authored on 21/05/2020 14:31:17
Showing 1 changed files
... ...
@@ -38,6 +38,7 @@ Luis Azedo
38 38
                     4.1.4. amqp_consumer_event_subkey(str)
39 39
                     4.1.5. amqp_max_channels(str)
40 40
                     4.1.6. amqp_connection(str)
41
+                    4.1.7. event_callback(str)
41 42
 
42 43
               4.2. execution control
43 44
 
... ...
@@ -97,28 +98,29 @@ Luis Azedo
97 98
    1.5. Set amqp_consumer_event_subkey parameter
98 99
    1.6. Set amqp_max_channels parameter
99 100
    1.7. Set amqp_connection parameter
100
-   1.8. Set amqp_consumer_loop_count parameter
101
-   1.9. Set amqp_internal_loop_count parameter
102
-   1.10. Set amqp_consumer_ack_loop_count parameter
103
-   1.11. Set consume_messages_on_reconnect parameter
104
-   1.12. Set single_consumer_on_reconnect parameter
105
-   1.13. Set amqp_consumer_ack_timeout parameter
106
-   1.14. Set amqp_interprocess_timeout parameter
107
-   1.15. Set amqp_waitframe_timeout parameter
108
-   1.16. Set amqp_query_timeout parameter
109
-   1.17. >Set amqp_query_timeout_avp parameter
110
-   1.18. Set db_url parameter
111
-   1.19. Set presentity_table parameter
112
-   1.20. Set pua_mode parameter
113
-   1.21. kazoo_publish usage
114
-   1.22. kazoo_query usage
115
-   1.23. kazoo_subscribe usage
101
+   1.8. Set event_callback parameter
102
+   1.9. Set amqp_consumer_loop_count parameter
103
+   1.10. Set amqp_internal_loop_count parameter
104
+   1.11. Set amqp_consumer_ack_loop_count parameter
105
+   1.12. Set consume_messages_on_reconnect parameter
106
+   1.13. Set single_consumer_on_reconnect parameter
107
+   1.14. Set amqp_consumer_ack_timeout parameter
108
+   1.15. Set amqp_interprocess_timeout parameter
109
+   1.16. Set amqp_waitframe_timeout parameter
110
+   1.17. Set amqp_query_timeout parameter
111
+   1.18. >Set amqp_query_timeout_avp parameter
112
+   1.19. Set db_url parameter
113
+   1.20. Set presentity_table parameter
114
+   1.21. Set pua_mode parameter
115
+   1.22. kazoo_publish usage
116
+   1.23. kazoo_query usage
116 117
    1.24. kazoo_subscribe usage
117
-   1.25. kazoo_pua_publish usage
118
-   1.26. kazoo_encode usage
119
-   1.27. kazoo_json usage
120
-   1.28. kz.json usage
121
-   1.29. kz.encode usage
118
+   1.25. kazoo_subscribe usage
119
+   1.26. kazoo_pua_publish usage
120
+   1.27. kazoo_encode usage
121
+   1.28. kazoo_json usage
122
+   1.29. kz.json usage
123
+   1.30. kz.encode usage
122 124
 
123 125
 Chapter 1. Admin Guide
124 126
 
... ...
@@ -145,6 +147,7 @@ Chapter 1. Admin Guide
145 147
               4.1.4. amqp_consumer_event_subkey(str)
146 148
               4.1.5. amqp_max_channels(str)
147 149
               4.1.6. amqp_connection(str)
150
+              4.1.7. event_callback(str)
148 151
 
149 152
         4.2. execution control
150 153
 
... ...
@@ -317,6 +320,7 @@ event_route[kazoo:consumer-event]
317 320
         4.1.4. amqp_consumer_event_subkey(str)
318 321
         4.1.5. amqp_max_channels(str)
319 322
         4.1.6. amqp_connection(str)
323
+        4.1.7. event_callback(str)
320 324
 
321 325
    4.2. execution control
322 326
 
... ...
@@ -410,6 +414,20 @@ modparam("kazoo", "amqp_connection", "amqp://guest:guest@localhost:5672")
410 414
 modparam("kazoo", "amqp_connection", "kazoo://guest:guest@otherhost:5672")
411 415
 ...
412 416
 
417
+4.1.7. event_callback(str)
418
+
419
+   The name of the function in the kemi configuration file (embedded
420
+   scripting language such as Lua, Python, ...) to be executed instead of
421
+   event_route[...] blocks.
422
+
423
+   The function receives a string parameter with the name of the event,
424
+   the values can be: 'kazoo:mod-init', 'kazoo:consumer-event'.
425
+
426
+   Example 1.8. Set event_callback parameter
427
+    ...
428
+    modparam("kazoo", "event_callback", "ksr_kazoo_event")
429
+    ...
430
+
413 431
 4.2. execution control
414 432
 
415 433
    execution control of main loop can be controlled by changing the
... ...
@@ -436,7 +454,7 @@ while(true) // main  loop
436 454
 
437 455
    Default value is 10.
438 456
 
439
-   Example 1.8. Set amqp_consumer_loop_count parameter
457
+   Example 1.9. Set amqp_consumer_loop_count parameter
440 458
 ...
441 459
 modparam("kazoo", "amqp_consumer_loop_count", 3)
442 460
 ...
... ...
@@ -447,7 +465,7 @@ modparam("kazoo", "amqp_consumer_loop_count", 3)
447 465
 
448 466
    Default value is 5.
449 467
 
450
-   Example 1.9. Set amqp_internal_loop_count parameter
468
+   Example 1.10. Set amqp_internal_loop_count parameter
451 469
 ...
452 470
 modparam("kazoo", "amqp_internal_loop_count", 1)
453 471
 ...
... ...
@@ -458,7 +476,7 @@ modparam("kazoo", "amqp_internal_loop_count", 1)
458 476
 
459 477
    Default value is 20.
460 478
 
461
-   Example 1.10. Set amqp_consumer_ack_loop_count parameter
479
+   Example 1.11. Set amqp_consumer_ack_loop_count parameter
462 480
 ...
463 481
 modparam("kazoo", "amqp_consumer_ack_loop_count", 5)
464 482
 ...
... ...
@@ -470,7 +488,7 @@ modparam("kazoo", "amqp_consumer_ack_loop_count", 5)
470 488
 
471 489
    Default value is 1.
472 490
 
473
-   Example 1.11. Set consume_messages_on_reconnect parameter
491
+   Example 1.12. Set consume_messages_on_reconnect parameter
474 492
 ...
475 493
 modparam("kazoo", "consume_messages_on_reconnect", 0)
476 494
 ...
... ...
@@ -483,7 +501,7 @@ modparam("kazoo", "consume_messages_on_reconnect", 0)
483 501
 
484 502
    Default value is 1.
485 503
 
486
-   Example 1.12. Set single_consumer_on_reconnect parameter
504
+   Example 1.13. Set single_consumer_on_reconnect parameter
487 505
 ...
488 506
 modparam("kazoo", "single_consumer_on_reconnect", 0)
489 507
 ...
... ...
@@ -499,7 +517,7 @@ modparam("kazoo", "single_consumer_on_reconnect", 0)
499 517
 
500 518
    Default value is 100000 micro.
501 519
 
502
-   Example 1.13. Set amqp_consumer_ack_timeout parameter
520
+   Example 1.14. Set amqp_consumer_ack_timeout parameter
503 521
 ...
504 522
 modparam("kazoo", "amqp_consumer_ack_timeout_sec", 1)
505 523
 modparam("kazoo", "amqp_consumer_ack_timeout_micro", 200000)
... ...
@@ -512,7 +530,7 @@ modparam("kazoo", "amqp_consumer_ack_timeout_micro", 200000)
512 530
 
513 531
    Default value is 100000 micro.
514 532
 
515
-   Example 1.14. Set amqp_interprocess_timeout parameter
533
+   Example 1.15. Set amqp_interprocess_timeout parameter
516 534
 ...
517 535
 modparam("kazoo", "amqp_interprocess_timeout_sec", 1)
518 536
 modparam("kazoo", "amqp_interprocess_timeout_micro", 200000)
... ...
@@ -524,7 +542,7 @@ modparam("kazoo", "amqp_interprocess_timeout_micro", 200000)
524 542
 
525 543
    Default value is 100000 micro.
526 544
 
527
-   Example 1.15. Set amqp_waitframe_timeout parameter
545
+   Example 1.16. Set amqp_waitframe_timeout parameter
528 546
 ...
529 547
 modparam("kazoo", "amqp_waitframe_timeout_sec", 1)
530 548
 modparam("kazoo", "amqp_waitframe_timeout_micro", 200000)
... ...
@@ -537,7 +555,7 @@ modparam("kazoo", "amqp_waitframe_timeout_micro", 200000)
537 555
 
538 556
    Default value is 2 sec.
539 557
 
540
-   Example 1.16. Set amqp_query_timeout parameter
558
+   Example 1.17. Set amqp_query_timeout parameter
541 559
 ...
542 560
 modparam("kazoo", "amqp_query_timeout_sec", 1)
543 561
 modparam("kazoo", "amqp_query_timeout_micro", 200000)
... ...
@@ -550,7 +568,7 @@ modparam("kazoo", "amqp_query_timeout_micro", 200000)
550 568
 
551 569
    Default value is NULL (no value).
552 570
 
553
-   Example 1.17. >Set amqp_query_timeout_avp parameter
571
+   Example 1.18. >Set amqp_query_timeout_avp parameter
554 572
 ...
555 573
 modparam("kazoo", "amqp_query_timeout_avp", "$var(kz_timeout)")
556 574
 
... ...
@@ -573,7 +591,7 @@ route[SOME_ROUTE]
573 591
 
574 592
    Default value is “NULL”.
575 593
 
576
-   Example 1.18. Set db_url parameter
594
+   Example 1.19. Set db_url parameter
577 595
 ...
578 596
 modparam("kazoo", "db_url", "mysql://kamailio:kamailiorw@localhost/kamailio")
579 597
 ...
... ...
@@ -584,7 +602,7 @@ modparam("kazoo", "db_url", "mysql://kamailio:kamailiorw@localhost/kamailio")
584 602
 
585 603
    Default value is “presentity”.
586 604
 
587
-   Example 1.19. Set presentity_table parameter
605
+   Example 1.20. Set presentity_table parameter
588 606
 ...
589 607
 modparam("kazoo", "presentity_table", "my_presentity_table")
590 608
 ...
... ...
@@ -596,7 +614,7 @@ modparam("kazoo", "presentity_table", "my_presentity_table")
596 614
 
597 615
    Default value is “1”.
598 616
 
599
-   Example 1.20. Set pua_mode parameter
617
+   Example 1.21. Set pua_mode parameter
600 618
 ...
601 619
 modparam("kazoo", "pua_mode", 0)
602 620
 ...
... ...
@@ -632,7 +650,7 @@ modparam("kazoo", "pua_mode", 0)
632 650
 
633 651
    This function can be used from ANY ROUTE.
634 652
 
635
-   Example 1.21. kazoo_publish usage
653
+   Example 1.22. kazoo_publish usage
636 654
 ...
637 655
 $var(amqp_payload_request) = "{'Event-Category' : 'directory', 'Event-Name' : 'r
638 656
 eg_success', 'Contact' : '" + $var(fs_contact) + "', 'Call-ID' : '" + $ci + "',
... ...
@@ -652,7 +670,7 @@ kazoo_publish("callmgr", $var(amqp_routing_key), $var(amqp_payload_request));
652 670
 
653 671
    This function can be used from ANY ROUTE.
654 672
 
655
-   Example 1.22. kazoo_query usage
673
+   Example 1.23. kazoo_query usage
656 674
 ...
657 675
 $var(amqp_payload_request) = "{'Event-Category' : 'call_event' , 'Event-Name' :
658 676
 'query_user_channels_req', 'Realm' : '" + $fd + "', 'Username' : '" + $fU + "',
... ...
@@ -676,7 +694,7 @@ var(amqp_result)")) {
676 694
 
677 695
    This function must be called from event_route[kazoo:mod-init].
678 696
 
679
-   Example 1.23. kazoo_subscribe usage
697
+   Example 1.24. kazoo_subscribe usage
680 698
 ...
681 699
 event_route[kazoo:mod-init]
682 700
 {
... ...
@@ -708,7 +726,7 @@ event_route[kazoo:consumer-event]
708 726
 
709 727
    This function must be called from event_route[kazoo:mod-init].
710 728
 
711
-   Example 1.24. kazoo_subscribe usage
729
+   Example 1.25. kazoo_subscribe usage
712 730
 ...
713 731
 event_route[kazoo:mod-init]
714 732
 {
... ...
@@ -733,7 +751,7 @@ event_route[kazoo:consumer-event]
733 751
 
734 752
    This function can be used from ANY ROUTE.
735 753
 
736
-   Example 1.25. kazoo_pua_publish usage
754
+   Example 1.26. kazoo_pua_publish usage
737 755
 ...
738 756
 event_route[kazoo:consumer-event-presence-update]
739 757
 {
... ...
@@ -754,7 +772,7 @@ son,From})");
754 772
 
755 773
    This function can be used from ANY ROUTE.
756 774
 
757
-   Example 1.26. kazoo_encode usage
775
+   Example 1.27. kazoo_encode usage
758 776
 ...
759 777
 kazoo_encode("$ci", "$var(callid_encoded)");
760 778
 $var(amqp_routing_key) = "call.status_req.$var(callid_encoded)";
... ...
@@ -767,7 +785,7 @@ $var(amqp_routing_key) = "call.status_req.$var(callid_encoded)";
767 785
 
768 786
    This function can be used from ANY ROUTE.
769 787
 
770
-   Example 1.27. kazoo_json usage
788
+   Example 1.28. kazoo_json usage
771 789
 ...
772 790
 kazoo_json("$var(amqp_result)", "Channels[0].switch_url", "$du");
773 791
 if($du != $null) {
... ...
@@ -785,7 +803,7 @@ if($du != $null) {
785 803
 
786 804
    The prefix for kazoo transformations is kz.
787 805
      * json
788
-       Example 1.28. kz.json usage
806
+       Example 1.29. kz.json usage
789 807
 ...
790 808
 #kazoo_json("$var(amqp_result)", "Channels[0].switch_url", "$du");
791 809
 $du = $kzR{kz.json,Channels[0].switch_url};
... ...
@@ -795,7 +813,7 @@ if($du != $null) {
795 813
 }
796 814
 ...
797 815
      * encode
798
-       Example 1.29. kz.encode usage
816
+       Example 1.30. kz.encode usage
799 817
 ...
800 818
 #kazoo_encode("$ci", "$var(callid_encoded)");
801 819
 #$var(amqp_routing_key) = "call.status_req.$var(callid_encoded)";
Browse code

modules: readme files regenerated - acc ... [skip ci]

Kamailio Dev authored on 28/02/2018 17:03:37 • The Root committed on 28/02/2018 19:11:36
Showing 1 changed files
... ...
@@ -21,7 +21,7 @@ Luis Azedo
21 21
         2. How it works
22 22
 
23 23
               2.1. event routes
24
-              2.2. aknowledge messages
24
+              2.2. acknowledge messages
25 25
 
26 26
         3. Dependencies
27 27
 
... ...
@@ -51,7 +51,7 @@ Luis Azedo
51 51
 
52 52
                     4.3.1. amqp_consumer_ack_timeout(str)
53 53
                     4.3.2. amqp_interprocess_timeout(str)
54
-                    4.3.3. amqp_waitframe_tiemout(str)
54
+                    4.3.3. amqp_waitframe_timeout(str)
55 55
                     4.3.4. amqp_query_timeout(str)
56 56
                     4.3.5. amqp_query_timeout_avp(str)
57 57
 
... ...
@@ -128,7 +128,7 @@ Chapter 1. Admin Guide
128 128
    2. How it works
129 129
 
130 130
         2.1. event routes
131
-        2.2. aknowledge messages
131
+        2.2. acknowledge messages
132 132
 
133 133
    3. Dependencies
134 134
 
... ...
@@ -158,7 +158,7 @@ Chapter 1. Admin Guide
158 158
 
159 159
               4.3.1. amqp_consumer_ack_timeout(str)
160 160
               4.3.2. amqp_interprocess_timeout(str)
161
-              4.3.3. amqp_waitframe_tiemout(str)
161
+              4.3.3. amqp_waitframe_timeout(str)
162 162
               4.3.4. amqp_query_timeout(str)
163 163
               4.3.5. amqp_query_timeout_avp(str)
164 164
 
... ...
@@ -221,7 +221,7 @@ Chapter 1. Admin Guide
221 221
 2. How it works
222 222
 
223 223
    2.1. event routes
224
-   2.2. aknowledge messages
224
+   2.2. acknowledge messages
225 225
 
226 226
    The module works with a main forked process that does the communication
227 227
    with rabbitmq for issuing publishes, waiting for replies and consuming
... ...
@@ -285,7 +285,7 @@ event_route[kazoo:consumer-event]
285 285
 # this event route is executed if we can't find the previous
286 286
 }
287 287
 
288
-2.2. aknowledge messages
288
+2.2. acknowledge messages
289 289
 
290 290
    Consumed messages have the option of being acknowledge in two ways:
291 291
      * immediately when received
... ...
@@ -330,7 +330,7 @@ event_route[kazoo:consumer-event]
330 330
 
331 331
         4.3.1. amqp_consumer_ack_timeout(str)
332 332
         4.3.2. amqp_interprocess_timeout(str)
333
-        4.3.3. amqp_waitframe_tiemout(str)
333
+        4.3.3. amqp_waitframe_timeout(str)
334 334
         4.3.4. amqp_query_timeout(str)
335 335
         4.3.5. amqp_query_timeout_avp(str)
336 336
 
... ...
@@ -495,7 +495,7 @@ modparam("kazoo", "single_consumer_on_reconnect", 0)
495 495
 
496 496
 4.3.1. amqp_consumer_ack_timeout(str)
497 497
 
498
-   Timeout when checking for aknowledge from workers.
498
+   Timeout when checking for acknowledge from workers.
499 499
 
500 500
    Default value is 100000 micro.
501 501
 
... ...
@@ -518,7 +518,7 @@ modparam("kazoo", "amqp_interprocess_timeout_sec", 1)
518 518
 modparam("kazoo", "amqp_interprocess_timeout_micro", 200000)
519 519
 ...
520 520
 
521
-4.3.3. amqp_waitframe_tiemout(str)
521
+4.3.3. amqp_waitframe_timeout(str)
522 522
 
523 523
    Timeout when checking for messages from rabbitmq.
524 524
 
Browse code

core, lib, modules: restructured source code tree

- new folder src/ to hold the source code for main project applications
- main.c is in src/
- all core files are subfolder are in src/core/
- modules are in src/modules/
- libs are in src/lib/
- application Makefiles are in src/
- application binary is built in src/ (src/kamailio)

Daniel-Constantin Mierla authored on 07/12/2016 11:03:51
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,803 @@
1
+KAZOO Module
2
+
3
+2600hz Inc.
4
+
5
+   <engineering@2600hz.com>
6
+
7
+Edited by
8
+
9
+Luis Azedo
10
+
11
+   <luis@2600hz.com>
12
+
13
+   Copyright © 2010, 2014 2600hz
14
+     __________________________________________________________________
15
+
16
+   Table of Contents
17
+
18
+   1. Admin Guide
19
+
20
+        1. Overview
21
+        2. How it works
22
+
23
+              2.1. event routes
24
+              2.2. aknowledge messages
25
+
26
+        3. Dependencies
27
+
28
+              3.1. Kamailio Modules
29
+              3.2. External Libraries or Applications
30
+
31
+        4. Parameters
32
+
33
+              4.1. amqp related
34
+
35
+                    4.1.1. node_hostname(str)
36
+                    4.1.2. amqp_consumer_processes(int)
37
+                    4.1.3. amqp_consumer_event_key(str)
38
+                    4.1.4. amqp_consumer_event_subkey(str)
39
+                    4.1.5. amqp_max_channels(str)
40
+                    4.1.6. amqp_connection(str)
41
+
42
+              4.2. execution control
43
+
44
+                    4.2.1. amqp_consumer_loop_count(int)
45
+                    4.2.2. amqp_internal_loop_count(int)
46
+                    4.2.3. amqp_consumer_ack_loop_count(int)
47
+                    4.2.4. consume_messages_on_reconnect(int)
48
+                    4.2.5. single_consumer_on_reconnect(int)
49
+
50
+              4.3. timers
51
+
52
+                    4.3.1. amqp_consumer_ack_timeout(str)
53
+                    4.3.2. amqp_interprocess_timeout(str)
54
+                    4.3.3. amqp_waitframe_tiemout(str)
55
+                    4.3.4. amqp_query_timeout(str)
56
+                    4.3.5. amqp_query_timeout_avp(str)
57
+
58
+              4.4. presence related
59
+
60
+                    4.4.1. db_url(str)
61
+                    4.4.2. presentity_table(str)
62
+                    4.4.3. pua_mode(int)
63
+
64
+        5. Functions
65
+
66
+              5.1. amqp related
67
+
68
+                    5.1.1. kazoo_publish(exchange, routing_key,
69
+                            json_payload)
70
+
71
+                    5.1.2. kazoo_query(exchange, routing_key, json_payload
72
+                            [, target_var])
73
+
74
+                    5.1.3. kazoo_subscribe(exchange, exchange_type, queue,
75
+                            routing_key)
76
+
77
+                    5.1.4. kazoo_subscribe(json_description)
78
+
79
+              5.2. presence related
80
+
81
+                    5.2.1. kazoo_pua_publish(json_payload)
82
+
83
+              5.3. other
84
+
85
+                    5.3.1. kazoo_encode(to_encode, target_var)
86
+                    5.3.2. kazoo_json(json_payload, field, target_var)
87
+
88
+        6. Exported pseudo-variables
89
+        7. Transformations
90
+
91
+   List of Examples
92
+
93
+   1.1. define the event route
94
+   1.2. Set node_hostname parameter
95
+   1.3. Set amqp_consumer_processes parameter
96
+   1.4. Set amqp_consumer_event_key parameter
97
+   1.5. Set amqp_consumer_event_subkey parameter
98
+   1.6. Set amqp_max_channels parameter
99
+   1.7. Set amqp_connection parameter
100
+   1.8. Set amqp_consumer_loop_count parameter
101
+   1.9. Set amqp_internal_loop_count parameter
102
+   1.10. Set amqp_consumer_ack_loop_count parameter
103
+   1.11. Set consume_messages_on_reconnect parameter
104
+   1.12. Set single_consumer_on_reconnect parameter
105
+   1.13. Set amqp_consumer_ack_timeout parameter
106
+   1.14. Set amqp_interprocess_timeout parameter
107
+   1.15. Set amqp_waitframe_timeout parameter
108
+   1.16. Set amqp_query_timeout parameter
109
+   1.17. >Set amqp_query_timeout_avp parameter
110
+   1.18. Set db_url parameter
111
+   1.19. Set presentity_table parameter
112
+   1.20. Set pua_mode parameter
113
+   1.21. kazoo_publish usage
114
+   1.22. kazoo_query usage
115
+   1.23. kazoo_subscribe usage
116
+   1.24. kazoo_subscribe usage
117
+   1.25. kazoo_pua_publish usage
118
+   1.26. kazoo_encode usage
119
+   1.27. kazoo_json usage
120
+   1.28. kz.json usage
121
+   1.29. kz.encode usage
122
+
123
+Chapter 1. Admin Guide
124
+
125
+   Table of Contents
126
+
127
+   1. Overview
128
+   2. How it works
129
+
130
+        2.1. event routes
131
+        2.2. aknowledge messages
132
+
133
+   3. Dependencies
134
+
135
+        3.1. Kamailio Modules
136
+        3.2. External Libraries or Applications
137
+
138
+   4. Parameters
139
+
140
+        4.1. amqp related
141
+
142
+              4.1.1. node_hostname(str)
143
+              4.1.2. amqp_consumer_processes(int)
144
+              4.1.3. amqp_consumer_event_key(str)
145
+              4.1.4. amqp_consumer_event_subkey(str)
146
+              4.1.5. amqp_max_channels(str)
147
+              4.1.6. amqp_connection(str)
148
+
149
+        4.2. execution control
150
+
151
+              4.2.1. amqp_consumer_loop_count(int)
152
+              4.2.2. amqp_internal_loop_count(int)
153
+              4.2.3. amqp_consumer_ack_loop_count(int)
154
+              4.2.4. consume_messages_on_reconnect(int)
155
+              4.2.5. single_consumer_on_reconnect(int)
156
+
157
+        4.3. timers
158
+
159
+              4.3.1. amqp_consumer_ack_timeout(str)
160
+              4.3.2. amqp_interprocess_timeout(str)
161
+              4.3.3. amqp_waitframe_tiemout(str)
162
+              4.3.4. amqp_query_timeout(str)
163
+              4.3.5. amqp_query_timeout_avp(str)
164
+
165
+        4.4. presence related
166
+
167
+              4.4.1. db_url(str)
168
+              4.4.2. presentity_table(str)
169
+              4.4.3. pua_mode(int)
170
+
171
+   5. Functions
172
+
173
+        5.1. amqp related
174
+
175
+              5.1.1. kazoo_publish(exchange, routing_key, json_payload)
176
+              5.1.2. kazoo_query(exchange, routing_key, json_payload [,
177
+                      target_var])
178
+
179
+              5.1.3. kazoo_subscribe(exchange, exchange_type, queue,
180
+                      routing_key)
181
+
182
+              5.1.4. kazoo_subscribe(json_description)
183
+
184
+        5.2. presence related
185
+
186
+              5.2.1. kazoo_pua_publish(json_payload)
187
+
188
+        5.3. other
189
+
190
+              5.3.1. kazoo_encode(to_encode, target_var)
191
+              5.3.2. kazoo_json(json_payload, field, target_var)
192
+
193
+   6. Exported pseudo-variables
194
+   7. Transformations
195
+
196
+1. Overview
197
+
198
+   The Kazoo is a general purpose AMQP connector (tested with
199
+   rabbitmq-server). It exposes publish/consume capabilities into
200
+   Kamailio.
201
+
202
+   From a high-level, the purpose of the module might be for things like:
203
+     * Integrate to an AMQP application to make real-time routing
204
+       decisions (instead of using, say, a SQL database)
205
+     * Provide a real-time integration into your program, instead of your
206
+       database, so you can overlay additional logic in your preferred
207
+       language while also utilizing a message bus
208
+     * Utilize messaging to have a distributed messaging layer, such that
209
+       machines processing requests/responses/events can go up/down or
210
+       share the workload and your Kamailio node will still be happy
211
+
212
+   supported operations are:
213
+     * publish json payloads to rabbitmq
214
+     * publish json payloads to rabbitmq and wait for correlated response
215
+       message
216
+     * subscribe to an exchange with a routing key
217
+
218
+   The Kazoo module also has support to publish updates to presence module
219
+   thru the kazoo_pua_publish function
220
+
221
+2. How it works
222
+
223
+   2.1. event routes
224
+   2.2. aknowledge messages
225
+
226
+   The module works with a main forked process that does the communication
227
+   with rabbitmq for issuing publishes, waiting for replies and consuming
228
+   messages. When it consumes a message it defers the process to a worker
229
+   process so that it doesn't block this main process.
230
+
231
+2.1. event routes
232
+
233
+   The worker process issues an event-route where we can act on the
234
+   received payload. The name of the event-route is composed by values
235
+   extracted from the payload.
236
+
237
+   Kazoo module will try to execute the event route from most significant
238
+   to less significant. define the event route like
239
+   event_route[kazoo:consumer-event[-payload_key_value[-payload_subkey_val
240
+   ue]]]
241
+
242
+   we can set the key/subkey pair on a subscription base. check the
243
+   payload on subscribe.
244
+
245
+   Example 1.1. define the event route
246
+...
247
+modparam("kazoo", "amqp_consumer_event_key", "Event-Category")
248
+modparam("kazoo", "amqp_consumer_event_subkey", "Event-Name")
249
+...
250
+
251
+event_route[kazoo:consumer-event-presence-update]
252
+{
253
+# presence is the value extracted from Event-Category field in json payload
254
+# update is the value extracted from Event-Name field in json payload
255
+xlog("L_INFO", "received $(kzE{kz.json,Event-Package}) update for $(kzE{kz.json,
256
+From})");
257
+...
258
+}
259
+
260
+event_route[kazoo:consumer-event-presence]
261
+{
262
+# presence is the value extracted from Event-Category field in json payload
263
+xlog("L_INFO", "received $(kzE{kz.json,Event-Package}) update for $(kzE{kz.json,
264
+From})");
265
+...
266
+}
267
+
268
+event_route[kazoo:consumer-event-event-category-event-name]
269
+{
270
+# event-category is the name of the amqp_consumer_event_key parameter
271
+# event-name is the name of the amqp_consumer_event_subkey parameter
272
+# this event route is executed if we can't find the previous
273
+...
274
+}
275
+
276
+event_route[kazoo:consumer-event-event-category]
277
+{
278
+# event-category is the name of the amqp_consumer_event_key parameter
279
+# this event route is executed if we can't find the previous
280
+...
281
+}
282
+
283
+event_route[kazoo:consumer-event]
284
+{
285
+# this event route is executed if we can't find the previous
286
+}
287
+
288
+2.2. aknowledge messages
289
+
290
+   Consumed messages have the option of being acknowledge in two ways:
291
+     * immediately when received
292
+     * after processing by the worker
293
+
294
+3. Dependencies
295
+
296
+   3.1. Kamailio Modules
297
+   3.2. External Libraries or Applications
298
+
299
+3.1. Kamailio Modules
300
+
301
+   The following modules must be loaded before this module:
302
+     * none.
303
+
304
+3.2. External Libraries or Applications
305
+
306
+     * librabbitmq.
307
+     * libjson.
308
+     * libuuid.
309
+
310
+4. Parameters
311
+
312
+   4.1. amqp related
313
+
314
+        4.1.1. node_hostname(str)
315
+        4.1.2. amqp_consumer_processes(int)
316
+        4.1.3. amqp_consumer_event_key(str)
317
+        4.1.4. amqp_consumer_event_subkey(str)
318
+        4.1.5. amqp_max_channels(str)
319
+        4.1.6. amqp_connection(str)
320
+
321
+   4.2. execution control
322
+
323
+        4.2.1. amqp_consumer_loop_count(int)
324
+        4.2.2. amqp_internal_loop_count(int)
325
+        4.2.3. amqp_consumer_ack_loop_count(int)
326
+        4.2.4. consume_messages_on_reconnect(int)
327
+        4.2.5. single_consumer_on_reconnect(int)
328
+
329
+   4.3. timers
330
+
331
+        4.3.1. amqp_consumer_ack_timeout(str)
332
+        4.3.2. amqp_interprocess_timeout(str)
333
+        4.3.3. amqp_waitframe_tiemout(str)
334
+        4.3.4. amqp_query_timeout(str)
335
+        4.3.5. amqp_query_timeout_avp(str)
336
+
337
+   4.4. presence related
338
+
339
+        4.4.1. db_url(str)
340
+        4.4.2. presentity_table(str)
341
+        4.4.3. pua_mode(int)
342
+
343
+4.1. amqp related
344
+
345
+4.1.1. node_hostname(str)
346
+
347
+   The name of this host to register in rabbitmq.
348
+
349
+   Default value is NULL. you must set this parameter value for the module
350
+   to work
351
+
352
+   Example 1.2. Set node_hostname parameter
353
+...
354
+modparam("kazoo", "node_hostname", "sipproxy.mydomain.com")
355
+...
356
+
357
+4.1.2. amqp_consumer_processes(int)
358
+
359
+   The number of worker processes to handle messages consumption.
360
+
361
+   Default value is 4.
362
+
363
+   Example 1.3. Set amqp_consumer_processes parameter
364
+...
365
+modparam("kazoo", "amqp_consumer_processes", 10)
366
+...
367
+
368
+4.1.3. amqp_consumer_event_key(str)
369
+
370
+   The default name of the field in json payload to compose the event name
371
+   1st part
372
+
373
+   Default value is “Event-Category”.
374
+
375
+   Example 1.4. Set amqp_consumer_event_key parameter
376
+...
377
+modparam("kazoo", "amqp_consumer_event_key", "My-JSON-Field-Name")
378
+...
379
+
380
+4.1.4. amqp_consumer_event_subkey(str)
381
+
382
+   The default name of the field in json payload to compose the event name
383
+   2nd part
384
+
385
+   Default value is “Event-Name”.
386
+
387
+   Example 1.5. Set amqp_consumer_event_subkey parameter
388
+...
389
+modparam("kazoo", "amqp_consumer_event_subkey", "My-JSON-SubField-Name")
390
+...
391
+
392
+4.1.5. amqp_max_channels(str)
393
+
394
+   The number of pre allocated channels for the connection.
395
+
396
+   Default value is 50.
397
+
398
+   Example 1.6. Set amqp_max_channels parameter
399
+...
400
+modparam("kazoo", "amqp_max_channels", 100)
401
+...
402
+
403
+4.1.6. amqp_connection(str)
404
+
405
+   The connection url to rabbitmq. can be set multiple times for failover.
406
+
407
+   Example 1.7. Set amqp_connection parameter
408
+...
409
+modparam("kazoo", "amqp_connection", "amqp://guest:guest@localhost:5672")
410
+modparam("kazoo", "amqp_connection", "kazoo://guest:guest@otherhost:5672")
411
+...
412
+
413
+4.2. execution control
414
+
415
+   execution control of main loop can be controlled by changing the
416
+   parameter values in this section.
417
+
418
+   The main loop has 3 sub-loops were it listen for actions to execute
419
+   with a timeout. These group of parameters allow to set the maximum
420
+   number of times the sub-loop is executed if it doesn't timeout.
421
+
422
+   On busy systems, we may have a condition where a sub-loop never times
423
+   out because it always has data to process. The purpose of these
424
+   parameters is to set a maximum number of times it executes before it
425
+   handles control to the next sub-loop.
426
+...
427
+while(true) // main  loop
428
+ while(ACK or timeout)  // acknowledge from worker process
429
+ while(SEND or timeout) // anything to send ?
430
+ while(CONSUME or timeout) // any data on consumed exchanges ?
431
+...
432
+
433
+4.2.1. amqp_consumer_loop_count(int)
434
+
435