kamailio.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
List overview
Download
sr-dev
May 2019
----- 2024 -----
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
sr-dev@lists.kamailio.org
29 participants
306 discussions
Start a n
N
ew thread
git:5.2:c19ab2e8: app_python3: use PyBytes_AS_STRING() instead of PyString_AsString()
by Daniel-Constantin Mierla
Module: kamailio Branch: 5.2 Commit: c19ab2e81ed68379b58df60005f954fe8112ceba URL:
https://github.com/kamailio/kamailio/commit/c19ab2e81ed68379b58df60005f954f…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2019-05-03T10:30:56+02:00 app_python3: use PyBytes_AS_STRING() instead of PyString_AsString() - PyString_AsString() is no longer in Python3 API (cherry picked from commit 48bb059d8ff9b009d3c8afda83e0c964ab604d5a) --- Modified: src/modules/app_python3/apy_kemi.c --- Diff:
https://github.com/kamailio/kamailio/commit/c19ab2e81ed68379b58df60005f954f…
Patch:
https://github.com/kamailio/kamailio/commit/c19ab2e81ed68379b58df60005f954f…
--- diff --git a/src/modules/app_python3/apy_kemi.c b/src/modules/app_python3/apy_kemi.c index 78e5194914..15820cafd0 100755 --- a/src/modules/app_python3/apy_kemi.c +++ b/src/modules/app_python3/apy_kemi.c @@ -777,8 +777,8 @@ PyObject *sr_apy_kemi_exec_func(PyObject *self, PyObject *args, int idx) " took too long [%u ms] (file:%s func:%s line:%d)\n", (ket->mname.len>0)?ket->mname.s:"", (ket->mname.len>0)?".":"", ket->fname.s, tdiff, - (pframe)?PyString_AsString(pframe->f_code->co_filename):"", - (pframe)?PyString_AsString(pframe->f_code->co_name):"", + (pframe)?PyBytes_AS_STRING(pframe->f_code->co_filename):"", + (pframe)?PyBytes_AS_STRING(pframe->f_code->co_name):"", (pframe)?PyCode_Addr2Line(pframe->f_code, pframe->f_lasti):0); } }
5 years, 6 months
1
0
0
0
git:master:48bb059d: app_python3: use PyBytes_AS_STRING() instead of PyString_AsString()
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: 48bb059d8ff9b009d3c8afda83e0c964ab604d5a URL:
https://github.com/kamailio/kamailio/commit/48bb059d8ff9b009d3c8afda83e0c96…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2019-05-03T10:28:18+02:00 app_python3: use PyBytes_AS_STRING() instead of PyString_AsString() - PyString_AsString() is no longer in Python3 API --- Modified: src/modules/app_python3/apy_kemi.c --- Diff:
https://github.com/kamailio/kamailio/commit/48bb059d8ff9b009d3c8afda83e0c96…
Patch:
https://github.com/kamailio/kamailio/commit/48bb059d8ff9b009d3c8afda83e0c96…
--- diff --git a/src/modules/app_python3/apy_kemi.c b/src/modules/app_python3/apy_kemi.c index b01ac53890..7a93e7ca98 100755 --- a/src/modules/app_python3/apy_kemi.c +++ b/src/modules/app_python3/apy_kemi.c @@ -777,8 +777,8 @@ PyObject *sr_apy_kemi_exec_func(PyObject *self, PyObject *args, int idx) " took too long [%u ms] (file:%s func:%s line:%d)\n", (ket->mname.len>0)?ket->mname.s:"", (ket->mname.len>0)?".":"", ket->fname.s, tdiff, - (pframe)?PyString_AsString(pframe->f_code->co_filename):"", - (pframe)?PyString_AsString(pframe->f_code->co_name):"", + (pframe)?PyBytes_AS_STRING(pframe->f_code->co_filename):"", + (pframe)?PyBytes_AS_STRING(pframe->f_code->co_name):"", (pframe)?PyCode_Addr2Line(pframe->f_code, pframe->f_lasti):0); } }
5 years, 6 months
1
0
0
0
git:5.2:8dcb2442: app_python3: proper cast for ssiis function execution
by Daniel-Constantin Mierla
Module: kamailio Branch: 5.2 Commit: 8dcb244225aa93554e5de6272420dc5cbec84ee1 URL:
https://github.com/kamailio/kamailio/commit/8dcb244225aa93554e5de6272420dc5…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2019-05-03T09:38:37+02:00 app_python3: proper cast for ssiis function execution --- Modified: src/modules/app_python3/apy_kemi.c --- Diff:
https://github.com/kamailio/kamailio/commit/8dcb244225aa93554e5de6272420dc5…
Patch:
https://github.com/kamailio/kamailio/commit/8dcb244225aa93554e5de6272420dc5…
--- diff --git a/src/modules/app_python3/apy_kemi.c b/src/modules/app_python3/apy_kemi.c index cee8e6037f..78e5194914 100755 --- a/src/modules/app_python3/apy_kemi.c +++ b/src/modules/app_python3/apy_kemi.c @@ -701,8 +701,8 @@ PyObject *sr_apy_kemi_exec_func_ex(sr_kemi_t *ket, PyObject *self, PyObject *arg && ket->ptypes[2]==SR_KEMIP_INT && ket->ptypes[3]==SR_KEMIP_INT && ket->ptypes[4]==SR_KEMIP_STR) { - /* sssss */ - ret = ((sr_kemi_fmsssss_f)(ket->func))(lmsg, + /* ssnns */ + ret = ((sr_kemi_fmssnns_f)(ket->func))(lmsg, &vps[0].s, &vps[1].s, vps[2].n, vps[3].n, &vps[4].s); return sr_kemi_apy_return_int(ket, ret);
5 years, 6 months
1
0
0
0
git:5.2:babd8c28: app_python: handle kemi sssi parameters
by Daniel-Constantin Mierla
Module: kamailio Branch: 5.2 Commit: babd8c28b27a2f4154ca3997b04d181f019c82c8 URL:
https://github.com/kamailio/kamailio/commit/babd8c28b27a2f4154ca3997b04d181…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2019-05-03T09:37:04+02:00 app_python: handle kemi sssi parameters (cherry picked from commit a36f2c050ff607b5f3c08b7fc8ed01e082e91dc8) --- Modified: src/modules/app_python/apy_kemi.c --- Diff:
https://github.com/kamailio/kamailio/commit/babd8c28b27a2f4154ca3997b04d181…
Patch:
https://github.com/kamailio/kamailio/commit/babd8c28b27a2f4154ca3997b04d181…
--- diff --git a/src/modules/app_python/apy_kemi.c b/src/modules/app_python/apy_kemi.c index d9d2cf08d7..d621eae774 100644 --- a/src/modules/app_python/apy_kemi.c +++ b/src/modules/app_python/apy_kemi.c @@ -351,6 +351,22 @@ PyObject *sr_apy_kemi_exec_func_ex(sr_kemi_t *ket, PyObject *self, fname.len, fname.s, vps[0].s.len, vps[0].s.s, vps[1].s.len, vps[1].s.s, vps[2].s.len, vps[2].s.s, vps[3].s.len, vps[3].s.s); + } else if(ket->ptypes[0]==SR_KEMIP_STR + && ket->ptypes[1]==SR_KEMIP_STR + && ket->ptypes[2]==SR_KEMIP_STR + && ket->ptypes[3]==SR_KEMIP_INT) { + if(!PyArg_ParseTuple(args, "sssi:kemi-param-sssn", + &vps[0].s.s, &vps[1].s.s, &vps[2].s.s, &vps[3].n)) { + LM_ERR("unable to retrieve str-str-int-int params %d\n", i); + return sr_kemi_apy_return_false(); + } + vps[0].s.len = strlen(vps[0].s.s); + vps[1].s.len = strlen(vps[1].s.s); + vps[2].s.len = strlen(vps[2].s.s); + LM_DBG("params[%d] for: %.*s are str: [%.*s] [%.*s]" + " [%.*s] [%d]\n", i, + fname.len, fname.s, vps[0].s.len, vps[0].s.s, + vps[1].s.len, vps[1].s.s, vps[2].s.len, vps[2].s.s, vps[3].n); } else if(ket->ptypes[0]==SR_KEMIP_STR && ket->ptypes[1]==SR_KEMIP_STR && ket->ptypes[2]==SR_KEMIP_INT
5 years, 6 months
1
0
0
0
git:5.2:63185483: core: kemi - define for function type with (str*, str*, int, int, str*) params
by Daniel-Constantin Mierla
Module: kamailio Branch: 5.2 Commit: 63185483ae8f13e7199c9eedd30d0794a1598a05 URL:
https://github.com/kamailio/kamailio/commit/63185483ae8f13e7199c9eedd30d079…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2019-05-03T09:36:51+02:00 core: kemi - define for function type with (str*, str*, int, int, str*) params (cherry picked from commit a23f98c1751fffb80463ea61c4de76f62f8dbb6f) --- Modified: src/core/kemi.h --- Diff:
https://github.com/kamailio/kamailio/commit/63185483ae8f13e7199c9eedd30d079…
Patch:
https://github.com/kamailio/kamailio/commit/63185483ae8f13e7199c9eedd30d079…
--- diff --git a/src/core/kemi.h b/src/core/kemi.h index 96ecf98cd2..5d3c84ebb7 100644 --- a/src/core/kemi.h +++ b/src/core/kemi.h @@ -108,6 +108,7 @@ typedef int (*sr_kemi_fmssss_f)(sip_msg_t*, str*, str*, str*, str*); /* sip_msg_t and five int|str params */ typedef int (*sr_kemi_fmsssss_f)(sip_msg_t*, str*, str*, str*, str*, str*); +typedef int (*sr_kemi_fmssnns_f)(sip_msg_t*, str*, str*, int, int, str*); /* sip_msg_t and six int|str params */ typedef int (*sr_kemi_fmssssss_f)(sip_msg_t*, str*, str*, str*, str*, str*, str*);
5 years, 6 months
1
0
0
0
git:5.2:42117d15: apy_python: fixed condition in matching parameter types
by Daniel-Constantin Mierla
Module: kamailio Branch: 5.2 Commit: 42117d15568025c5604f5aa82d47deec5f996b5a URL:
https://github.com/kamailio/kamailio/commit/42117d15568025c5604f5aa82d47dee…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2019-05-03T09:35:06+02:00 apy_python: fixed condition in matching parameter types - GH #1944 (cherry picked from commit cbec7f92213de1ff096ea00c5a7a3b6354f7ede9) --- Modified: src/modules/app_python/apy_kemi.c --- Diff:
https://github.com/kamailio/kamailio/commit/42117d15568025c5604f5aa82d47dee…
Patch:
https://github.com/kamailio/kamailio/commit/42117d15568025c5604f5aa82d47dee…
5 years, 6 months
1
0
0
0
git:5.2:c4018e1b: app_python3: handle kemi sssi parameters
by Daniel-Constantin Mierla
Module: kamailio Branch: 5.2 Commit: c4018e1bba7c84274c9bfa1d2380d39232e1de46 URL:
https://github.com/kamailio/kamailio/commit/c4018e1bba7c84274c9bfa1d2380d39…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2019-05-03T09:15:10+02:00 app_python3: handle kemi sssi parameters (cherry picked from commit 6bc7853a114fb000744cba3a43f346f71e640452) --- Modified: src/modules/app_python3/apy_kemi.c --- Diff:
https://github.com/kamailio/kamailio/commit/c4018e1bba7c84274c9bfa1d2380d39…
Patch:
https://github.com/kamailio/kamailio/commit/c4018e1bba7c84274c9bfa1d2380d39…
--- diff --git a/src/modules/app_python3/apy_kemi.c b/src/modules/app_python3/apy_kemi.c index 0b78c29107..cee8e6037f 100755 --- a/src/modules/app_python3/apy_kemi.c +++ b/src/modules/app_python3/apy_kemi.c @@ -358,6 +358,22 @@ PyObject *sr_apy_kemi_exec_func_ex(sr_kemi_t *ket, PyObject *self, PyObject *arg fname.len, fname.s, vps[0].s.len, vps[0].s.s, vps[1].s.len, vps[1].s.s, vps[2].s.len, vps[2].s.s, vps[3].s.len, vps[3].s.s); + } else if(ket->ptypes[0]==SR_KEMIP_STR + && ket->ptypes[1]==SR_KEMIP_STR + && ket->ptypes[2]==SR_KEMIP_STR + && ket->ptypes[3]==SR_KEMIP_INT) { + if(!PyArg_ParseTuple(args, "sssi:kemi-param-sssn", + &vps[0].s.s, &vps[1].s.s, &vps[2].s.s, &vps[3].n)) { + LM_ERR("unable to retrieve str-str-str-int params %d\n", i); + return sr_kemi_apy_return_false(); + } + vps[0].s.len = strlen(vps[0].s.s); + vps[1].s.len = strlen(vps[1].s.s); + vps[2].s.len = strlen(vps[2].s.s); + LM_DBG("params[%d] for: %.*s are str: [%.*s] [%.*s]" + " [%.*s] [%d]\n", i, + fname.len, fname.s, vps[0].s.len, vps[0].s.s, + vps[1].s.len, vps[1].s.s, vps[2].s.len, vps[2].s.s, vps[3].n); } else if(ket->ptypes[0]==SR_KEMIP_STR && ket->ptypes[1]==SR_KEMIP_STR && ket->ptypes[2]==SR_KEMIP_INT
5 years, 6 months
1
0
0
0
git:5.2:c4cda7ba: app_python3: fixed condition for function with siis params
by Daniel-Constantin Mierla
Module: kamailio Branch: 5.2 Commit: c4cda7ba406215ec8b84176ea533038770fd4485 URL:
https://github.com/kamailio/kamailio/commit/c4cda7ba406215ec8b84176ea533038…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2019-05-03T09:14:58+02:00 app_python3: fixed condition for function with siis params - GH #1944 (cherry picked from commit 5d5b9786d3cd765a9cf957e34d849fec34bf5e9f) --- Modified: src/modules/app_python3/apy_kemi.c --- Diff:
https://github.com/kamailio/kamailio/commit/c4cda7ba406215ec8b84176ea533038…
Patch:
https://github.com/kamailio/kamailio/commit/c4cda7ba406215ec8b84176ea533038…
--- diff --git a/src/modules/app_python3/apy_kemi.c b/src/modules/app_python3/apy_kemi.c index 32d99913a4..0b78c29107 100755 --- a/src/modules/app_python3/apy_kemi.c +++ b/src/modules/app_python3/apy_kemi.c @@ -415,6 +415,25 @@ PyObject *sr_apy_kemi_exec_func_ex(sr_kemi_t *ket, PyObject *self, PyObject *arg fname.len, fname.s, vps[0].s.len, vps[0].s.s, vps[1].s.len, vps[1].s.s, vps[2].s.len, vps[2].s.s, vps[3].s.len, vps[3].s.s, vps[4].s.len, vps[4].s.s); + } else if(ket->ptypes[0]==SR_KEMIP_STR + && ket->ptypes[1]==SR_KEMIP_STR + && ket->ptypes[2]==SR_KEMIP_INT + && ket->ptypes[3]==SR_KEMIP_INT + && ket->ptypes[4]==SR_KEMIP_STR) { + if(!PyArg_ParseTuple(args, "ssiis:kemi-param-ssnns", + &vps[0].s.s, &vps[1].s.s, &vps[2].n, &vps[3].n, + &vps[4].s.s)) { + LM_ERR("unable to retrieve str-str-int-int-str params %d\n", i); + return sr_kemi_apy_return_false(); + } + vps[0].s.len = strlen(vps[0].s.s); + vps[1].s.len = strlen(vps[1].s.s); + vps[4].s.len = strlen(vps[4].s.s); + LM_DBG("params[%d] for: %.*s are str: [%.*s] [%.*s]" + " [%d] [%d] [%.*s]\n", i, + fname.len, fname.s, vps[0].s.len, vps[0].s.s, + vps[1].s.len, vps[1].s.s, vps[2].n, vps[3].n, + vps[4].s.len, vps[4].s.s); } else { LM_ERR("not implemented yet\n"); return sr_kemi_apy_return_false(); @@ -661,6 +680,16 @@ PyObject *sr_apy_kemi_exec_func_ex(sr_kemi_t *ket, PyObject *self, PyObject *arg &vps[0].s, &vps[1].s, &vps[2].s, &vps[3].s, &vps[4].s); return sr_kemi_apy_return_int(ket, ret); + } else if(ket->ptypes[0]==SR_KEMIP_STR + && ket->ptypes[1]==SR_KEMIP_STR + && ket->ptypes[2]==SR_KEMIP_INT + && ket->ptypes[3]==SR_KEMIP_INT + && ket->ptypes[4]==SR_KEMIP_STR) { + /* sssss */ + ret = ((sr_kemi_fmsssss_f)(ket->func))(lmsg, + &vps[0].s, &vps[1].s, vps[2].n, vps[3].n, + &vps[4].s); + return sr_kemi_apy_return_int(ket, ret); } else { LM_ERR("invalid parameters for: %.*s\n", fname.len, fname.s);
5 years, 6 months
1
0
0
0
git:5.2:76908b45: app_python3: use system time to compute execution duration
by Daniel-Constantin Mierla
Module: kamailio Branch: 5.2 Commit: 76908b459b0ca65a4df0413726a1f465436ebc8c URL:
https://github.com/kamailio/kamailio/commit/76908b459b0ca65a4df0413726a1f46…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2019-05-03T09:11:22+02:00 app_python3: use system time to compute execution duration (cherry picked from commit 9af0f27f664a2514e1b471411a2b8c362763fccf) --- Modified: src/modules/app_python3/apy_kemi.c --- Diff:
https://github.com/kamailio/kamailio/commit/76908b459b0ca65a4df0413726a1f46…
Patch:
https://github.com/kamailio/kamailio/commit/76908b459b0ca65a4df0413726a1f46…
--- diff --git a/src/modules/app_python3/apy_kemi.c b/src/modules/app_python3/apy_kemi.c index b3812a6237..32d99913a4 100755 --- a/src/modules/app_python3/apy_kemi.c +++ b/src/modules/app_python3/apy_kemi.c @@ -699,24 +699,29 @@ PyObject *sr_apy_kemi_exec_func(PyObject *self, PyObject *args, int idx) { sr_kemi_t *ket = NULL; PyObject *ret = NULL; - unsigned int ms = 0; PyThreadState *pstate = NULL; PyFrameObject *pframe = NULL; + struct timeval tvb, tve; + struct timezone tz; + unsigned int tdiff; ket = sr_apy_kemi_export_get(idx); if(ket==NULL) { return sr_kemi_apy_return_false(); } - if(unlikely(cfg_get(core, core_cfg, latency_limit_action)>0)) { - ms = TICKS_TO_MS(get_ticks_raw()); + if(unlikely(cfg_get(core, core_cfg, latency_limit_action)>0) + && is_printable(cfg_get(core, core_cfg, latency_log))) { + gettimeofday(&tvb, &tz); } ret = sr_apy_kemi_exec_func_ex(ket, self, args, idx); - if(unlikely(cfg_get(core, core_cfg, latency_limit_action)>0)) { - ms = TICKS_TO_MS(get_ticks_raw()) - ms; - if(ms >= cfg_get(core, core_cfg, latency_limit_action) - && is_printable(cfg_get(core, core_cfg, latency_log))) { + if(unlikely(cfg_get(core, core_cfg, latency_limit_action)>0) + && is_printable(cfg_get(core, core_cfg, latency_log))) { + gettimeofday(&tve, &tz); + tdiff = (tve.tv_sec - tvb.tv_sec) * 1000000 + + (tve.tv_usec - tvb.tv_usec); + if(tdiff >= cfg_get(core, core_cfg, latency_limit_action)) { pstate = PyThreadState_GET(); if (pstate != NULL && pstate->frame != NULL) { pframe = pstate->frame; @@ -726,7 +731,7 @@ PyObject *sr_apy_kemi_exec_func(PyObject *self, PyObject *args, int idx) "alert - action KSR.%s%s%s(...)" " took too long [%u ms] (file:%s func:%s line:%d)\n", (ket->mname.len>0)?ket->mname.s:"", - (ket->mname.len>0)?".":"", ket->fname.s, ms, + (ket->mname.len>0)?".":"", ket->fname.s, tdiff, (pframe)?PyString_AsString(pframe->f_code->co_filename):"", (pframe)?PyString_AsString(pframe->f_code->co_name):"", (pframe)?PyCode_Addr2Line(pframe->f_code, pframe->f_lasti):0);
5 years, 6 months
1
0
0
0
git:5.2:562287f4: app_python3: execution log message based on core latency_limit_action
by Daniel-Constantin Mierla
Module: kamailio Branch: 5.2 Commit: 562287f4c43e1dc8b1a0ff74f76a80118df06508 URL:
https://github.com/kamailio/kamailio/commit/562287f4c43e1dc8b1a0ff74f76a801…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2019-05-03T09:11:14+02:00 app_python3: execution log message based on core latency_limit_action (cherry picked from commit cce69dad4682c8bdc4085fe1513dece44643bd9c) --- Modified: src/modules/app_python3/apy_kemi.c --- Diff:
https://github.com/kamailio/kamailio/commit/562287f4c43e1dc8b1a0ff74f76a801…
Patch:
https://github.com/kamailio/kamailio/commit/562287f4c43e1dc8b1a0ff74f76a801…
--- diff --git a/src/modules/app_python3/apy_kemi.c b/src/modules/app_python3/apy_kemi.c index 9f78e53089..b3812a6237 100755 --- a/src/modules/app_python3/apy_kemi.c +++ b/src/modules/app_python3/apy_kemi.c @@ -23,6 +23,7 @@ #include <stdlib.h> #include <Python.h> +#include <frameobject.h> #include "../../core/dprint.h" #include "../../core/route.h" @@ -30,6 +31,7 @@ #include "../../core/kemi.h" #include "../../core/locking.h" #include "../../core/pvar.h" +#include "../../core/timer.h" #include "../../core/mem/pkg.h" #include "../../core/mem/shm.h" #include "../../core/rpc.h" @@ -166,12 +168,11 @@ PyObject *sr_apy_kemi_return_str(sr_kemi_t *ket, char *sval, int slen) /** * */ -PyObject *sr_apy_kemi_exec_func(PyObject *self, PyObject *args, int idx) +PyObject *sr_apy_kemi_exec_func_ex(sr_kemi_t *ket, PyObject *self, PyObject *args, int idx) { str fname; int i; int ret; - sr_kemi_t *ket = NULL; sr_kemi_val_t vps[SR_KEMI_PARAMS_MAX]; sr_apy_env_t *env_P; sip_msg_t *lmsg = NULL; @@ -188,10 +189,6 @@ PyObject *sr_apy_kemi_exec_func(PyObject *self, PyObject *args, int idx) lmsg = env_P->msg; } - ket = sr_apy_kemi_export_get(idx); - if(ket==NULL) { - return sr_kemi_apy_return_false(); - } if(ket->mname.len>0) { LM_DBG("execution of method: %.*s\n", ket->fname.len, ket->fname.s); } else { @@ -695,6 +692,50 @@ PyObject *sr_apy_kemi_exec_func(PyObject *self, PyObject *args, int idx) } } +/** + * + */ +PyObject *sr_apy_kemi_exec_func(PyObject *self, PyObject *args, int idx) +{ + sr_kemi_t *ket = NULL; + PyObject *ret = NULL; + unsigned int ms = 0; + PyThreadState *pstate = NULL; + PyFrameObject *pframe = NULL; + + ket = sr_apy_kemi_export_get(idx); + if(ket==NULL) { + return sr_kemi_apy_return_false(); + } + if(unlikely(cfg_get(core, core_cfg, latency_limit_action)>0)) { + ms = TICKS_TO_MS(get_ticks_raw()); + } + + ret = sr_apy_kemi_exec_func_ex(ket, self, args, idx); + + if(unlikely(cfg_get(core, core_cfg, latency_limit_action)>0)) { + ms = TICKS_TO_MS(get_ticks_raw()) - ms; + if(ms >= cfg_get(core, core_cfg, latency_limit_action) + && is_printable(cfg_get(core, core_cfg, latency_log))) { + pstate = PyThreadState_GET(); + if (pstate != NULL && pstate->frame != NULL) { + pframe = pstate->frame; + } + + LOG(cfg_get(core, core_cfg, latency_log), + "alert - action KSR.%s%s%s(...)" + " took too long [%u ms] (file:%s func:%s line:%d)\n", + (ket->mname.len>0)?ket->mname.s:"", + (ket->mname.len>0)?".":"", ket->fname.s, ms, + (pframe)?PyString_AsString(pframe->f_code->co_filename):"", + (pframe)?PyString_AsString(pframe->f_code->co_name):"", + (pframe)?PyCode_Addr2Line(pframe->f_code, pframe->f_lasti):0); + } + } + + return ret; +} + /** * */
5 years, 6 months
1
0
0
0
← Newer
1
...
27
28
29
30
31
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Results per page:
10
25
50
100
200