Module: kamailio
Branch: master
Commit: 2471d1db579089f9e46feabe59830c53ac862e72
URL: https://github.com/kamailio/kamailio/commit/2471d1db579089f9e46feabe59830c5…
Author: Olle E. Johansson <oej(a)edvina.net>
Committer: Olle E. Johansson <oej(a)edvina.net>
Date: 2015-10-02T13:33:46+03:00
jansson Add explaination of error handling.
The pvar remains unchanged if the key/path is not found. Any previous
value remains, and it's not reset to a default value or NULL.
---
Modified: modules/jansson/README
Modified: modules/jansson/doc/jansson_admin.xml
---
Diff: https://github.com/kamailio/kamailio/commit/2471d1db579089f9e46feabe59830c5…
Patch: https://github.com/kamailio/kamailio/commit/2471d1db579089f9e46feabe59830c5…
---
diff --git a/modules/jansson/README b/modules/jansson/README
index c5be0a6..87d28a8 100644
--- a/modules/jansson/README
+++ b/modules/jansson/README
@@ -111,7 +111,9 @@ Chapter 1. Admin Guide
foo.bar[0][1].baz).
The function can put a string, integer, null, or new json string into
- destination.
+ destination. If the key/path can't be found in the JSON data structure,
+ the pvar is not changed. If it had a previous value, that value remains
+ unchanged.
Example 1.1. jansson_get usage
...
diff --git a/modules/jansson/doc/jansson_admin.xml b/modules/jansson/doc/jansson_admin.xml
index b1b0eab..baab686 100644
--- a/modules/jansson/doc/jansson_admin.xml
+++ b/modules/jansson/doc/jansson_admin.xml
@@ -67,13 +67,15 @@
<function moreinfo="none">jansson_get(key/path, src, dst)</function>
</title>
<para>
- Copy the value at the location 'path' from the json object 'src' and store it in pvar 'dst'.
+ Copy the value at the location 'path' from the json object 'src' and store it in pvar 'dst'.
</para>
<para>
The path string supports dot delimited notation (e.g. foo.bar.baz), array notation (e.g. [0]), or a combination of the two (e.g. foo.bar[0][1].baz).
</para>
<para>
The function can put a string, integer, null, or new json string into destination.
+ If the key/path can't be found in the JSON data structure, the pvar is not changed. If it had a previous
+ value, that value remains unchanged.
</para>
<example>
<title><function>jansson_get</function> usage</title>
Module: kamailio
Branch: master
Commit: 369f79b8a1f24dacb52634fc13530fd42c921898
URL: https://github.com/kamailio/kamailio/commit/369f79b8a1f24dacb52634fc13530fd…
Author: Olle E. Johansson <oej(a)edvina.net>
Committer: Olle E. Johansson <oej(a)edvina.net>
Date: 2015-10-02T08:23:26+03:00
curl Fix documentation, remove local character
---
Modified: modules/curl/README
Modified: modules/curl/doc/curl_admin.xml
---
Diff: https://github.com/kamailio/kamailio/commit/369f79b8a1f24dacb52634fc13530fd…
Patch: https://github.com/kamailio/kamailio/commit/369f79b8a1f24dacb52634fc13530fd…
---
diff --git a/modules/curl/README b/modules/curl/README
index 1ce4575..b75df17 100644
--- a/modules/curl/README
+++ b/modules/curl/README
@@ -119,6 +119,9 @@ Chapter 1. Admin Guide
1. Overview
+ Note: This module is still in development. Not all options documented
+ here work yet.
+
This module implements protocol functions that use the libcurl library
to fetch data from external HTTP servers or post data to HTTP servers.
The module is using a concept of "connections" to define properties of
@@ -303,12 +306,13 @@ content_type, data, result)
Example 1.9. curl_connect() usage
...
-modparam("curl", "curlcon", "anders=>http://kamailio.org/api/");
+modparam("curl", "curlcon", "apiserver=>http://kamailio.org/api/");
...
# POST Request
-$var(res) = curl_connect("apiserver", "/postlåda", "application/json", "{ ok, {
-200, ok}}", "$avp(gurka)");
-xlog("L_INFO", "API-server Curl connection: $avp(gurka) Result $var(res)\n");
+$var(res) = curl_connect("apiserver", "/mailbox", "application/json", "{ ok, {20
+0, ok}}", "$avp(gurka)");
+xlog("L_INFO", "API-server Curl connection: $avp(gurka) Result code $var(res)\n"
+);
...
4.2. curl_http_query(url, [post-data], result)
diff --git a/modules/curl/doc/curl_admin.xml b/modules/curl/doc/curl_admin.xml
index 3bd7c31..1639b86 100644
--- a/modules/curl/doc/curl_admin.xml
+++ b/modules/curl/doc/curl_admin.xml
@@ -16,6 +16,10 @@
<section>
<title>Overview</title>
<para>
+ Note: This module is still in development. Not all options documented
+ here work yet.
+ </para>
+ <para>
This module implements protocol functions that use the libcurl library
to fetch data from external HTTP servers or post data to HTTP servers.
The module is using a concept of "connections" to define properties
@@ -286,11 +290,11 @@ modparam("curl", "curlcon", "apifour=>http://stockholm.example.com/api/getstuff;
<title><function>curl_connect()</function> usage</title>
<programlisting format="linespecific">
...
-modparam("curl", "curlcon", "anders=>http://kamailio.org/api/");
+modparam("curl", "curlcon", "apiserver=>http://kamailio.org/api/");
...
# POST Request
-$var(res) = curl_connect("apiserver", "/postlåda", "application/json", "{ ok, {200, ok}}", "$avp(gurka)");
-xlog("L_INFO", "API-server Curl connection: $avp(gurka) Result $var(res)\n");
+$var(res) = curl_connect("apiserver", "/mailbox", "application/json", "{ ok, {200, ok}}", "$avp(gurka)");
+xlog("L_INFO", "API-server Curl connection: $avp(gurka) Result code $var(res)\n");
...
</programlisting>
</example>
Module: kamailio
Branch: master
Commit: 889a82f8b61620c224cc9eca4bd5b41369aa6fae
URL: https://github.com/kamailio/kamailio/commit/889a82f8b61620c224cc9eca4bd5b41…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2015-10-01T21:59:12+02:00
tcpops: release tcp connection id in w_tcp_conid_state()
- tcpconn_get() increases reference number, tcpconn_put() is required,
otherwise the associated structure won't be destroyed after close
- debug message for unexpected connection state reworked
---
Modified: modules/tcpops/tcpops_mod.c
---
Diff: https://github.com/kamailio/kamailio/commit/889a82f8b61620c224cc9eca4bd5b41…
Patch: https://github.com/kamailio/kamailio/commit/889a82f8b61620c224cc9eca4bd5b41…
---
diff --git a/modules/tcpops/tcpops_mod.c b/modules/tcpops/tcpops_mod.c
index c1c75e0..8241760 100644
--- a/modules/tcpops/tcpops_mod.c
+++ b/modules/tcpops/tcpops_mod.c
@@ -231,32 +231,43 @@ static int w_tcp_conid_state(sip_msg_t* msg, char* conid, char *p2)
if (unlikely((s_con = tcpconn_get(i_conid, 0, 0, 0, 0)) == NULL)) {
LM_DBG("Connection id %d does not exist.\n", i_conid);
- return -1;
+ ret = -1;
+ goto done;
}
/* Connection structure exists, now check what Kamailio thinks of it */
if (s_con->state == S_CONN_OK) {
/* All is fine, return happily */
- return 1;
+ ret = 1;
+ goto done;
}
if (s_con->state == S_CONN_EOF) { /* Socket closed or about to close under our feet */
- return -2;
+ ret = -2;
+ goto done;
}
if (s_con->state == S_CONN_ERROR) { /* Error on read/write - will close soon */
- return -3;
+ ret = -3;
+ goto done;
}
if (s_con->state == S_CONN_BAD) { /* Unknown state */
- return -4;
+ ret = -4;
+ goto done;
}
if (s_con->state == S_CONN_ACCEPT) { /* Incoming connection to be set up */
- return 2;
+ ret = 2;
+ goto done;
}
if (s_con->state == S_CONN_CONNECT) { /* Outbound connection moving to S_CONN_OK */
- return 3;
+ ret = 3;
+ goto done;
}
/* Wonder what state we're in here */
- LM_DBG("Connection id %d is in state %d - go figure. I will treat is a good. If not, file a bug report please.\n", i_conid, s_con->flags);
-
- return 1; /* Good connection */
+ LM_DBG("Connection id %d is in unexpected state %d - assuming ok.\n", i_conid, s_con->flags);
+
+ /* Good connection */
+ ret = 1;
+done:
+ if(s_con) tcpconn_put(s_con);
+ return ret;
}
static int w_tcpops_set_connection_lifetime2(sip_msg_t* msg, char* conid, char* time)