Module: kamailio
Branch: master
Commit: 24fc0f0c7bfd19c0086040740040988125ef39ea
URL: https://github.com/kamailio/kamailio/commit/24fc0f0c7bfd19c0086040740040988…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: GitHub <noreply(a)github.com>
Date: 2017-01-26T19:01:51+01:00
Merge pull request #951 from kelchy/master
jansson: add path to error log for easier debugging
---
Modified: src/modules/jansson/jansson_funcs.c
---
Diff: https://github.com/kamailio/kamailio/commit/24fc0f0c7bfd19c0086040740040988…
Patch: https://github.com/kamailio/kamailio/commit/24fc0f0c7bfd19c0086040740040988…
---
diff --git a/src/modules/jansson/jansson_funcs.c b/src/modules/jansson/jansson_funcs.c
index 5637560..9f82243 100644
--- a/src/modules/jansson/jansson_funcs.c
+++ b/src/modules/jansson/jansson_funcs.c
@@ -142,14 +142,14 @@ int janssonmod_set(unsigned int append, struct sip_msg* msg, char* type_in,
if(STR_EQ_STATIC(type_s, "object") || STR_EQ_STATIC(type_s, "obj")){
value = json_loads(value_s.s, JSON_REJECT_DUPLICATES, &parsing_error);
if(value && !json_is_object(value)) {
- ERR("value to add is not an object\n");
+ ERR("value to add is not an object - \"%s\"\n", path_s.s);
goto fail;
}
}else if(STR_EQ_STATIC(type_s, "array")) {
value = json_loads(value_s.s, JSON_REJECT_DUPLICATES, &parsing_error);
if(value && !json_is_array(value)) {
- ERR("value to add is not an array\n");
+ ERR("value to add is not an array - \"%s\"\n", path_s.s);
goto fail;
}
@@ -157,7 +157,7 @@ int janssonmod_set(unsigned int append, struct sip_msg* msg, char* type_in,
|| STR_EQ_STATIC(type_s, "str")) {
value = json_string(value_s.s);
if(!value || !json_is_string(value)) {
- ERR("value to add is not a string\n");
+ ERR("value to add is not a string - \"%s\"\n", path_s.s);
goto fail;
}
@@ -165,24 +165,24 @@ int janssonmod_set(unsigned int append, struct sip_msg* msg, char* type_in,
|| STR_EQ_STATIC(type_s, "int")) {
long long i = strtoll(value_s.s, &endptr, 10);
if(*endptr != '\0') {
- ERR("parsing int failed for \"%s\"\n", value_s.s);
+ ERR("parsing int failed for \"%s\" - \"%s\"\n", path_s.s, value_s.s);
goto fail;
}
value = json_integer(i);
if(!value || !json_is_integer(value)) {
- ERR("value to add is not an integer\n");
+ ERR("value to add is not an integer \"%s\"\n", path_s.s);
goto fail;
}
}else if(STR_EQ_STATIC(type_s, "real")) {
double d = strtod(value_s.s, &endptr);
if(*endptr != '\0') {
- ERR("parsing real failed for \"%s\"\n", value_s.s);
+ ERR("parsing real failed for \"%s\" - \"%s\"\n", path_s.s, value_s.s);
goto fail;
}
value = json_real(d);
if(!value || !json_is_real(value)) {
- ERR("value to add is not a real\n");
+ ERR("value to add is not a real \"%s\"\n", path_s.s);
goto fail;
}
Module: kamailio
Branch: master
Commit: 918cde9f30341fc52b98fb1ce6a2fcf78a0b6a0e
URL: https://github.com/kamailio/kamailio/commit/918cde9f30341fc52b98fb1ce6a2fcf…
Author: Kelvin Chua <kelchy(a)gmail.com>
Committer: Kelvin Chua <kelchy(a)gmail.com>
Date: 2017-01-26T15:52:49Z
jansson: add path to error log for easier debugging
---
Modified: src/modules/jansson/jansson_funcs.c
---
Diff: https://github.com/kamailio/kamailio/commit/918cde9f30341fc52b98fb1ce6a2fcf…
Patch: https://github.com/kamailio/kamailio/commit/918cde9f30341fc52b98fb1ce6a2fcf…
---
diff --git a/src/modules/jansson/jansson_funcs.c b/src/modules/jansson/jansson_funcs.c
index 5637560..9f82243 100644
--- a/src/modules/jansson/jansson_funcs.c
+++ b/src/modules/jansson/jansson_funcs.c
@@ -142,14 +142,14 @@ int janssonmod_set(unsigned int append, struct sip_msg* msg, char* type_in,
if(STR_EQ_STATIC(type_s, "object") || STR_EQ_STATIC(type_s, "obj")){
value = json_loads(value_s.s, JSON_REJECT_DUPLICATES, &parsing_error);
if(value && !json_is_object(value)) {
- ERR("value to add is not an object\n");
+ ERR("value to add is not an object - \"%s\"\n", path_s.s);
goto fail;
}
}else if(STR_EQ_STATIC(type_s, "array")) {
value = json_loads(value_s.s, JSON_REJECT_DUPLICATES, &parsing_error);
if(value && !json_is_array(value)) {
- ERR("value to add is not an array\n");
+ ERR("value to add is not an array - \"%s\"\n", path_s.s);
goto fail;
}
@@ -157,7 +157,7 @@ int janssonmod_set(unsigned int append, struct sip_msg* msg, char* type_in,
|| STR_EQ_STATIC(type_s, "str")) {
value = json_string(value_s.s);
if(!value || !json_is_string(value)) {
- ERR("value to add is not a string\n");
+ ERR("value to add is not a string - \"%s\"\n", path_s.s);
goto fail;
}
@@ -165,24 +165,24 @@ int janssonmod_set(unsigned int append, struct sip_msg* msg, char* type_in,
|| STR_EQ_STATIC(type_s, "int")) {
long long i = strtoll(value_s.s, &endptr, 10);
if(*endptr != '\0') {
- ERR("parsing int failed for \"%s\"\n", value_s.s);
+ ERR("parsing int failed for \"%s\" - \"%s\"\n", path_s.s, value_s.s);
goto fail;
}
value = json_integer(i);
if(!value || !json_is_integer(value)) {
- ERR("value to add is not an integer\n");
+ ERR("value to add is not an integer \"%s\"\n", path_s.s);
goto fail;
}
}else if(STR_EQ_STATIC(type_s, "real")) {
double d = strtod(value_s.s, &endptr);
if(*endptr != '\0') {
- ERR("parsing real failed for \"%s\"\n", value_s.s);
+ ERR("parsing real failed for \"%s\" - \"%s\"\n", path_s.s, value_s.s);
goto fail;
}
value = json_real(d);
if(!value || !json_is_real(value)) {
- ERR("value to add is not a real\n");
+ ERR("value to add is not a real \"%s\"\n", path_s.s);
goto fail;
}
Hello,
I recently started using Kamailio. At this point I am trying to understand
how Kamailio works. If I understood correctly, "kamctl stats" dumps bunch
of statistics. I was wondering the source of these stat data. I am trying
to add some new stat data for our project. So far I understood that "kamctl
stats" call get_statistics (..module/kex/core_stats.c) which in turns call
counter_iterate_group_name (../counters.c). There I noticed a callback
function "cbk". I am sort of stuck here. It will be highly appreciated if
you give some hints on how to proceed.
Looking forward to hear from you soon. My apologies in advance for the
inconvenience.
Thank you.
Regards,
Tapu Ghose.
SDE, Ottawa, Cananda.
Hello,
I want to start a discussion about some of the kamailio tutorials from
the wiki, mainly those related to core cookbook, variables and
transformations. They are now in dokuwiki at:
- https://www.kamailio.org/wiki/#cookbooks
The wiki served us pretty well so far, however the contributions there
are not that active. From time to time we still get spammers, even we
added restriction that only registered and authenticated users can write.
I am thinking that maybe people don't like creating yet another account
just add some example or rephrase for clarity.
On the other hand, there are over 400 registered users, many of them I
expect to be either made because if misunderstanding the purpose or by
spammers that guessed the (sip) captcha (plenty of random usernames).
Besides that I think the wiki adds overhead when releasing a new version
as each time we have to copy and paste old version content to a new set
of pages and update the version number.
With the above in mind, I wonder if won't be better to store those
tutorials in markdown format and use mkdocs.org or gitbook
(https://github.com/GitbookIO/gitbook) tools to generate the html and
host it in kamailio.org. The wiki will still be used to index them.
Among the benefits I see:
* store in github.com (a new repo, like: kamailio-docs) and all devs
can contribute directly, other users can make pull requests
* create branches for each major version of kamailio and backport
across them with git whenever is applicable
* the edit can be done directly via github.com website (similar to
the wiki right now) and even read it directly from github in html
transformed from markdown by github
* one can get them offline by cloning the git repo, use them or
enhance when offline
Many if the tutorials will stay in the wiki, but I think those that are
related to documenting per kamailio version should be migrated to gihub
storage + markdown. If there is a strong pro opinion for this change, I
can try to convert one of the cookbooks very soon so people can feel
better the difference. If we get to a consensus, then I think we can
have those tutorials in the new format for v5.0.
Should anyone have comments, other suggestions or improvements, let's
put them on debate.
Cheers,
Daniel
--
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - Mar 6-8 (Europe) and Mar 20-22 (USA) - www.asipto.com
Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com