Re: [sr-dev] [kamailio/kamailio] siptrace: use xavps to pass data for the duration of transaction/dialog (#1963)

2019-05-23 Thread Henning Westerholt
henningw commented on this pull request.

Thank you, great that you could get rid of the serialization/de-serialization 
code. I had only two small remarks to the pull request. I think it can be 
merged, you can work on that also directly in the repository.

>  
/* could use the dest_info we've already parsed but there's no 
way to pass
 * it to DLGCB_CREATED callback so the only thing to do is keep
 * it as uri, serialize in a dlg_var and parse again in 
DLGCB_CREATED */
if(corid) {
-   info->correlation_id = *corid;
+   info->correlation_id.s = (char *)(info + 1);

Maybe I misunderstood the code here, but why you use +1? If you want to 
increment the pointer for siptrace_info_t length, maybe use sizeof?

> @@ -133,8 +132,8 @@ static str direction_column = str_init("direction");  
>  /* 09 */
 static str time_us_column = str_init("time_us");/* 10 */
 static str totag_column = str_init("totag");/* 11 */
 
-static str siptrace_info_dlgkey = str_init("__siptrace_info_dlg_key__");
-static str siptrace_info_avp_str = str_init("$avp(__siptrace_info_avp__)");
+#define XAVP_TRACE_INFO_NAME "trace_info"

Would be good to document this as well in the README, to prevent accidential 
overlapping with existing xavps.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1963#pullrequestreview-241442745___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] Generating TCP traffic via TM module's C API

2019-05-23 Thread Henning Westerholt
Hello Ivan,

I would try to add ";transport=tcp" to the last parameter in the function call 
(next hop).

Cheers,

Henning

-- 
Henning Westerholt - https://skalatan.de/blog/
Kamailio services - https://skalatan.de/services

-Original Message-
From: sr-dev  On Behalf Of Ivan Ribakov
Sent: Tuesday, May 21, 2019 5:33 PM
To: Kamailio (SER) - Development Mailing List 
Subject: [sr-dev] Generating TCP traffic via TM module's C API

Hi,

I’ve been using TM module’s C API (tm_load..h -> struct tm_binds -> 
t_request_outside()) for some time now to generate new requests from custom 
module’s C code. What I haven’t come across so far is any type of switch to 
generate TCP traffic. Is it supported? If so, how can that be controlled? Via 
transport URI parameter perhaps?

Thanks in advance!

Regards,
Ivan
___
Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org 
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:6147bfe2: misc/examples/kemi: fix another small copy and paste error

2019-05-23 Thread Henning Westerholt
Module: kamailio
Branch: master
Commit: 6147bfe28dd54d62417040c96a7d54efb0f6ec56
URL: 
https://github.com/kamailio/kamailio/commit/6147bfe28dd54d62417040c96a7d54efb0f6ec56

Author: Henning Westerholt 
Committer: Henning Westerholt 
Date: 2019-05-23T21:34:01+02:00

misc/examples/kemi: fix another small copy and paste error

---

Modified: misc/examples/kemi/kamailio-basic-kemi.cfg

---

Diff:  
https://github.com/kamailio/kamailio/commit/6147bfe28dd54d62417040c96a7d54efb0f6ec56.diff
Patch: 
https://github.com/kamailio/kamailio/commit/6147bfe28dd54d62417040c96a7d54efb0f6ec56.patch

---

diff --git a/misc/examples/kemi/kamailio-basic-kemi.cfg 
b/misc/examples/kemi/kamailio-basic-kemi.cfg
index c102fa7f9c..9245056a80 100644
--- a/misc/examples/kemi/kamailio-basic-kemi.cfg
+++ b/misc/examples/kemi/kamailio-basic-kemi.cfg
@@ -407,7 +407,7 @@ cfgengine "sqlang"
 
 #!ifdef WITH_CFGRUBY
 modparam("app_ruby", "load", 
"/usr/local/etc/kamailio/kamailio-basic-kemi-ruby.rb")
-cfgengine "sqlang"
+cfgengine "ruby"
 #!else
 cfgengine "native"
 include_file "/usr/local/etc/kamailio/kamailio-basic-kemi-native.cfg"


___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] siptrace: use xavps to pass data for the duration of transaction/dialog (#1963)

2019-05-23 Thread Daniel-Constantin Mierla
OK, thanks for clarification, I wanted to be sure about the relations between 
the xavp and dialog.

Maybe @henningw or someone else wants to review as well. If no other 
objections, it will be merged very soon.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1963#issuecomment-495150603___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:98e6d1a6: misc/examples/kemi: fixed copy error with type of language

2019-05-23 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: 98e6d1a6f6c7fa78d470551de5d17a742e86c2ac
URL: 
https://github.com/kamailio/kamailio/commit/98e6d1a6f6c7fa78d470551de5d17a742e86c2ac

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2019-05-23T11:50:55+02:00

misc/examples/kemi: fixed copy error with type of language

---

Modified: misc/examples/kemi/kamailio-basic-kemi-jsdt.js

---

Diff:  
https://github.com/kamailio/kamailio/commit/98e6d1a6f6c7fa78d470551de5d17a742e86c2ac.diff
Patch: 
https://github.com/kamailio/kamailio/commit/98e6d1a6f6c7fa78d470551de5d17a742e86c2ac.patch

---

diff --git a/misc/examples/kemi/kamailio-basic-kemi-jsdt.js 
b/misc/examples/kemi/kamailio-basic-kemi-jsdt.js
index ea45b5a746..040af8656c 100644
--- a/misc/examples/kemi/kamailio-basic-kemi-jsdt.js
+++ b/misc/examples/kemi/kamailio-basic-kemi-jsdt.js
@@ -18,7 +18,7 @@ var FLB_NATSIPPING=7
 function ksr_request_route()
 {
// KSR.sl.sl_send_reply(100,"Intelligent trying");
-   // KSR.info("= request - from kamailio lua script\n");
+   // KSR.info("= request - from kamailio javascript script\n");
 
// per request initial checks
ksr_route_reqinit();


___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:2deb2aa5: misc/examples/kemi: added python3 and ruby as options to basic example

2019-05-23 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: 2deb2aa53c7e89dbcf64e2e33211a1ca3814a817
URL: 
https://github.com/kamailio/kamailio/commit/2deb2aa53c7e89dbcf64e2e33211a1ca3814a817

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2019-05-23T11:38:44+02:00

misc/examples/kemi: added python3 and ruby as options to basic example

---

Modified: misc/examples/kemi/kamailio-basic-kemi.cfg

---

Diff:  
https://github.com/kamailio/kamailio/commit/2deb2aa53c7e89dbcf64e2e33211a1ca3814a817.diff
Patch: 
https://github.com/kamailio/kamailio/commit/2deb2aa53c7e89dbcf64e2e33211a1ca3814a817.patch

---

diff --git a/misc/examples/kemi/kamailio-basic-kemi.cfg 
b/misc/examples/kemi/kamailio-basic-kemi.cfg
index 805d78c61e..c102fa7f9c 100644
--- a/misc/examples/kemi/kamailio-basic-kemi.cfg
+++ b/misc/examples/kemi/kamailio-basic-kemi.cfg
@@ -114,14 +114,32 @@ memlog=5
 log_prefix="LUA {$rm}: "
 #!else
 #!ifdef WITH_CFGPYTHON
-log_prefix="PYT {$rm}: "
+log_prefix="PY2 {$rm}: "
+#!else
+#!ifdef WITH_CFGPYTHON3
+log_prefix="PY3 {$rm}: "
+#!else
+#!ifdef WITH_CFGJSDT
+log_prefix="JSC {$rm}: "
+#!else
+#!ifdef WITH_CFGSQLANG
+log_prefix="SQL {$rm}: "
+#!else
+#!ifdef WITH_CFGJRUBY
+log_prefix="RUB {$rm}: "
 #!else
 log_prefix="NAT {$rm}: "
 #!endif
 #!endif
+#!endif
+#!endif
+#!endif
+#!endif
 
 latency_cfg_log=2
-
+latency_log=2
+latency_limit_action=10
+latency_limit_db=20
 log_facility=LOG_LOCAL0
 
 fork=yes
@@ -215,10 +233,18 @@ loadmodule "app_lua.so"
 loadmodule "app_python.so"
 #!endif
 
+#!ifdef WITH_CFGPYTHON3
+loadmodule "app_python3.so"
+#!endif
+
 #!ifdef WITH_CFGJSDT
 loadmodule "app_jsdt.so"
 #!endif
 
+#!ifdef WITH_CFGRUBY
+loadmodule "app_ruby.so"
+#!endif
+
 #!ifdef WITH_CFGSQLANG
 loadmodule "app_sqlang.so"
 #!endif
@@ -355,12 +381,16 @@ modparam("htable", "htable", 
"ipban=>size=8;autoexpire=300;")
 #!endif
 
 #!ifdef WITH_CFGPYTHON
-modparam("app_python", "script_name", 
"/usr/local/etc/kamailio/kamailio-basic-kemi-python.py")
+modparam("app_python", "load", 
"/usr/local/etc/kamailio/kamailio-basic-kemi-python.py")
+cfgengine "python"
+#!else
+
+#!ifdef WITH_CFGPYTHON3
+modparam("app_python3", "load", 
"/usr/local/etc/kamailio/kamailio-basic-kemi-python.py")
 cfgengine "python"
 #!else
 
 #!ifdef WITH_CFGLUA
-modparam("app_lua", "reload", 1)
 modparam("app_lua", "load", 
"/usr/local/etc/kamailio/kamailio-basic-kemi-lua.lua")
 cfgengine "lua"
 #!else
@@ -369,10 +399,16 @@ cfgengine "lua"
 modparam("app_jsdt", "load", 
"/usr/local/etc/kamailio/kamailio-basic-kemi-jsdt.js")
 cfgengine "jsdt"
 #!else
+
 #!ifdef WITH_CFGSQLANG
 modparam("app_sqlang", "load", 
"/usr/local/etc/kamailio/kamailio-basic-kemi-sqlang.sq")
 cfgengine "sqlang"
 #!else
+
+#!ifdef WITH_CFGRUBY
+modparam("app_ruby", "load", 
"/usr/local/etc/kamailio/kamailio-basic-kemi-ruby.rb")
+cfgengine "sqlang"
+#!else
 cfgengine "native"
 include_file "/usr/local/etc/kamailio/kamailio-basic-kemi-native.cfg"
 #!endif
@@ -383,3 +419,6 @@ include_file 
"/usr/local/etc/kamailio/kamailio-basic-kemi-native.cfg"
 
 #!endif
 
+#!endif
+
+#!endif


___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:83030746: app_lua: set reload parameter to 0 value if given via modparam

2019-05-23 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: 830307467ec5c9dddce1e27d8e93f88ddf9a39b7
URL: 
https://github.com/kamailio/kamailio/commit/830307467ec5c9dddce1e27d8e93f88ddf9a39b7

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2019-05-23T11:37:45+02:00

app_lua: set reload parameter to 0 value if given via modparam

---

Modified: src/modules/app_lua/app_lua_api.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/830307467ec5c9dddce1e27d8e93f88ddf9a39b7.diff
Patch: 
https://github.com/kamailio/kamailio/commit/830307467ec5c9dddce1e27d8e93f88ddf9a39b7.patch

---

diff --git a/src/modules/app_lua/app_lua_api.c 
b/src/modules/app_lua/app_lua_api.c
index 68e079d648..16319d1d05 100644
--- a/src/modules/app_lua/app_lua_api.c
+++ b/src/modules/app_lua/app_lua_api.c
@@ -171,6 +171,9 @@ int sr_lua_reload_module(unsigned int reload)
if(reload!=0) {
_app_lua_sr_reload = 1;
LM_DBG("reload param activated!\n");
+   } else {
+   _app_lua_sr_reload = 0;
+   LM_DBG("reload param inactivated!\n");
}
return 0;
 }


___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:fa8fd1e1: app_jsdt: handle functions that return xval and have up to two params

2019-05-23 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: fa8fd1e1ce6ac55aacbda9c573c04d291fd04b35
URL: 
https://github.com/kamailio/kamailio/commit/fa8fd1e1ce6ac55aacbda9c573c04d291fd04b35

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2019-05-23T10:51:33+02:00

app_jsdt: handle functions that return xval and have up to two params

---

Modified: src/modules/app_jsdt/app_jsdt_api.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/fa8fd1e1ce6ac55aacbda9c573c04d291fd04b35.diff
Patch: 
https://github.com/kamailio/kamailio/commit/fa8fd1e1ce6ac55aacbda9c573c04d291fd04b35.patch


___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:e1f1db6d: app_jsdt: removed local implementation for KSR.pv sub-module

2019-05-23 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: e1f1db6dbe3b61bd062205682ddeb75cbba6f145
URL: 
https://github.com/kamailio/kamailio/commit/e1f1db6dbe3b61bd062205682ddeb75cbba6f145

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2019-05-23T11:21:47+02:00

app_jsdt: removed local implementation for KSR.pv sub-module

- switch to use the one from core

---

Modified: src/modules/app_jsdt/app_jsdt_api.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/e1f1db6dbe3b61bd062205682ddeb75cbba6f145.diff
Patch: 
https://github.com/kamailio/kamailio/commit/e1f1db6dbe3b61bd062205682ddeb75cbba6f145.patch


___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:beb80c94: core: kemi - prototypes for functions returning xval with up to two params

2019-05-23 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: beb80c948d0a5afc097bd4a5d9701907d553407f
URL: 
https://github.com/kamailio/kamailio/commit/beb80c948d0a5afc097bd4a5d9701907d553407f

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2019-05-23T10:49:50+02:00

core: kemi - prototypes for functions returning xval with up to two params

---

Modified: src/core/kemi.h

---

Diff:  
https://github.com/kamailio/kamailio/commit/beb80c948d0a5afc097bd4a5d9701907d553407f.diff
Patch: 
https://github.com/kamailio/kamailio/commit/beb80c948d0a5afc097bd4a5d9701907d553407f.patch

---

diff --git a/src/core/kemi.h b/src/core/kemi.h
index 834d393ac8..5abba44b1e 100644
--- a/src/core/kemi.h
+++ b/src/core/kemi.h
@@ -152,6 +152,19 @@ typedef int (*sr_kemi_fmn_f)(sip_msg_t*, int, int, 
int, int, int);
 /* sip_msg_t and six int|str params */
 typedef int (*sr_kemi_fmss_f)(sip_msg_t*, str*, str*, str*, str*, str*, 
str*);
 
+/* return xval, params only sip_msg_t */
+typedef sr_kemi_xval_t* (*sr_kemi_xfm_f)(sip_msg_t*);
+
+/* return xval, params sip_msg_t and one int|str param */
+typedef sr_kemi_xval_t* (*sr_kemi_xfmn_f)(sip_msg_t*, int);
+typedef sr_kemi_xval_t* (*sr_kemi_xfms_f)(sip_msg_t*, str*);
+
+/* return xval, params sip_msg_t and two int|str params */
+typedef sr_kemi_xval_t* (*sr_kemi_xfmnn_f)(sip_msg_t*, int, int);
+typedef sr_kemi_xval_t* (*sr_kemi_xfmns_f)(sip_msg_t*, int, str*);
+typedef sr_kemi_xval_t* (*sr_kemi_xfmsn_f)(sip_msg_t*, str*, int);
+typedef sr_kemi_xval_t* (*sr_kemi_xfmss_f)(sip_msg_t*, str*, str*);
+
 sr_kemi_t* sr_kemi_lookup(str *mname, int midx, str *fname);
 
 int sr_kemi_modules_add(sr_kemi_t *klist);


___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] [kamailio/kamailio] ims_registrar_pcscf: parse security verify header (#1964)

2019-05-23 Thread alexyosifov
- Parse 'security verify' header from REGISTER request message
  and save updated parameters into the database.
- Added debug messages in save_pendign and save for easy debugging.





 Pre-Submission Checklist



- [ ] Commit message has the format required by CONTRIBUTING guide
- [ ] Commits are split per component (core, individual modules, libs, utils, 
...)
- [ ] Each component has a single commit (if not, squash them into one commit)
- [ ] No commits to README files for modules (changes must be done to docbook 
files
in `doc/` subfolder, the README file is autogenerated)

 Type Of Change
- [ ] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)

 Checklist:

- [ ] PR should be backported to stable branches
- [ ] Tested changes locally
- [ ] Related to issue # (replace  with an open issue number)

 Description


You can view, comment on, or merge this pull request online at:

  https://github.com/kamailio/kamailio/pull/1964

-- Commit Summary --

  * ims_registrar_pcscf: parse security verify header

-- File Changes --

M src/modules/ims_registrar_pcscf/save.c (24)
M src/modules/ims_registrar_pcscf/sec_agree.c (66)
M src/modules/ims_registrar_pcscf/sec_agree.h (8)

-- Patch Links --

https://github.com/kamailio/kamailio/pull/1964.patch
https://github.com/kamailio/kamailio/pull/1964.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1964
___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] siptrace: use xavps to pass data for the duration of transaction/dialog (#1963)

2019-05-23 Thread Ionut Ionita
I saw SR_XTYPE_DATA(if i'm not wrong) which gives you the possibility to have a 
free function but didn't use it because of the following:
* for transactions - no avps is used pointer is passed only using tm callbacks;
* for dialogs - as you're saying, dialog lifetime >> tranasaction, so i'm using 
DLGCB_TERMINATED free function to free the pointer; i'm using the avps only to 
pass data from sip_trace function to DLGCB_CREATED; 

I tested the code against leaks for the following scenarions: successfull call, 
kamailio generated dual bye, INVITE failed with 491 and CANCEL scenario. There 
are no leaks. If you have other scenarios in mind I'll be glad to try them out.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1963#issuecomment-495119647___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] siptrace: use xavps to pass data for the duration of transaction/dialog (#1963)

2019-05-23 Thread Ionut Ionita
@ionutionita92 pushed 1 commit.

fdc627fc0229b6a3ca84fdbdc81823d6108c4f99  siptrace: avoid flooding logs with 
unnecessary errors on common scenarios


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/kamailio/kamailio/pull/1963/files/df349aad7db5613d0d06779b3196b447b44e41fa..fdc627fc0229b6a3ca84fdbdc81823d6108c4f99
___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:714adde1: core: xavp - updated comments about vptr filed

2019-05-23 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: 714adde1fc42cd4adc76d22b7fa028179ff6cb18
URL: 
https://github.com/kamailio/kamailio/commit/714adde1fc42cd4adc76d22b7fa028179ff6cb18

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2019-05-23T10:01:14+02:00

core: xavp - updated comments about vptr filed

---

Modified: src/core/xavp.h

---

Diff:  
https://github.com/kamailio/kamailio/commit/714adde1fc42cd4adc76d22b7fa028179ff6cb18.diff
Patch: 
https://github.com/kamailio/kamailio/commit/714adde1fc42cd4adc76d22b7fa028179ff6cb18.patch

---

diff --git a/src/core/xavp.h b/src/core/xavp.h
index 84af5ad182..071a421a4a 100644
--- a/src/core/xavp.h
+++ b/src/core/xavp.h
@@ -57,7 +57,7 @@ typedef struct _sr_xval {
long l;
long long ll;
struct _sr_xavp *xavp; /* must be given in shm (not cloned) */
-   void *vptr;/* void pointer - address copied, not 
freed */
+   void *vptr;/* void pointer - see SR_XTYPE_VPTR, 
SR_XTYPE_SPTR */
sr_data_t *data;   /* must be given in shm (not cloned) */
} v;
 } sr_xval_t;


___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] [kamailio/kamailio] siptrace: use xavps to pass data for the duration of transaction/dialog (#1963)

2019-05-23 Thread Daniel-Constantin Mierla
The type SR_XTYPE_VPTR is not resulting in freeing the pointer when XAVP is 
destroyed, it was added to keep references to permanent structures kept in 
memory during runtime.

So I just added (commit 126cfa51be8718082e20e268cf14d0649c60b17d) the new type 
SR_XTYPE_SPTR which does a shm_free() on the pointer when the XAVP is destroyed.

If trace info struct is stored permanently in shared memory during Kamailio 
runtime, then SR_XTYPE_VPTR is ok, otherwise the patch needs to be updated to 
set SR_XTYPE_SPTR.

One more remark -- for tracking the dialog, if the trace info struct is not 
permanent, but destroyed with the XAVP, be sure you don't pass that pointer to 
dlg callbacks, because the life of XAVP is as long as transaction exist, but 
the dialog is taking longer.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1963#issuecomment-495110647___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


[sr-dev] git:master:126cfa51: core: xvavp - new data type SR_XTYPE_SPTR

2019-05-23 Thread Daniel-Constantin Mierla
Module: kamailio
Branch: master
Commit: 126cfa51be8718082e20e268cf14d0649c60b17d
URL: 
https://github.com/kamailio/kamailio/commit/126cfa51be8718082e20e268cf14d0649c60b17d

Author: Daniel-Constantin Mierla 
Committer: Daniel-Constantin Mierla 
Date: 2019-05-23T09:30:51+02:00

core: xvavp - new data type SR_XTYPE_SPTR

- store a shm pointer that has to be freed at destroy with shm_free()

---

Modified: src/core/xavp.c
Modified: src/core/xavp.h

---

Diff:  
https://github.com/kamailio/kamailio/commit/126cfa51be8718082e20e268cf14d0649c60b17d.diff
Patch: 
https://github.com/kamailio/kamailio/commit/126cfa51be8718082e20e268cf14d0649c60b17d.patch

---

diff --git a/src/core/xavp.c b/src/core/xavp.c
index f9b0fd627f..b3a2654764 100644
--- a/src/core/xavp.c
+++ b/src/core/xavp.c
@@ -57,6 +57,10 @@ void xavp_free(sr_xavp_t *xa)
xa->val.v.data->pfree(xa->val.v.data->p, xavp_shm_free);
shm_free(xa->val.v.data);
}
+   } else if(xa->val.type == SR_XTYPE_SPTR) {
+   if(xa->val.v.vptr) {
+   shm_free(xa->val.v.vptr);
+   }
} else if(xa->val.type == SR_XTYPE_XAVP) {
xavp_destroy_list(>val.v.xavp);
}
@@ -70,6 +74,10 @@ void xavp_free_unsafe(sr_xavp_t *xa)
xa->val.v.data->pfree(xa->val.v.data->p, 
xavp_shm_free_unsafe);
shm_free_unsafe(xa->val.v.data);
}
+   } else if(xa->val.type == SR_XTYPE_SPTR) {
+   if(xa->val.v.vptr) {
+   shm_free_unsafe(xa->val.v.vptr);
+   }
} else if(xa->val.type == SR_XTYPE_XAVP) {
xavp_destroy_list_unsafe(>val.v.xavp);
}
@@ -588,6 +596,9 @@ void xavp_print_list_content(sr_xavp_t **head, int level)
case SR_XTYPE_VPTR:
LM_INFO(" XAVP value: \n", 
avp->val.v.vptr);
break;
+   case SR_XTYPE_SPTR:
+   LM_INFO(" XAVP value: \n", 
avp->val.v.vptr);
+   break;
case SR_XTYPE_DATA:
LM_INFO(" XAVP value: \n", 
avp->val.v.data);
break;
@@ -697,7 +708,7 @@ sr_xavp_t *xavp_clone_level_nodata(sr_xavp_t *xold)
{
return NULL;
}
-   if(xold->val.type==SR_XTYPE_DATA)
+   if(xold->val.type==SR_XTYPE_DATA || xold->val.type==SR_XTYPE_SPTR)
{
LM_INFO("xavp value type is 'data' - ignoring in clone\n");
return NULL;
@@ -720,7 +731,8 @@ sr_xavp_t *xavp_clone_level_nodata(sr_xavp_t *xold)
 
while(oavp)
{
-   if(oavp->val.type!=SR_XTYPE_DATA && 
oavp->val.type!=SR_XTYPE_XAVP)
+   if(oavp->val.type!=SR_XTYPE_DATA && 
oavp->val.type!=SR_XTYPE_XAVP
+   && oavp->val.type!=SR_XTYPE_SPTR)
{
navp =  xavp_new_value(>name, >val);
if(navp==NULL)
diff --git a/src/core/xavp.h b/src/core/xavp.h
index 4f440ea612..84af5ad182 100644
--- a/src/core/xavp.h
+++ b/src/core/xavp.h
@@ -33,7 +33,8 @@ typedef enum {
SR_XTYPE_LONG,/* long value */
SR_XTYPE_LLONG,   /* long long value */
SR_XTYPE_XAVP,/* xavp value */
-   SR_XTYPE_VPTR,/* void pointer value */
+   SR_XTYPE_VPTR,/* void pointer value (no free on destroy) */
+   SR_XTYPE_SPTR,/* void pointer value (shm free on destroy) */
SR_XTYPE_DATA /* custom data value */
 } sr_xtype_t;
 


___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


Re: [sr-dev] Generating TCP traffic via TM module's C API

2019-05-23 Thread Ivan Ribakov
Bump

> On 21 May 2019, at 17:33, Ivan Ribakov  wrote:
> 
> Hi,
> 
> I’ve been using TM module’s C API (tm_load..h -> struct tm_binds -> 
> t_request_outside()) for some time now to generate new requests from custom 
> module’s C code. What I haven’t come across so far is any type of switch to 
> generate TCP traffic. Is it supported? If so, how can that be controlled? Via 
> transport URI parameter perhaps?
> 
> Thanks in advance!
> 
> Regards,
> Ivan


___
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev