Переглянути джерело

kamailio-kemi-framework: docs for getting headers with index

Daniel-Constantin Mierla 4 роки тому
батько
коміт
abe129c4ea
1 змінених файлів з 44 додано та 0 видалено
  1. 44 0
      kamailio-kemi-framework/docs/core.md

+ 44 - 0
kamailio-kemi-framework/docs/core.md

@@ -1043,10 +1043,26 @@ Example:
 v = KSR.hdr.get("X-My-Hdr");
 ```
 
+### KSR.hdr.get_idx(...) ###
+
+`xval KSR.hdr.get(str "hname", int idx)`
+
+Return the value of the header matching the name with `hname` at the index `idx`
+or `NULL` if that header is not found. The index starts with `0` for first header
+and can be negative to count backwards from the last header (which corresponds
+to index `-1`).
+
+Example:
+
+```
+v = KSR.hdr.get_idx("X-My-Hdr", 1);
+```
+
 ### KSR.hdr.gete(...) ###
 
 `xval KSR.hdr.gete(str "hname")`
 
+
 Return the value of the header matching the name with `hname` or empty string
 if that header is not found.
 
@@ -1057,6 +1073,20 @@ Example:
 v = KSR.hdr.gete("X-My-Hdr");
 ```
 
+### KSR.hdr.gete_idx(...) ###
+
+`xval KSR.hdr.gete(str "hname", int idx)`
+
+Return the value of the header matching the name with `hname` at the index `idx`
+or empty string if that header is not found.
+
+
+Example:
+
+```
+v = KSR.hdr.gete_idx("X-My-Hdr", -1);
+```
+
 ### KSR.hdr.getw(...) ###
 
 `xval KSR.hdr.getw(str "hname")`
@@ -1070,3 +1100,17 @@ Example:
 ```
 v = KSR.hdr.getw("X-My-Hdr");
 ```
+
+### KSR.hdr.getw_idx(...) ###
+
+`xval KSR.hdr.getw_idx(str "hname", int idx)`
+
+Return the value of the header matching the name with `hname` at the index `idx`
+or string `<<null>>` if that header is not found.
+
+
+Example:
+
+```
+v = KSR.hdr.getw_idx("X-My-Hdr", 2);
+```