[sr-dev] Re: [kamailio/kamailio] ipops: Add PTR query support (PR #3802)
@oej commented on this pull request. You're doing good. Just a few small nits after reading it again. > @@ -883,6 +883,57 @@ if(dns_query("test.com", "xyz")) + + +ptr_query(ip, pvid) + + + + Store the hostname that correspond to ip s/ip/an IP address/ Also document if you support both IPv4 and IPv6 clearly. Thanks! > @@ -883,6 +883,57 @@ if(dns_query("test.com", "xyz")) + + +ptr_query(ip, pvid) + + + + Store the hostname that correspond to ip + in a config variable $ptrquery(pvid=>hostname). You mean a "pseudo variable" not a config variable. > + +ptr_query(ip, pvid) + + + + Store the hostname that correspond to ip + in a config variable $ptrquery(pvid=>hostname). + + + Parameters: + + + + + ip - string or pseudo-variable containing the ip. + The resulting IP addresses from DNS query are compared with ipaddr. In line 901 you just say "ip" and here "ipaddr". I suggest you write clear text on both cases. Like "containing the IP address" and "compared with the IP address" > + Store the hostname that correspond to ip + in a config variable $ptrquery(pvid=>hostname). + + + Parameters: + + + + + ip - string or pseudo-variable containing the ip. + The resulting IP addresses from DNS query are compared with ipaddr. + + + + +pvid - container id for script variable. I don't think we call a pseudo variable a "container" anywhere. If so, I consider it a bug :-) > @@ -418,6 +413,91 @@ int dns_update_pv(str *hostname, str *name) return 1; } +/* +* Add a comment here > @@ -24,13 +24,46 @@ #define _IPOPS_PV_H_ #include "../../core/pvar.h" +#define PV_DNS_ADDR 64 +#define PV_DNS_RECS 32 +#define SR_DNS_PVIDX 1 + +typedef struct _sr_dns_record +{ + int type; + char addr[PV_DNS_ADDR]; +} sr_dns_record_t; +typedef struct _sr_dns_item Empty line missing > +/** + * + */ +static int w_ptr_query(sip_msg_t *msg, char *ip, char *pv_name) +{ + str ip_address; + str name; + + if(msg == NULL) { + LM_ERR("received null msg\n"); + return -1; + } + + if(fixup_get_svalue(msg, (gparam_t *)ip, &ip_address) < 0) { + LM_ERR("cannot get the IP address\n"); + return -1; Depends if you think there's any point of separating the various errors from each other in the script of if it doesn't matter - the coder just want to know that it failed, not caring about how. There are several functions in other modules, like TM, that has multiple return values. It's really up to you, just a suggestion that you consider this. -- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/3802#pullrequestreview-1975734865 You are receiving this because you are subscribed to this thread. Message ID: ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] Re: [kamailio/kamailio] ipops: Add PTR query support (PR #3802)
@henningw commented on this pull request. > + Store the hostname that correspond to ip + in a config variable $ptrquery(pvid=>hostname). + + + Parameters: + + + + + ip - string or pseudo-variable containing the ip. + The resulting IP addresses from DNS query are compared with ipaddr. + + + + +pvid - container id for script variable. Actually the module uses already the term "container" in 3 places. So its probably fine in this regards. -- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/3802#discussion_r1549081138 You are receiving this because you are subscribed to this thread. Message ID: ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] Re: [kamailio/kamailio] ipops: Add PTR query support (PR #3802)
@henningw commented on this pull request. > @@ -883,6 +883,57 @@ if(dns_query("test.com", "xyz")) + + +ptr_query(ip, pvid) + + + + Store the hostname that correspond to ip + in a config variable $ptrquery(pvid=>hostname). The term "config variable" is also already used in the module, but I agree its probably more clear to spell it explictly. -- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/3802#discussion_r1549082716 You are receiving this because you are subscribed to this thread. Message ID: ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] Re: [kamailio/kamailio] ipops: Add PTR query support (PR #3802)
@xkaraman commented on this pull request. > + Store the hostname that correspond to ip + in a config variable $ptrquery(pvid=>hostname). + + + Parameters: + + + + + ip - string or pseudo-variable containing the ip. + The resulting IP addresses from DNS query are compared with ipaddr. + + + + +pvid - container id for script variable. These were mostly taken from dns_query docs and just altered it where it made sense. -- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/3802#discussion_r1549137618 You are receiving this because you are subscribed to this thread. Message ID: ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] Re: [kamailio/kamailio] ipops: Add PTR query support (PR #3802)
@oej commented on this pull request. > @@ -883,6 +883,57 @@ if(dns_query("test.com", "xyz")) + + +ptr_query(ip, pvid) + + + + Store the hostname that correspond to ip + in a config variable $ptrquery(pvid=>hostname). You are right. But it doesn't make it more correct... :-) xkaraman - you decide if you want to improve the docs or keep it at the current state. -- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/3802#discussion_r1549218619 You are receiving this because you are subscribed to this thread. Message ID: ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] Re: [kamailio/kamailio] ipops: Add PTR query support (PR #3802)
@xkaraman commented on this pull request. > + Store the hostname that correspond to ip + in a config variable $ptrquery(pvid=>hostname). + + + Parameters: + + + + + ip - string or pseudo-variable containing the ip. + The resulting IP addresses from DNS query are compared with ipaddr. + + + + +pvid - container id for script variable. What is the correct term for the `member/container` inside a pv that has multiple keys to get info from? -- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/3802#discussion_r1549224139 You are receiving this because you are subscribed to this thread. Message ID: ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] Re: [kamailio/kamailio] ipops: Add PTR query support (PR #3802)
@xkaraman pushed 4 commits. 348b95f86226b38ece4706684145caeab40272b9 ipops/docs: Add docs 893df07908c758863f814303b3689f172b9d7a2a ipops: Fix ip_type 60a70eebfc57c2103029b1afab60473441dad3cc ipops: Add new line 3027862b16052a8f08275fcc1f929c05c08aa98c ipops/doc: Update docs -- View it on GitHub: https://github.com/kamailio/kamailio/pull/3802/files/06e86a429dec156951d938e9e4b6590f61ac2a86..3027862b16052a8f08275fcc1f929c05c08aa98c You are receiving this because you are subscribed to this thread. Message ID: ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] Re: [kamailio/kamailio] ipops: Add PTR query support (PR #3802)
@xkaraman commented on this pull request. > +ipv4 - 1 if IPv4 address + + + + +ipv6 - 1 if IPv6 address + + For these i am not exactly sure their purpose. They were accesible before these commits. Are they for counting IPv4/6 in dns_query or just to check if at least one IPv4/6 is associated with hostname? -- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/3802#pullrequestreview-1976067655 You are receiving this because you are subscribed to this thread. Message ID: ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] Re: [kamailio/kamailio] ipops: Add PTR query support (PR #3802)
@xkaraman commented on this pull request. > @@ -418,6 +413,91 @@ int dns_update_pv(str *hostname, str *name) return 1; } +/* +* Fixed -- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/3802#discussion_r1549285664 You are receiving this because you are subscribed to this thread. Message ID: ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] Re: [kamailio/kamailio] ipops: Add PTR query support (PR #3802)
@xkaraman commented on this pull request. > @@ -883,6 +883,57 @@ if(dns_query("test.com", "xyz")) + + +ptr_query(ip, pvid) + + + + Store the hostname that correspond to ip Fixed -- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/3802#discussion_r1549287924 You are receiving this because you are subscribed to this thread. Message ID: ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] Re: [kamailio/kamailio] ipops: Add PTR query support (PR #3802)
@xkaraman commented on this pull request. > @@ -883,6 +883,57 @@ if(dns_query("test.com", "xyz")) + + +ptr_query(ip, pvid) + + + + Store the hostname that correspond to ip + in a config variable $ptrquery(pvid=>hostname). Fixed -- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/3802#discussion_r1549287626 You are receiving this because you are subscribed to this thread. Message ID: ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] Re: [kamailio/kamailio] ipops: Add PTR query support (PR #3802)
@xkaraman commented on this pull request. > + +ptr_query(ip, pvid) + + + + Store the hostname that correspond to ip + in a config variable $ptrquery(pvid=>hostname). + + + Parameters: + + + + + ip - string or pseudo-variable containing the ip. + The resulting IP addresses from DNS query are compared with ipaddr. Removed altogether. there is no comparison done at all. It must be a leftover from DNS query. -- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/3802#discussion_r1549287455 You are receiving this because you are subscribed to this thread. Message ID: ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] Re: [kamailio/kamailio] ipops: Add PTR query support (PR #3802)
@xkaraman commented on this pull request. > +/** + * + */ +static int w_ptr_query(sip_msg_t *msg, char *ip, char *pv_name) +{ + str ip_address; + str name; + + if(msg == NULL) { + LM_ERR("received null msg\n"); + return -1; + } + + if(fixup_get_svalue(msg, (gparam_t *)ip, &ip_address) < 0) { + LM_ERR("cannot get the IP address\n"); + return -1; Main reason i see for separating errors is for debugging purposes. Another thing, that might be good, would be to separate the failure over bad input and successful call with no hostname associated ([getnameinfo](https://man7.org/linux/man-pages/man3/getnameinfo.3.html)). Do you think this makes sense to separate and document it? Other than that, as you have said the code just want to know it had failed and not how. -- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/3802#discussion_r1549316055 You are receiving this because you are subscribed to this thread. Message ID: ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] Re: [kamailio/kamailio] ipops: Add PTR query support (PR #3802)
@miconda commented on this pull request. > @@ -883,6 +883,57 @@ if(dns_query("test.com", "xyz")) + + +ptr_query(ip, pvid) + + + + Store the hostname that correspond to ip + in a config variable $ptrquery(pvid=>hostname). I use both terms config variables and pseudo variables, and I am referring to the same concept. Historically the term pseudo-variables was used from developer's perspective, trying to differentiate them from C-style variables. Over the time, I noticed that config-variables are easier to "understand" what one refers to, specially by those coming new to use Kamailio. In other words, pseudo-variables tries to define them from technical point of view (i.e., no declaration, no explicit type association, automatically available by loading various modules, some read-only, other read-write). The config-variables indicates where these variables are available/can be used. -- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/3802#discussion_r1549330031 You are receiving this because you are subscribed to this thread. Message ID: ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] git:master:5f83d4f9: core: msg translator - duplicate reply via xavp params and handle errors
Module: kamailio Branch: master Commit: 5f83d4f9c447f5a7e3de8336dc0e076b10e43833 URL: https://github.com/kamailio/kamailio/commit/5f83d4f9c447f5a7e3de8336dc0e076b10e43833 Author: Daniel-Constantin Mierla Committer: Daniel-Constantin Mierla Date: 2024-04-03T12:18:47+02:00 core: msg translator - duplicate reply via xavp params and handle errors --- Modified: src/core/msg_translator.c --- Diff: https://github.com/kamailio/kamailio/commit/5f83d4f9c447f5a7e3de8336dc0e076b10e43833.diff Patch: https://github.com/kamailio/kamailio/commit/5f83d4f9c447f5a7e3de8336dc0e076b10e43833.patch --- diff --git a/src/core/msg_translator.c b/src/core/msg_translator.c index b54eded3f89..acd5911867a 100644 --- a/src/core/msg_translator.c +++ b/src/core/msg_translator.c @@ -2362,6 +2362,7 @@ char *generate_res_buf_from_sip_res( char *buf; unsigned int len; str xparams; + str sdup; sr_lump_t *anchor; buf = msg->buf; @@ -2393,11 +2394,18 @@ char *generate_res_buf_from_sip_res( anchor = anchor_lump(msg, msg->via2->params.s + msg->via2->params.len - msg->buf, 0, 0); - if(anchor != NULL) { - if(insert_new_lump_after(anchor, xparams.s, xparams.len, 0) - == 0) { - LM_ERR("unable to add via reply xavp params\n"); - } + if(anchor == NULL) { + LM_ERR("unable to get the anchor\n"); + goto error; + } + if(pkg_str_dup(&sdup, &xparams) < 0) { + PKG_MEM_ERROR; + goto error; + } + if(insert_new_lump_after(anchor, sdup.s, sdup.len, 0) == 0) { + LM_ERR("unable to add via reply xavp params\n"); + pkg_free(sdup.s); + goto error; } } } ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] git:master:3b09fd34: core: xavp - added missing closing parenthesis in log messages
Module: kamailio Branch: master Commit: 3b09fd343575c56d9658a61efebd4851662de338 URL: https://github.com/kamailio/kamailio/commit/3b09fd343575c56d9658a61efebd4851662de338 Author: Daniel-Constantin Mierla Committer: Daniel-Constantin Mierla Date: 2024-04-03T12:16:18+02:00 core: xavp - added missing closing parenthesis in log messages --- Modified: src/core/xavp.c --- Diff: https://github.com/kamailio/kamailio/commit/3b09fd343575c56d9658a61efebd4851662de338.diff Patch: https://github.com/kamailio/kamailio/commit/3b09fd343575c56d9658a61efebd4851662de338.patch --- diff --git a/src/core/xavp.c b/src/core/xavp.c index 128ea631013..21a8197080b 100644 --- a/src/core/xavp.c +++ b/src/core/xavp.c @@ -1151,7 +1151,7 @@ int xavp_serialize_fields_style(str *rname, int mode, char *obuf, int olen) avp->name.len, avp->name.s, (unsigned long)avp->val.v.l, sf); if(ostr.len <= 0 || ostr.len >= olen - rlen) { - LM_ERR("failed to serialize long int value (%d/%d\n", + LM_ERR("failed to serialize long int value (%d/%d)\n", ostr.len, olen - rlen); return -1; } @@ -1162,7 +1162,7 @@ int xavp_serialize_fields_style(str *rname, int mode, char *obuf, int olen) avp->name.len, avp->name.s, (unsigned long long)avp->val.v.ll, sf); if(ostr.len <= 0 || ostr.len >= olen - rlen) { - LM_ERR("failed to serialize long long value (%d/%d\n", + LM_ERR("failed to serialize long long value (%d/%d)\n", ostr.len, olen - rlen); return -1; } @@ -1178,7 +1178,7 @@ int xavp_serialize_fields_style(str *rname, int mode, char *obuf, int olen) qs, avp->val.v.s.len, avp->val.v.s.s, qs, sf); } if(ostr.len <= 0 || ostr.len >= olen - rlen) { - LM_ERR("failed to serialize int value (%d/%d\n", ostr.len, + LM_ERR("failed to serialize str value (%d/%d)\n", ostr.len, olen - rlen); return -1; } ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] git:5.8:e8aa9871: Makefile.defs: version set to 5.8.1
Module: kamailio Branch: 5.8 Commit: e8aa98718d91d0e5af7d757176a180e0f2940417 URL: https://github.com/kamailio/kamailio/commit/e8aa98718d91d0e5af7d757176a180e0f2940417 Author: Daniel-Constantin Mierla Committer: Daniel-Constantin Mierla Date: 2024-04-03T12:23:42+02:00 Makefile.defs: version set to 5.8.1 --- Modified: src/Makefile.defs --- Diff: https://github.com/kamailio/kamailio/commit/e8aa98718d91d0e5af7d757176a180e0f2940417.diff Patch: https://github.com/kamailio/kamailio/commit/e8aa98718d91d0e5af7d757176a180e0f2940417.patch --- diff --git a/src/Makefile.defs b/src/Makefile.defs index f5e8b0da653..0f960b4478e 100644 --- a/src/Makefile.defs +++ b/src/Makefile.defs @@ -106,7 +106,7 @@ INSTALL_FLAVOUR=$(FLAVOUR) # version number VERSION = 5 PATCHLEVEL = 8 -SUBLEVEL = 0 +SUBLEVEL = 1 EXTRAVERSION = # memory manager switcher ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] git:5.8:1caec71a: core: xavp - added missing closing parenthesis in log messages
Module: kamailio Branch: 5.8 Commit: 1caec71aeddb7f65afb93bf05cb9e0aae2a2c0cd URL: https://github.com/kamailio/kamailio/commit/1caec71aeddb7f65afb93bf05cb9e0aae2a2c0cd Author: Daniel-Constantin Mierla Committer: Daniel-Constantin Mierla Date: 2024-04-03T12:21:26+02:00 core: xavp - added missing closing parenthesis in log messages (cherry picked from commit 3b09fd343575c56d9658a61efebd4851662de338) --- Modified: src/core/xavp.c --- Diff: https://github.com/kamailio/kamailio/commit/1caec71aeddb7f65afb93bf05cb9e0aae2a2c0cd.diff Patch: https://github.com/kamailio/kamailio/commit/1caec71aeddb7f65afb93bf05cb9e0aae2a2c0cd.patch --- diff --git a/src/core/xavp.c b/src/core/xavp.c index 128ea631013..21a8197080b 100644 --- a/src/core/xavp.c +++ b/src/core/xavp.c @@ -1151,7 +1151,7 @@ int xavp_serialize_fields_style(str *rname, int mode, char *obuf, int olen) avp->name.len, avp->name.s, (unsigned long)avp->val.v.l, sf); if(ostr.len <= 0 || ostr.len >= olen - rlen) { - LM_ERR("failed to serialize long int value (%d/%d\n", + LM_ERR("failed to serialize long int value (%d/%d)\n", ostr.len, olen - rlen); return -1; } @@ -1162,7 +1162,7 @@ int xavp_serialize_fields_style(str *rname, int mode, char *obuf, int olen) avp->name.len, avp->name.s, (unsigned long long)avp->val.v.ll, sf); if(ostr.len <= 0 || ostr.len >= olen - rlen) { - LM_ERR("failed to serialize long long value (%d/%d\n", + LM_ERR("failed to serialize long long value (%d/%d)\n", ostr.len, olen - rlen); return -1; } @@ -1178,7 +1178,7 @@ int xavp_serialize_fields_style(str *rname, int mode, char *obuf, int olen) qs, avp->val.v.s.len, avp->val.v.s.s, qs, sf); } if(ostr.len <= 0 || ostr.len >= olen - rlen) { - LM_ERR("failed to serialize int value (%d/%d\n", ostr.len, + LM_ERR("failed to serialize str value (%d/%d)\n", ostr.len, olen - rlen); return -1; } ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] git:5.8:69f667fe: core: msg translator - duplicate reply via xavp params and handle errors
Module: kamailio Branch: 5.8 Commit: 69f667fe9b95d09a642cb7edd7f16ce09bbac3f1 URL: https://github.com/kamailio/kamailio/commit/69f667fe9b95d09a642cb7edd7f16ce09bbac3f1 Author: Daniel-Constantin Mierla Committer: Daniel-Constantin Mierla Date: 2024-04-03T12:21:37+02:00 core: msg translator - duplicate reply via xavp params and handle errors (cherry picked from commit 5f83d4f9c447f5a7e3de8336dc0e076b10e43833) --- Modified: src/core/msg_translator.c --- Diff: https://github.com/kamailio/kamailio/commit/69f667fe9b95d09a642cb7edd7f16ce09bbac3f1.diff Patch: https://github.com/kamailio/kamailio/commit/69f667fe9b95d09a642cb7edd7f16ce09bbac3f1.patch --- diff --git a/src/core/msg_translator.c b/src/core/msg_translator.c index b54eded3f89..acd5911867a 100644 --- a/src/core/msg_translator.c +++ b/src/core/msg_translator.c @@ -2362,6 +2362,7 @@ char *generate_res_buf_from_sip_res( char *buf; unsigned int len; str xparams; + str sdup; sr_lump_t *anchor; buf = msg->buf; @@ -2393,11 +2394,18 @@ char *generate_res_buf_from_sip_res( anchor = anchor_lump(msg, msg->via2->params.s + msg->via2->params.len - msg->buf, 0, 0); - if(anchor != NULL) { - if(insert_new_lump_after(anchor, xparams.s, xparams.len, 0) - == 0) { - LM_ERR("unable to add via reply xavp params\n"); - } + if(anchor == NULL) { + LM_ERR("unable to get the anchor\n"); + goto error; + } + if(pkg_str_dup(&sdup, &xparams) < 0) { + PKG_MEM_ERROR; + goto error; + } + if(insert_new_lump_after(anchor, sdup.s, sdup.len, 0) == 0) { + LM_ERR("unable to add via reply xavp params\n"); + pkg_free(sdup.s); + goto error; } } } ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] git:5.8:384843ce: ChangeLog: content updated for v5.8.1
Module: kamailio Branch: 5.8 Commit: 384843ceb6705996c0c6da6359868bd6e370a0b7 URL: https://github.com/kamailio/kamailio/commit/384843ceb6705996c0c6da6359868bd6e370a0b7 Author: Daniel-Constantin Mierla Committer: Daniel-Constantin Mierla Date: 2024-04-03T12:26:52+02:00 ChangeLog: content updated for v5.8.1 --- Modified: ChangeLog --- Diff: https://github.com/kamailio/kamailio/commit/384843ceb6705996c0c6da6359868bd6e370a0b7.diff Patch: https://github.com/kamailio/kamailio/commit/384843ceb6705996c0c6da6359868bd6e370a0b7.patch ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] Kamailio v5.8.1 Released
Hello, Kamailio SIP Server v5.8.1 stable release is out. This is a maintenance release of the latest stable branch, 5.8, that includes fixes since the release of v5.8.0. There is no change to database schema or configuration language structure that you have to do on previous installations of v5.8.x. Deployments running previous v5.8.x versions are strongly recommended to be upgraded to v5.8.1. For more details about version 5.8.1 (including links and guidelines to download the tarball or from GIT repository), visit: * https://www.kamailio.org/w/2024/04/kamailio-v5-8-1-released/ RPM, Debian/Ubuntu packages will be available soon as well. Many thanks to all contributing and using Kamailio! Cheers, Daniel -- Daniel-Constantin Mierla (@ asipto.com) twitter.com/miconda -- linkedin.com/in/miconda Kamailio Consultancy, Training and Development Services -- asipto.com Kamailio World Conference, April 18-19, 2024, Berlin -- kamailioworld.com ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] git:master:ec7f3a21: sdops: typo fixed for $sdp(m0:rtcp:port)
Module: kamailio Branch: master Commit: ec7f3a2173c1de220afd5b4776d92c98bb901630 URL: https://github.com/kamailio/kamailio/commit/ec7f3a2173c1de220afd5b4776d92c98bb901630 Author: Daniel-Constantin Mierla Committer: Daniel-Constantin Mierla Date: 2024-04-03T17:02:14+02:00 sdops: typo fixed for $sdp(m0:rtcp:port) --- Modified: src/modules/sdpops/sdpops_mod.c --- Diff: https://github.com/kamailio/kamailio/commit/ec7f3a2173c1de220afd5b4776d92c98bb901630.diff Patch: https://github.com/kamailio/kamailio/commit/ec7f3a2173c1de220afd5b4776d92c98bb901630.patch --- diff --git a/src/modules/sdpops/sdpops_mod.c b/src/modules/sdpops/sdpops_mod.c index 644ded5b064..b7ee2482616 100644 --- a/src/modules/sdpops/sdpops_mod.c +++ b/src/modules/sdpops/sdpops_mod.c @@ -2265,7 +2265,7 @@ static int pv_parse_sdp_name(pv_spec_p sp, str *in) case 12: if(strncmp(in->s, "sess_version", 12) == 0) sp->pvp.pvn.u.isname.name.n = 1; - else if(strncmp(in->s, "m0:rctp:port", 12) == 0) + else if(strncmp(in->s, "m0:rtcp:port", 12) == 0) sp->pvp.pvn.u.isname.name.n = 5; else goto error; ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] Re: [kamailio/kamailio] DBURL can't read env params (Issue #3800)
I don't think macro replacement works inside of strings. I believe you should be able to achieve what you want using [#!defexp](https://github.com/kamailio/kamailio-wiki/blob/main/docs/cookbooks/5.7.x/core.md#defexp), as the examples in the core documentation are nearly identical to your example. ``` #!define IPADDR 127.0.0.1 #!defexp SIPURI "sip:" + IPADDR + ":5060" #!defexp QSIPURI '"sip:' + IPADDR + ':5060"' #!defexp V16 1<<4 ``` Another possibility is using `modparamx()` and interpolating your strings there: ``` #!defenv MYSQL_IP #!modparamx("permissions, "db_url", "mysql://kamailio:kamailio@$def(MYSQL_IP)/kamailio"); ``` Or even just: ``` #!modparamx("permissions, "db_url", "mysql://kamailio:kamailio@$env(MYSQL_IP)/kamailio"); ``` The last form having the advantage that it's not available via the `core.ppdefines_full` rpc function thus reducing one possible point of exposure. -- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/3800#issuecomment-2035042424 You are receiving this because you are subscribed to this thread. Message ID: ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] git:master:6992c9ee: core: helper functions to escape/unescape cr lf
Module: kamailio Branch: master Commit: 6992c9eedeabd931fc255e5c1e992b0cfb01dbca URL: https://github.com/kamailio/kamailio/commit/6992c9eedeabd931fc255e5c1e992b0cfb01dbca Author: Daniel-Constantin Mierla Committer: Daniel-Constantin Mierla Date: 2024-04-03T18:48:29+02:00 core: helper functions to escape/unescape cr lf --- Modified: src/core/strutils.c Modified: src/core/strutils.h --- Diff: https://github.com/kamailio/kamailio/commit/6992c9eedeabd931fc255e5c1e992b0cfb01dbca.diff Patch: https://github.com/kamailio/kamailio/commit/6992c9eedeabd931fc255e5c1e992b0cfb01dbca.patch --- diff --git a/src/core/strutils.c b/src/core/strutils.c index 73e713cb451..475150dc0f7 100644 --- a/src/core/strutils.c +++ b/src/core/strutils.c @@ -109,6 +109,68 @@ int unescape_common(char *dst, char *src, int src_len) return j; } +/*! \brief + * add backslashes for CR LF + */ +int escape_crlf(str *sin, str *sout) +{ + int i, j; + + if(sout == 0 || sin == 0 || sin->len <= 0) + return -1; + j = 0; + for(i = 0; i < sin->len; i++) { + switch(sin->s[i]) { + case '\n': + sout->s[j++] = '\\'; + sout->s[j++] = 'n'; + break; + case '\r': + sout->s[j++] = '\\'; + sout->s[j++] = 'r'; + break; + default: + sout->s[j++] = sin->s[i]; + } + } + sout->len = j; + return 0; +} + +/*! \brief + * remove backslashes for CR LF + */ +int unescape_crlf(str *sin, str *sout) +{ + int i, j; + + if(sout == 0 || sin == 0 || sin->len <= 0) + return -1; + j = 0; + i = 0; + while(i < sin->len) { + if(sin->s[i] == '\\' && i + 1 < sin->len) { + switch(sin->s[i + 1]) { + case 'n': + sout->s[j++] = '\n'; + i++; + break; + case 'r': + sout->s[j++] = '\r'; + i++; + break; + default: + sout->s[j++] = sin->s[i]; + } + } else { + sout->s[j++] = sin->s[i]; + } + i++; + } + sout->len = j; + return 0; +} + /*! \brief Unscape all printable ASCII characters */ int unescape_user(str *sin, str *sout) { diff --git a/src/core/strutils.h b/src/core/strutils.h index b32e610512c..5781943dacb 100644 --- a/src/core/strutils.h +++ b/src/core/strutils.h @@ -56,6 +56,8 @@ int escape_common(char *dst, char *src, int src_len); /* remove backslashes to special characters */ int unescape_common(char *dst, char *src, int src_len); +int escape_crlf(str *sin, str *sout); +int unescape_crlf(str *sin, str *sout); int escape_user(str *sin, str *sout); int unescape_user(str *sin, str *sout); int escape_param(str *sin, str *sout); ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] git:master:ed60be16: pv: transformation to escape/unescape cr lf
Module: kamailio Branch: master Commit: ed60be162918fc1791ee6425f664eb2f76b9475e URL: https://github.com/kamailio/kamailio/commit/ed60be162918fc1791ee6425f664eb2f76b9475e Author: Daniel-Constantin Mierla Committer: Daniel-Constantin Mierla Date: 2024-04-03T18:52:58+02:00 pv: transformation to escape/unescape cr lf - {s.escape.crlf}, {s.unescape.crlf} --- Modified: src/modules/pv/pv_trans.c Modified: src/modules/pv/pv_trans.h --- Diff: https://github.com/kamailio/kamailio/commit/ed60be162918fc1791ee6425f664eb2f76b9475e.diff Patch: https://github.com/kamailio/kamailio/commit/ed60be162918fc1791ee6425f664eb2f76b9475e.patch --- diff --git a/src/modules/pv/pv_trans.c b/src/modules/pv/pv_trans.c index 0cc6f8f2e2c..a3ce0f0ace3 100644 --- a/src/modules/pv/pv_trans.c +++ b/src/modules/pv/pv_trans.c @@ -566,6 +566,32 @@ int tr_eval_string( val->rs.s = _tr_buffer; val->rs.len = i; break; + case TR_S_ESCAPECRLF: + if(!(val->flags & PV_VAL_STR)) + val->rs.s = int2str(val->ri, &val->rs.len); + if(val->rs.len > TR_BUFFER_SIZE / 2 - 1) + return -1; + st.s = _tr_buffer; + st.len = TR_BUFFER_SIZE; + if(escape_crlf(&val->rs, &st)) + return -1; + memset(val, 0, sizeof(pv_value_t)); + val->flags = PV_VAL_STR; + val->rs = st; + break; + case TR_S_UNESCAPECRLF: + if(!(val->flags & PV_VAL_STR)) + val->rs.s = int2str(val->ri, &val->rs.len); + if(val->rs.len > TR_BUFFER_SIZE - 1) + return -1; + st.s = _tr_buffer; + st.len = TR_BUFFER_SIZE; + if(unescape_crlf(&val->rs, &st)) + return -1; + memset(val, 0, sizeof(pv_value_t)); + val->flags = PV_VAL_STR; + val->rs = st; + break; case TR_S_ESCAPEUSER: if(!(val->flags & PV_VAL_STR)) val->rs.s = int2str(val->ri, &val->rs.len); @@ -2768,6 +2794,12 @@ char *tr_parse_string(str *in, trans_t *t) && strncasecmp(name.s, "unescape.common", 15) == 0) { t->subtype = TR_S_UNESCAPECOMMON; goto done; + } else if(name.len == 11 && strncasecmp(name.s, "escape.crlf", 11) == 0) { + t->subtype = TR_S_ESCAPECRLF; + goto done; + } else if(name.len == 13 && strncasecmp(name.s, "unescape.crlf", 13) == 0) { + t->subtype = TR_S_UNESCAPECRLF; + goto done; } else if(name.len == 11 && strncasecmp(name.s, "escape.user", 11) == 0) { t->subtype = TR_S_ESCAPEUSER; goto done; diff --git a/src/modules/pv/pv_trans.h b/src/modules/pv/pv_trans.h index 827f74feb49..662d5a2b578 100644 --- a/src/modules/pv/pv_trans.h +++ b/src/modules/pv/pv_trans.h @@ -60,6 +60,8 @@ enum _tr_s_subtype TR_S_DECODEBASE64, TR_S_ESCAPECOMMON, TR_S_UNESCAPECOMMON, + TR_S_ESCAPECRLF, + TR_S_UNESCAPECRLF, TR_S_ESCAPEUSER, TR_S_UNESCAPEUSER, TR_S_ESCAPEPARAM, ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] git:master:3e73dbc6: sdpops: added $sdp(m0:raw) - get all lines of the first m= stream
Module: kamailio Branch: master Commit: 3e73dbc6b69c8e26f276690bb6aa1e6db380510e URL: https://github.com/kamailio/kamailio/commit/3e73dbc6b69c8e26f276690bb6aa1e6db380510e Author: Daniel-Constantin Mierla Committer: Daniel-Constantin Mierla Date: 2024-04-03T19:19:27+02:00 sdpops: added $sdp(m0:raw) - get all lines of the first m= stream --- Modified: src/modules/sdpops/sdpops_mod.c --- Diff: https://github.com/kamailio/kamailio/commit/3e73dbc6b69c8e26f276690bb6aa1e6db380510e.diff Patch: https://github.com/kamailio/kamailio/commit/3e73dbc6b69c8e26f276690bb6aa1e6db380510e.patch --- diff --git a/src/modules/sdpops/sdpops_mod.c b/src/modules/sdpops/sdpops_mod.c index b7ee2482616..b443d1f84ac 100644 --- a/src/modules/sdpops/sdpops_mod.c +++ b/src/modules/sdpops/sdpops_mod.c @@ -2201,6 +2201,21 @@ static int pv_get_sdp(sip_msg_t *msg, pv_param_t *param, pv_value_t *res) } } } + case 7: + /* m0:raw - all (raw) lines for m0 stream */ + if(sdp->sessions == NULL) { + return pv_get_null(msg, param, res); + } + if(sdp->sessions->streams == NULL) { + return pv_get_null(msg, param, res); + } + if(sdp->sessions->streams->raw_stream.s != NULL + && sdp->sessions->streams->raw_stream.len > 0) { + return pv_get_strval( + msg, param, res, &sdp->sessions->streams->raw_stream); + } + return pv_get_null(msg, param, res); + break; default: return pv_get_null(msg, param, res); @@ -2256,6 +2271,12 @@ static int pv_parse_sdp_name(pv_spec_p sp, str *in) else goto error; break; + case 6: + if(strncmp(in->s, "m0:raw", 6) == 0) + sp->pvp.pvn.u.isname.name.n = 7; + else + goto error; + break; case 11: if(strncmp(in->s, "m0:rtp:port", 11) == 0) sp->pvp.pvn.u.isname.name.n = 4; ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
[sr-dev] git:master:8047c958: sdpops: aliased $sdp(raw) to $sdp(body)
Module: kamailio Branch: master Commit: 8047c958b42ea5af2e8f9ede0152f892ac0eea3a URL: https://github.com/kamailio/kamailio/commit/8047c958b42ea5af2e8f9ede0152f892ac0eea3a Author: Daniel-Constantin Mierla Committer: Daniel-Constantin Mierla Date: 2024-04-03T20:16:21+02:00 sdpops: aliased $sdp(raw) to $sdp(body) --- Modified: src/modules/sdpops/sdpops_mod.c --- Diff: https://github.com/kamailio/kamailio/commit/8047c958b42ea5af2e8f9ede0152f892ac0eea3a.diff Patch: https://github.com/kamailio/kamailio/commit/8047c958b42ea5af2e8f9ede0152f892ac0eea3a.patch --- diff --git a/src/modules/sdpops/sdpops_mod.c b/src/modules/sdpops/sdpops_mod.c index b443d1f84ac..96d0bd202b8 100644 --- a/src/modules/sdpops/sdpops_mod.c +++ b/src/modules/sdpops/sdpops_mod.c @@ -2259,6 +2259,12 @@ static int pv_parse_sdp_name(pv_spec_p sp, str *in) return -1; switch(in->len) { + case 3: + if(strncmp(in->s, "raw", 3) == 0) + sp->pvp.pvn.u.isname.name.n = 0; + else + goto error; + break; case 4: if(strncmp(in->s, "body", 4) == 0) sp->pvp.pvn.u.isname.name.n = 0; ___ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org