Browse code

textopsx: docs - fixed title for sections

Daniel-Constantin Mierla authored on 25/10/2021 17:23:08
Showing 1 changed files
... ...
@@ -559,11 +559,11 @@ hf_iterator_end("i1");
559 559
 	</section>
560 560
 	<section id="textopsx.f.hf_iterator_next">
561 561
 		<title>
562
-		<function moreinfo="none">textopsx.f.hf_iterator_next(iname)</function>
562
+		<function moreinfo="none">hf_iterator_next(iname)</function>
563 563
 		</title>
564 564
 		<para>
565 565
 			Move the iterator to the next header. It must
566
-			be called also after bl_iterator_start() to get the first
566
+			be called also after hf_iterator_start() to get the first
567 567
 			header.
568 568
 		</para>
569 569
 		<para>
... ...
@@ -594,7 +594,7 @@ hf_iterator_end("i1");
594 594
 	</section>
595 595
 	<section id="textopsx.f.hf_iterator_prev">
596 596
 		<title>
597
-		<function moreinfo="none">textopsx.f.hf_iterator_prev(iname)</function>
597
+		<function moreinfo="none">hf_iterator_prev(iname)</function>
598 598
 		</title>
599 599
 		<para>
600 600
 			Move the iterator to the previous header. It must
... ...
@@ -757,7 +757,7 @@ bl_iterator_end("b1");
757 757
 	</section>
758 758
 	<section id="textopsx.f.bl_iterator_next">
759 759
 		<title>
760
-		<function moreinfo="none">textopsx.f.bl_iterator_next(iname)</function>
760
+		<function moreinfo="none">bl_iterator_next(iname)</function>
761 761
 		</title>
762 762
 		<para>
763 763
 			Move the iterator to the next line in the body. It must
Browse code

textopsx: exported msg_set_buffer(data) function

- it was available to KEMI

Daniel-Constantin Mierla authored on 24/09/2021 10:16:37
Showing 1 changed files
... ...
@@ -46,6 +46,34 @@ if(msg_apply_changes())
46 46
     }
47 47
 }
48 48
 ...
49
+</programlisting>
50
+		</example>
51
+	</section>
52
+
53
+	<section id="textopsx.f.msg_set_buffer">
54
+		<title>
55
+			<function moreinfo="none">msg_set_buffer(data)</function>
56
+		</title>
57
+		<para>
58
+		Set the content of the SIP message buffer, replacing the exiting data.
59
+		The parameter can contain variables, its value must be a valid SIP
60
+		request or reply, a matter of what the old message is.
61
+		</para>
62
+		<para>
63
+		This function can be used from REQUEST_ROUTE or core REPLY_ROUTE.
64
+		</para>
65
+		<para>
66
+		Note: It must be used before the transaction is created in
67
+		request_route and not inside the onreply_route[name] executed by tm
68
+		module. Also, do not use after resuming a suspended request or reply,
69
+		at that moment the transaction is already created.
70
+		</para>
71
+		<example>
72
+		<title><function>msg_set_buffer()</function> usage</title>
73
+		<programlisting format="linespecific">
74
+...
75
+msg_set_buffer("INVITE sip:...");
76
+...
49 77
 </programlisting>
50 78
 		</example>
51 79
 	</section>
Browse code

textopsx: bl iterator functions to append/insert text

Daniel-Constantin Mierla authored on 04/08/2021 07:07:36
Showing 1 changed files
... ...
@@ -787,6 +787,64 @@ bl_iterator_end("b1");
787 787
     }
788 788
     bl_iterator_end("b1");
789 789
 ...
790
+</programlisting>
791
+		</example>
792
+	</section>
793
+	<section id="textopsx.f.bl_iterator_append">
794
+		<title>
795
+		<function moreinfo="none">bl_iterator_append(iname, text)</function>
796
+		</title>
797
+		<para>
798
+			Add text after the line at the current iterator possition.
799
+		</para>
800
+		<para>
801
+			The parameters can be dynamic strings with variables.
802
+		</para>
803
+		<para>
804
+			This function can be used from ANY_ROUTE.
805
+		</para>
806
+		<example>
807
+		<title><function>bl_iterator_append</function> usage</title>
808
+		<programlisting format="linespecific">
809
+...
810
+    bl_iterator_start("b1");
811
+    while(bl_iterator_next("b1")) {
812
+        if($blitval(b1)=~"^a=info:xyz") {
813
+            bl_iterator_append("b1", "a=info:abc\r\n");
814
+            break;
815
+        }
816
+    }
817
+    bl_iterator_end("b1");
818
+...
819
+</programlisting>
820
+		</example>
821
+	</section>
822
+	<section id="textopsx.f.bl_iterator_insert">
823
+		<title>
824
+		<function moreinfo="none">bl_iterator_insert(iname, text)</function>
825
+		</title>
826
+		<para>
827
+			Add text before the line at the current iterator possition.
828
+		</para>
829
+		<para>
830
+			The parameters can be dynamic strings with variables.
831
+		</para>
832
+		<para>
833
+			This function can be used from ANY_ROUTE.
834
+		</para>
835
+		<example>
836
+		<title><function>bl_iterator_insert</function> usage</title>
837
+		<programlisting format="linespecific">
838
+...
839
+    bl_iterator_start("b1");
840
+    while(bl_iterator_next("b1")) {
841
+        if($blitval(b1)=~"^a=info:xyz") {
842
+            bl_iterator_insert("b1", "a=info:abc\r\n");
843
+            break;
844
+        }
845
+    }
846
+    bl_iterator_end("b1");
847
+...
790 848
 </programlisting>
791 849
 		</example>
792 850
 	</section>
Browse code

textopsx: docs - fix example for body line iterator

Daniel-Constantin Mierla authored on 30/07/2021 10:39:32
Showing 1 changed files
... ...
@@ -754,8 +754,8 @@ bl_iterator_end("b1");
754 754
 		<programlisting format="linespecific">
755 755
 ...
756 756
     bl_iterator_start("b1");
757
-    while(hf_iterator_next("b1")) {
758
-        xlog("body line: hdr[$hfitname(b1)]\n");
757
+    while(bl_iterator_next("b1")) {
758
+        xlog("body line: $blitval(b1)");
759 759
     }
760 760
     bl_iterator_end("b1");
761 761
 ...
Browse code

textopsx: added body line iterator functions

- iterate through lines of message body, get the value via
$blitval(iname)

Daniel-Constantin Mierla authored on 30/07/2021 10:24:02
Showing 1 changed files
... ...
@@ -512,7 +512,7 @@ hf_iterator_start("i1");
512 512
 		</title>
513 513
 		<para>
514 514
 			Close the iterator identified by iname parameter. The iname value
515
-			must be the same used for sht_iterator_start().
515
+			must be the same used for hf_iterator_start().
516 516
 		</para>
517 517
 		<para>
518 518
 			The parameter can be dynamic string with variables.
... ...
@@ -535,7 +535,7 @@ hf_iterator_end("i1");
535 535
 		</title>
536 536
 		<para>
537 537
 			Move the iterator to the next header. It must
538
-			be called also after sht_iterator_start() to get the first
538
+			be called also after bl_iterator_start() to get the first
539 539
 			header.
540 540
 		</para>
541 541
 		<para>
... ...
@@ -570,7 +570,7 @@ hf_iterator_end("i1");
570 570
 		</title>
571 571
 		<para>
572 572
 			Move the iterator to the previous header. It must
573
-			be called also after sht_iterator_start() and sht_iterator_next().
573
+			be called also after hf_iterator_start() and hf_iterator_next().
574 574
 		</para>
575 575
 		<para>
576 576
 			The parameter can be dynamic string with variables.
... ...
@@ -677,6 +677,116 @@ hf_iterator_end("i1");
677 677
     }
678 678
     hf_iterator_end("i1");
679 679
 ...
680
+</programlisting>
681
+		</example>
682
+	</section>
683
+	<section id="textopsx.f.bl_iterator_start">
684
+		<title>
685
+		<function moreinfo="none">bl_iterator_start(iname)</function>
686
+		</title>
687
+		<para>
688
+			Start an iterator for lines in the body of the current SIP message.
689
+			The parameter iname is used to identify the iterator. There
690
+			can be up to 4 iterators at the same time, with different name.
691
+		</para>
692
+		<para>
693
+			The parameter can be a dynamic string with variables.
694
+		</para>
695
+		<para>
696
+			This function can be used from ANY_ROUTE.
697
+		</para>
698
+		<example>
699
+		<title><function>bl_iterator_start</function> usage</title>
700
+		<programlisting format="linespecific">
701
+...
702
+bl_iterator_start("b1");
703
+...
704
+</programlisting>
705
+		</example>
706
+	</section>
707
+	<section id="textopsx.f.bl_iterator_end">
708
+		<title>
709
+		<function moreinfo="none">bl_iterator_end(iname)</function>
710
+		</title>
711
+		<para>
712
+			Close the iterator identified by iname parameter. The iname value
713
+			must be the same used for bl_iterator_start().
714
+		</para>
715
+		<para>
716
+			The parameter can be dynamic string with variables.
717
+		</para>
718
+		<para>
719
+			This function can be used from ANY_ROUTE.
720
+		</para>
721
+		<example>
722
+		<title><function>bl_iterator_end</function> usage</title>
723
+		<programlisting format="linespecific">
724
+...
725
+bl_iterator_end("b1");
726
+...
727
+</programlisting>
728
+		</example>
729
+	</section>
730
+	<section id="textopsx.f.bl_iterator_next">
731
+		<title>
732
+		<function moreinfo="none">textopsx.f.bl_iterator_next(iname)</function>
733
+		</title>
734
+		<para>
735
+			Move the iterator to the next line in the body. It must
736
+			be called also after bl_iterator_start() to get the first
737
+			header.
738
+		</para>
739
+		<para>
740
+			The return code is false when there is no other header in the list.
741
+		</para>
742
+		<para>
743
+			The body line accessible via variable $blitval(iname) - it contains
744
+			also the EOL chars.
745
+		</para>
746
+		<para>
747
+			The parameter can be dynamic string with variables.
748
+		</para>
749
+		<para>
750
+			This function can be used from ANY_ROUTE.
751
+		</para>
752
+		<example>
753
+		<title><function>bl_iterator_next</function> usage</title>
754
+		<programlisting format="linespecific">
755
+...
756
+    bl_iterator_start("b1");
757
+    while(hf_iterator_next("b1")) {
758
+        xlog("body line: hdr[$hfitname(b1)]\n");
759
+    }
760
+    bl_iterator_end("b1");
761
+...
762
+</programlisting>
763
+		</example>
764
+	</section>
765
+	<section id="textopsx.f.bl_iterator_rm">
766
+		<title>
767
+		<function moreinfo="none">bl_iterator_rm(iname)</function>
768
+		</title>
769
+		<para>
770
+			Remove the body line at the current iterator position.
771
+		</para>
772
+		<para>
773
+			The parameter can be dynamic string with variables.
774
+		</para>
775
+		<para>
776
+			This function can be used from ANY_ROUTE.
777
+		</para>
778
+		<example>
779
+		<title><function>bl_iterator_rm</function> usage</title>
780
+		<programlisting format="linespecific">
781
+...
782
+    bl_iterator_start("b1");
783
+    while(bl_iterator_next("b1")) {
784
+        if($blitval(b1)=~"abc") {
785
+            bl_iterator_rm("b1");
786
+        }
787
+    }
788
+    bl_iterator_end("b1");
789
+...
680 790
 </programlisting>
681 791
 		</example>
682 792
 	</section>
Browse code

textopsx: added hf_iterator_prev() function

Daniel-Constantin Mierla authored on 30/07/2021 07:10:16
Showing 1 changed files
... ...
@@ -561,6 +561,36 @@ hf_iterator_end("i1");
561 561
     }
562 562
     hf_iterator_end("i1");
563 563
 ...
564
+</programlisting>
565
+		</example>
566
+	</section>
567
+	<section id="textopsx.f.hf_iterator_prev">
568
+		<title>
569
+		<function moreinfo="none">textopsx.f.hf_iterator_prev(iname)</function>
570
+		</title>
571
+		<para>
572
+			Move the iterator to the previous header. It must
573
+			be called also after sht_iterator_start() and sht_iterator_next().
574
+		</para>
575
+		<para>
576
+			The parameter can be dynamic string with variables.
577
+		</para>
578
+		<para>
579
+			This function can be used from ANY_ROUTE.
580
+		</para>
581
+		<example>
582
+		<title><function>hf_iterator_prev</function> usage</title>
583
+		<programlisting format="linespecific">
584
+...
585
+    hf_iterator_start("i1");
586
+    hf_iterator_next("i1");
587
+...
588
+    hf_iterator_next("i1");
589
+...
590
+    hf_iterator_prev("i1");
591
+...
592
+    hf_iterator_end("i1");
593
+...
564 594
 </programlisting>
565 595
 		</example>
566 596
 	</section>
Browse code

textopsx: added hf_iterator_insert() function

Daniel-Constantin Mierla authored on 29/07/2021 07:01:25
Showing 1 changed files
... ...
@@ -618,6 +618,35 @@ hf_iterator_end("i1");
618 618
     }
619 619
     hf_iterator_end("i1");
620 620
 ...
621
+</programlisting>
622
+		</example>
623
+	</section>
624
+	<section id="textopsx.f.hf_iterator_insert">
625
+		<title>
626
+		<function moreinfo="none">hf_iterator_insert(iname, htext)</function>
627
+		</title>
628
+		<para>
629
+			Add headers before the one at the current iterator possition.
630
+		</para>
631
+		<para>
632
+			The parameters can be dynamic strings with variables.
633
+		</para>
634
+		<para>
635
+			This function can be used from ANY_ROUTE.
636
+		</para>
637
+		<example>
638
+		<title><function>hf_iterator_insert</function> usage</title>
639
+		<programlisting format="linespecific">
640
+...
641
+    hf_iterator_start("i1");
642
+    while(hf_iterator_next("i1")) {
643
+        if($hfitname(i1)=="My-Header") {
644
+            hf_iterator_insert("i1", "My-New-Header: abc\r\n");
645
+            break;
646
+        }
647
+    }
648
+    hf_iterator_end("i1");
649
+...
621 650
 </programlisting>
622 651
 		</example>
623 652
 	</section>
Browse code

textopsx: docs for hf_iterator_append()

Daniel-Constantin Mierla authored on 26/07/2021 15:15:38
Showing 1 changed files
... ...
@@ -589,6 +589,35 @@ hf_iterator_end("i1");
589 589
     }
590 590
     hf_iterator_end("i1");
591 591
 ...
592
+</programlisting>
593
+		</example>
594
+	</section>
595
+	<section id="textopsx.f.hf_iterator_append">
596
+		<title>
597
+		<function moreinfo="none">hf_iterator_append(iname, htext)</function>
598
+		</title>
599
+		<para>
600
+			Add headers after the one at the current iterator possition.
601
+		</para>
602
+		<para>
603
+			The parameters can be dynamic strings with variables.
604
+		</para>
605
+		<para>
606
+			This function can be used from ANY_ROUTE.
607
+		</para>
608
+		<example>
609
+		<title><function>hf_iterator_append</function> usage</title>
610
+		<programlisting format="linespecific">
611
+...
612
+    hf_iterator_start("i1");
613
+    while(hf_iterator_next("i1")) {
614
+        if($hfitname(i1)=="My-Header") {
615
+            hf_iterator_append("i1", "My-New-Header: abc\r\n");
616
+            break;
617
+        }
618
+    }
619
+    hf_iterator_end("i1");
620
+...
592 621
 </programlisting>
593 622
 		</example>
594 623
 	</section>
Browse code

textopsx: docs for hf_iterator_rm()

Daniel-Constantin Mierla authored on 11/07/2021 12:06:07
Showing 1 changed files
... ...
@@ -561,6 +561,34 @@ hf_iterator_end("i1");
561 561
     }
562 562
     hf_iterator_end("i1");
563 563
 ...
564
+</programlisting>
565
+		</example>
566
+	</section>
567
+	<section id="textopsx.f.hf_iterator_rm">
568
+		<title>
569
+		<function moreinfo="none">hf_iterator_rm(iname)</function>
570
+		</title>
571
+		<para>
572
+			Remove the header at the current iterator position.
573
+		</para>
574
+		<para>
575
+			The parameter can be dynamic string with variables.
576
+		</para>
577
+		<para>
578
+			This function can be used from ANY_ROUTE.
579
+		</para>
580
+		<example>
581
+		<title><function>hf_iterator_rm</function> usage</title>
582
+		<programlisting format="linespecific">
583
+...
584
+    hf_iterator_start("i1");
585
+    while(hf_iterator_next("i1")) {
586
+        if($hfitname(i1)=="My-Header") {
587
+            hf_iterator_rm("i1");
588
+        }
589
+    }
590
+    hf_iterator_end("i1");
591
+...
564 592
 </programlisting>
565 593
 		</example>
566 594
 	</section>
Browse code

textopsx: docs for hdr iterator functions

Daniel-Constantin Mierla authored on 07/07/2021 10:28:54
Showing 1 changed files
... ...
@@ -482,5 +482,87 @@ if (@hf_value_exists.supported.path == "1") {
482 482
 	    </programlisting>
483 483
 	</example>
484 484
     </section>
485
+	<section id="textopsx.f.hf_iterator_start">
486
+		<title>
487
+		<function moreinfo="none">hf_iterator_start(iname)</function>
488
+		</title>
489
+		<para>
490
+			Start an iterator for headers in the current SIP message.
491
+			The parameter iname is used to identify the iterator. There
492
+			can be up to 4 iterators at the same time, with different name.
493
+		</para>
494
+		<para>
495
+			The parameter can be a dynamic string with variables.
496
+		</para>
497
+		<para>
498
+			This function can be used from ANY_ROUTE.
499
+		</para>
500
+		<example>
501
+		<title><function>hf_iterator_start</function> usage</title>
502
+		<programlisting format="linespecific">
503
+...
504
+hf_iterator_start("i1");
505
+...
506
+</programlisting>
507
+		</example>
508
+	</section>
509
+	<section id="textopsx.f.hf_iterator_end">
510
+		<title>
511
+		<function moreinfo="none">hf_iterator_end(iname)</function>
512
+		</title>
513
+		<para>
514
+			Close the iterator identified by iname parameter. The iname value
515
+			must be the same used for sht_iterator_start().
516
+		</para>
517
+		<para>
518
+			The parameter can be dynamic string with variables.
519
+		</para>
520
+		<para>
521
+			This function can be used from ANY_ROUTE.
522
+		</para>
523
+		<example>
524
+		<title><function>hf_iterator_end</function> usage</title>
525
+		<programlisting format="linespecific">
526
+...
527
+hf_iterator_end("i1");
528
+...
529
+</programlisting>
530
+		</example>
531
+	</section>
532
+	<section id="textopsx.f.hf_iterator_next">
533
+		<title>
534
+		<function moreinfo="none">textopsx.f.hf_iterator_next(iname)</function>
535
+		</title>
536
+		<para>
537
+			Move the iterator to the next header. It must
538
+			be called also after sht_iterator_start() to get the first
539
+			header.
540
+		</para>
541
+		<para>
542
+			The return code is false when there is no other header in the list.
543
+		</para>
544
+		<para>
545
+			The item name and value are accessible via variables:
546
+			$hfitname(iname) and $hfitbody(iname).
547
+		</para>
548
+		<para>
549
+			The parameter can be dynamic string with variables.
550
+		</para>
551
+		<para>
552
+			This function can be used from ANY_ROUTE.
553
+		</para>
554
+		<example>
555
+		<title><function>hf_iterator_next</function> usage</title>
556
+		<programlisting format="linespecific">
557
+...
558
+    hf_iterator_start("i1");
559
+    while(hf_iterator_next("i1")) {
560
+        xlog("hdr[$hfitname(i1)] is: $hfitbody(i1)\n");
561
+    }
562
+    hf_iterator_end("i1");
563
+...
564
+</programlisting>
565
+		</example>
566
+	</section>
485 567
 
486 568
 </section>
Browse code

textopsx: docs - notes about 1-based indexing for hf value functions

- GH #2387

Daniel-Constantin Mierla authored on 31/03/2021 14:05:52
Showing 1 changed files
... ...
@@ -205,7 +205,8 @@ if(fnmatch("$rU", "123*"))
205 205
 	<itemizedlist>
206 206
 	    <listitem>
207 207
 		<para><emphasis>hf</emphasis> - Header field to be appended. Format: HFNAME [ [IDX] ].
208
-		If index is not specified new header is inserted at the end of message.
208
+		If index is not specified new header is inserted at the end of message. The index 1
209
+		correxponds to the first header.
209 210
 		</para>
210 211
 	    </listitem>
211 212
 	    <listitem>
... ...
@@ -238,7 +239,8 @@ append_hf_value("foo[-1]", "$var(Bar)") # try add value to the last header, if n
238 239
 	<itemizedlist>
239 240
 	    <listitem>
240 241
 		<para><emphasis>hf</emphasis> - Header field to be appended. Format: HFNAME [ [IDX] ].
241
-		If index is not specified new header is inserted at the top of message.
242
+		If index is not specified new header is inserted at the top of message. The index 1
243
+		correxponds to the first header.
242 244
 		</para>
243 245
 	    </listitem>
244 246
 	    <listitem>
... ...
@@ -269,7 +271,8 @@ insert_hf_value("foo[1]", "gogo") # try add to the first header
269 271
 	<itemizedlist>
270 272
 	    <listitem>
271 273
 		<para><emphasis>hf_par</emphasis> - Header field/param to be removed. Format: HFNAME [ [IDX] ] [. PARAM ]
272
-		If asterisk is specified as index then all values are affected.
274
+		If asterisk is specified as index then all values are affected. The index 1
275
+		correxponds to the first header.
273 276
 		</para>
274 277
 	    </listitem>
275 278
 	</itemizedlist>
... ...
@@ -299,7 +302,8 @@ remove_hf_value("foo[*].bar") # for each foo delete bar parameters
299 302
 	<itemizedlist>
300 303
 	    <listitem>
301 304
 		<para><emphasis>hf_par</emphasis> - Header/param to be removed. Format: HFNAME [ [IDX] ] [. PARAM ]
302
-		If asterisk is specified as index then all values are affected.
305
+		If asterisk is specified as index then all values are affected. The index 1
306
+		correxponds to the first header.
303 307
 		</para>
304 308
 	    </listitem>
305 309
 	</itemizedlist>
... ...
@@ -329,7 +333,8 @@ remove_hf_value2("foo[*].bar") # for each foo delete bar parameters
329 333
 	    <listitem>
330 334
 			<para><emphasis>hf_para</emphasis> - Header field value / param to be appended.
331 335
 				Format: HFNAME [ [IDX] ] [. PARAM]
332
-		If asterisk is specified as index then all values are affected.
336
+		If asterisk is specified as index then all values are affected. The index 1
337
+		correxponds to the first header.
333 338
 		</para>
334 339
 	    </listitem>
335 340
 	    <listitem>
... ...
@@ -365,7 +370,8 @@ assign_hf_value("foo[*].bar", "")  # set empty value (ex. lr)
365 370
 	<itemizedlist>
366 371
 	    <listitem>
367 372
 		<para><emphasis>hf_para</emphasis> - Header field value / param to be appended. Format: HFNAME [ [IDX] ] [. PARAM]
368
-		If asterisk is specified as index then all values are affected.
373
+		If asterisk is specified as index then all values are affected. The index 1
374
+		correxponds to the first header.
369 375
 		</para>
370 376
 	    </listitem>
371 377
 	    <listitem>
Browse code

textopsx: docs for change_reply_status_code() function

Daniel-Constantin Mierla authored on 02/08/2020 15:07:20
Showing 1 changed files
... ...
@@ -82,6 +82,38 @@ reply_route {
82 82
         exit;
83 83
     }
84 84
 }
85
+...
86
+	    </programlisting>
87
+	</example>
88
+    </section>
89
+
90
+    <section id="textopsx.f.change_reply_status_code">
91
+	<title>
92
+	    <function>change_reply_status_code(vcode)</function>
93
+	</title>
94
+	<para>
95
+		Change the status code for a SIP reply .
96
+	</para>
97
+	<para>Meaning of the parameters is as follows:</para>
98
+	<itemizedlist>
99
+	    <listitem>
100
+		<para><emphasis>vcode</emphasis> - the new status code.
101
+		</para>
102
+	    </listitem>
103
+	</itemizedlist>
104
+   		<para>
105
+		This function can be used from ONREPLY_ROUTE.
106
+		</para>
107
+	<example>
108
+	    <title><function>change_reply_status_code</function> usage</title>
109
+	    <programlisting>
110
+...
111
+reply_route {
112
+    if (status == "604") {
113
+        change_reply_status_code("404");
114
+        exit;
115
+    }
116
+}
85 117
 ...
86 118
 	    </programlisting>
87 119
 	</example>
Browse code

textopsx: small spelling fix in docs

Henning Westerholt authored on 23/03/2020 17:28:49
Showing 1 changed files
... ...
@@ -200,7 +200,7 @@ append_hf_value("foo[-1]", "$var(Bar)") # try add value to the last header, if n
200 200
 	<para>
201 201
 		Insert new header value before an existing header, if no index acquired insert before first
202 202
 		hf header. Note that a header may consist of comma delimited list of values.
203
-		To insert value behind last value use <function>appenf_hf_value</function>.
203
+		To insert a value behind the last value use <function>append_hf_value</function>.
204 204
 	</para>
205 205
 	<para>Meaning of the parameters is as follows:</para>
206 206
 	<itemizedlist>
Browse code

textopsx: Fix typos in module documentation

Florian Floimair authored on 27/02/2018 21:07:08 • Daniel-Constantin Mierla committed on 28/02/2018 17:00:48
Showing 1 changed files
... ...
@@ -200,7 +200,7 @@ append_hf_value("foo[-1]", "$var(Bar)") # try add value to the last header, if n
200 200
 	<para>
201 201
 		Insert new header value before an existing header, if no index acquired insert before first
202 202
 		hf header. Note that a header may consist of comma delimited list of values.
203
-		To insert value behing last value use <function>appenf_hf_value</function>.
203
+		To insert value behind last value use <function>appenf_hf_value</function>.
204 204
 	</para>
205 205
 	<para>Meaning of the parameters is as follows:</para>
206 206
 	<itemizedlist>
... ...
@@ -302,7 +302,7 @@ remove_hf_value2("foo[*].bar") # for each foo delete bar parameters
302 302
 	    </listitem>
303 303
 	    <listitem>
304 304
 			<para><emphasis>hvalue</emphasis> - Value to be assigned, config var
305
-				formatting supported. If value is empty then no equal sign apears in param.
305
+				formatting supported. If value is empty then no equal sign appears in param.
306 306
 		</para>
307 307
 	    </listitem>
308 308
 	</itemizedlist>
... ...
@@ -338,7 +338,7 @@ assign_hf_value("foo[*].bar", "")  # set empty value (ex. lr)
338 338
 	    </listitem>
339 339
 	    <listitem>
340 340
 			<para><emphasis>hvalue</emphasis> - Value to be assigned, config var formatting supported.
341
-				If value is empty then no equal sign apears in param.
341
+				If value is empty then no equal sign appears in param.
342 342
 		</para>
343 343
 	    </listitem>
344 344
 	</itemizedlist>
Browse code

textopsx: docs - fixed example for change_reply_status()

Daniel-Constantin Mierla authored on 15/01/2018 14:20:35
Showing 1 changed files
... ...
@@ -76,8 +76,8 @@ if(msg_apply_changes())
76 76
 	    <title><function>change_reply_status</function> usage</title>
77 77
 	    <programlisting>
78 78
 ...
79
-onreply_route {
80
-    if (@status == "603") {
79
+reply_route {
80
+    if (status == "603") {
81 81
         change_reply_status(404, "Not Found");
82 82
         exit;
83 83
     }
Browse code

textopsx: fix documentation typo

Mikko Lehto authored on 07/11/2017 23:48:11
Showing 1 changed files
... ...
@@ -29,7 +29,7 @@
29 29
 		<para>
30 30
 		Note: It must be used before the transaction is created in
31 31
 		request_route and not inside the onreply_route[name] executed by tm
32
-		module. Also, do not used after resuming a suspended request or reply,
32
+		module. Also, do not use after resuming a suspended request or reply,
33 33
 		at that moment the transaction is already created.
34 34
 		</para>
35 35
 		<example>
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,448 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4
+
5
+<section id="textopsx.functions" xmlns:xi="http://www.w3.org/2001/XInclude">
6
+    <title>Functions</title>
7
+
8
+	<section id="textopsx.f.msg_apply_changes">
9
+		<title>
10
+		<function moreinfo="none">msg_apply_changes()</function>
11
+		</title>
12
+		<para>
13
+		Use this function to apply changes performed on SIP message content. Be
14
+		careful when using this function;  due to special handling of changes
15
+		to the SIP message buffer so far, using this function might change
16
+		the behaviour of your config.  Do test your config properly!
17
+		</para>
18
+   		<para>
19
+		The function returns true (1) on success. If it is failure before the
20
+		new content is build, the function returns false (-1), the old content
21
+		is still in place. If parsing of the new content is failing, the
22
+		function stops executions of the config file (the internal structure
23
+		is no longer valid for config processing, like it happens when a
24
+		broken message is received from network).
25
+		</para>
26
+		<para>
27
+			This function can be used from REQUEST_ROUTE or core REPLY_ROUTE.
28
+		</para>
29
+		<para>
30
+		Note: It must be used before the transaction is created in
31
+		request_route and not inside the onreply_route[name] executed by tm
32
+		module. Also, do not used after resuming a suspended request or reply,
33
+		at that moment the transaction is already created.
34
+		</para>
35
+		<example>
36
+		<title><function>msg_apply_changes()</function> usage</title>
37
+		<programlisting format="linespecific">
38
+...
39
+append_hf("My-Header: yes\r\n");
40
+if(msg_apply_changes())
41
+{
42
+    # msg buffer has a new content
43
+    if(is_present_hf("My-Header"))
44
+    {
45
+        # will get here always
46
+    }
47
+}
48
+...
49
+</programlisting>
50
+		</example>
51
+	</section>
52
+
53
+    <section id="textopsx.f.change_reply_status">
54
+	<title>
55
+	    <function>change_reply_status(code, reason)</function>
56
+	</title>
57
+	<para>
58
+		Intercept a SIP reply (in an onreply_route) and change its status code 
59
+		and reason phrase prior to forwarding it.
60
+	</para>
61
+	<para>Meaning of the parameters is as follows:</para>
62
+	<itemizedlist>
63
+	    <listitem>
64
+		<para><emphasis>code</emphasis> - Status code.
65
+		</para>
66
+	    </listitem>
67
+	    <listitem>
68
+		<para><emphasis>reason</emphasis> - Reason phrase.
69
+		</para>
70
+	    </listitem>
71
+	</itemizedlist>
72
+   		<para>
73
+		This function can be used from ONREPLY_ROUTE.
74
+		</para>
75
+	<example>
76
+	    <title><function>change_reply_status</function> usage</title>
77
+	    <programlisting>
78
+...
79
+onreply_route {
80
+    if (@status == "603") {
81
+        change_reply_status(404, "Not Found");
82
+        exit;
83
+    }
84
+}
85
+...
86
+	    </programlisting>
87
+	</example>
88
+    </section>
89
+
90
+	<section id="textopsx.f.remove_body">
91
+		<title>
92
+		<function moreinfo="none">remove_body()</function>
93
+		</title>
94
+		<para>
95
+		Use this function to remove the body of SIP requests or replies.
96
+		</para>
97
+		<para>
98
+		This function can be used from ANY_ROUTE.
99
+		</para>
100
+		<example>
101
+		<title><function>remove_body()</function> usage</title>
102
+		<programlisting format="linespecific">
103
+...
104
+remove_body();
105
+...
106
+</programlisting>
107
+		</example>
108
+	</section>
109
+
110
+	<section id="textopsx.f.keep_hf">
111
+		<title>
112
+		<function moreinfo="none">keep_hf([regexp])</function>
113
+		</title>
114
+		<para>
115
+			Remove headers that don't match the regular expression regexp.
116
+			Several header are ignored always (thus not removed): Via, From,
117
+			To, Call-ID, CSeq, Content-Length, Content-Type, Max-Forwards,
118
+			Contact, Route, Record-Route -- these can be removed one by one
119
+			with remove_hf(). If regexp is missing, then only the headers
120
+			listed above are kept, the rest are removed.
121
+		</para>
122
+		<para>
123
+		This function can be used from ANY_ROUTE.
124
+		</para>
125
+		<example>
126
+		<title><function>keep_hf()</function> usage</title>
127
+		<programlisting format="linespecific">
128
+...
129
+keep_hf("User-Agent");
130
+...
131
+</programlisting>
132
+		</example>
133
+	</section>
134
+
135
+	<section id="textopsx.f.fnmatch">
136
+		<title>
137
+		<function moreinfo="none">fnmatch(value, expr [, flags])</function>
138
+		</title>
139
+		<para>
140
+			Match the value against the expr using shell-style pattern
141
+			for file name matching (see man page for C function fnmatch()).
142
+			It is known to be faster and use less-memory than regular expressions.
143
+		</para>
144
+		<para>
145
+			Parameter 'flags' is optional and can be 'i' to do case insensitive
146
+			matching.
147
+		</para>
148
+		<para>
149
+		This function can be used from ANY_ROUTE.
150
+		</para>
151
+		<example>
152
+		<title><function>fnmatch()</function> usage</title>
153
+		<programlisting format="linespecific">
154
+...
155
+if(fnmatch("$rU", "123*"))
156
+{
157
+    ...
158
+}
159
+...
160
+</programlisting>
161
+		</example>
162
+	</section>
163
+
164
+    <section id="textopsx.f.append_hf_value">
165
+	<title>
166
+	    <function>append_hf_value(hf, hvalue)</function>
167
+	</title>
168
+	<para>
169
+		Append new header value after an existing header, if no index acquired append at the end of
170
+		list. Note that a header may consist of comma delimited list of values.
171
+	</para>
172
+	<para>Meaning of the parameters is as follows:</para>
173
+	<itemizedlist>
174
+	    <listitem>
175
+		<para><emphasis>hf</emphasis> - Header field to be appended. Format: HFNAME [ [IDX] ].
176
+		If index is not specified new header is inserted at the end of message.
177
+		</para>
178
+	    </listitem>
179
+	    <listitem>
180
+		<para><emphasis>hvalue</emphasis> - Value to be added, config var formatting supported.
181
+		</para>
182
+	    </listitem>
183
+	</itemizedlist>
184
+	<example>
185
+	    <title><function>append_hf_value</function> usage</title>
186
+	    <programlisting>
187
+...
188
+append_hf_value("foo", "gogo;stamp=$Ts")   # add new header
189
+append_hf_value("foo[1]", "gogo")  # add new value behind first value
190
+append_hf_value("foo[-1]", "$var(Bar)") # try add value to the last header, if not exists add new header
191
+...
192
+	    </programlisting>
193
+	</example>
194
+    </section>
195
+
196
+    <section id="textopsx.f.insert_hf_value">
197
+	<title>
198
+	    <function>insert_hf_value(hf, hvalue)</function>
199
+	</title>
200
+	<para>
201
+		Insert new header value before an existing header, if no index acquired insert before first
202
+		hf header. Note that a header may consist of comma delimited list of values.
203
+		To insert value behing last value use <function>appenf_hf_value</function>.
204
+	</para>
205
+	<para>Meaning of the parameters is as follows:</para>
206
+	<itemizedlist>
207
+	    <listitem>
208
+		<para><emphasis>hf</emphasis> - Header field to be appended. Format: HFNAME [ [IDX] ].
209
+		If index is not specified new header is inserted at the top of message.
210
+		</para>
211
+	    </listitem>
212
+	    <listitem>
213
+		<para><emphasis>hvalue</emphasis> - Value to be added, config var formatting supported.