Browse Source

kamilio-kemi-framework: docs for KSR.hdr module

Daniel-Constantin Mierla 7 years ago
parent
commit
aaae0a156f
1 changed files with 63 additions and 0 deletions
  1. 63 0
      kamailio-kemi-framework/docs/core.md

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

@@ -449,26 +449,89 @@ KSR.forward_uri("sip:127.0.0.1:5080;transport=tcp");
 
 `int KSR.hdr.append(str "hdrval")`
 
+Append header to current SIP message (request or reply). It will be added after
+the last header.
+
+Example:
+
+```
+KSR.hdr.append("X-My-Hdr: $si\r\n");
+```
+
 ### KSR.hdr.append_after(...) ###
 
 `int KSR.hdr.append_after(str "hdrval", str "hdrname")`
 
+Append header to current SIP message (request or reply). It will be added after
+the first header matching the name `hdrname`.
+
+Example:
+
+```
+KSR.hdr.append_after("X-My-Hdr: $si\r\n", "Call-Id");
+```
+
 ### KSR.hdr.insert(...) ###
 
 `int KSR.hdr.insert(str "hdrval")`
 
+Insert header to current SIP message (request or reply). It will be added before
+the first header.
+
+Example:
+
+```
+KSR.hdr.insert("X-My-Hdr: $si\r\n");
+```
+
 ### KSR.hdr.insert_before(...) ###
 
 `int KSR.hdr.insert_before(str "hdrval", str "hdrname")`
 
+Insert header to current SIP message (request or reply). It will be added before
+the header matching the name `hdrname`.
+
+Example:
+
+```
+KSR.hdr.insert_before("X-My-Hdr: $si\r\n", "Call-Id");
+```
+
 ### KSR.hdr.remove(...) ###
 
 `int KSR.hdr.remove(str "hdrval")`
 
+Remove all the headers with the name `hdrval`.
+
+Example:
+
+```
+KSR.hdr.remove("X-My-Hdr");
+```
+
 ### KSR.hdr.is_present(...) ###
 
 `int KSR.hdr.is_present(str "hdrval")`
 
+Return true if a header with the name `hdrval` exists.
+
+Example:
+
+```
+if(KSR.hdr.is_present("X-My-Hdr")) {
+  ...
+}
+```
+
 ### KSR.hdr.append_to_reply(...) ###
 
 `int KSR.hdr.append_to_reply(str "hdrval")`
+
+Add a header to the SIP response to be generated by Kamailio for the current
+SIP request.
+
+Example:
+
+```
+KSR.hdr.append_to_reply("X-My-Hdr: $si\r\n");
+```