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
2025
February
January
2024
December
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
September 2023
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 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
17 participants
299 discussions
Start a n
N
ew thread
git:master:cf959e29: modules: readme files regenerated - corex ... [skip ci]
by Kamailio Dev
Module: kamailio Branch: master Commit: cf959e29ed71caa75b789d73fb8d5132cbc4e08a URL:
https://github.com/kamailio/kamailio/commit/cf959e29ed71caa75b789d73fb8d513…
Author: Kamailio Dev <kamailio.dev(a)kamailio.org> Committer: Kamailio Dev <kamailio.dev(a)kamailio.org> Date: 2023-09-07T08:47:15+02:00 modules: readme files regenerated - corex ... [skip ci] --- Modified: src/modules/corex/README --- Diff:
https://github.com/kamailio/kamailio/commit/cf959e29ed71caa75b789d73fb8d513…
Patch:
https://github.com/kamailio/kamailio/commit/cf959e29ed71caa75b789d73fb8d513…
1 year, 5 months
1
0
0
0
git:master:d5fa60a9: corex: docs - added missing end of section
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: d5fa60a96702a5a6f3ee562fa439ac2f23bc2247 URL:
https://github.com/kamailio/kamailio/commit/d5fa60a96702a5a6f3ee562fa439ac2…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2023-09-07T08:41:08+02:00 corex: docs - added missing end of section --- Modified: src/modules/corex/doc/corex_admin.xml --- Diff:
https://github.com/kamailio/kamailio/commit/d5fa60a96702a5a6f3ee562fa439ac2…
Patch:
https://github.com/kamailio/kamailio/commit/d5fa60a96702a5a6f3ee562fa439ac2…
--- diff --git a/src/modules/corex/doc/corex_admin.xml b/src/modules/corex/doc/corex_admin.xml index b0babf26886..6b60cbbf445 100644 --- a/src/modules/corex/doc/corex_admin.xml +++ b/src/modules/corex/doc/corex_admin.xml @@ -889,6 +889,7 @@ request_route { ... </programlisting> </example> + </section> <section id="corex.f.is_faked_msg"> <title> <function moreinfo="none">is_faked_msg()</function>
1 year, 5 months
1
0
0
0
git:master:a7e63e43: core: better style for serializing via reply xavp params
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: a7e63e43cc63781c53bd3fc44e55f0530e1754d6 URL:
https://github.com/kamailio/kamailio/commit/a7e63e43cc63781c53bd3fc44e55f05…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2023-09-07T08:39:41+02:00 core: better style for serializing via reply xavp params --- Modified: src/core/msg_translator.c --- Diff:
https://github.com/kamailio/kamailio/commit/a7e63e43cc63781c53bd3fc44e55f05…
Patch:
https://github.com/kamailio/kamailio/commit/a7e63e43cc63781c53bd3fc44e55f05…
--- diff --git a/src/core/msg_translator.c b/src/core/msg_translator.c index 42f445983f1..0140fc1d98a 100644 --- a/src/core/msg_translator.c +++ b/src/core/msg_translator.c @@ -2345,13 +2345,15 @@ char *generate_res_buf_from_sip_res( if(msg && msg->via2 && (msg->msg_flags & FL_ADD_XAVP_VIA_REPLY_PARAMS) && _ksr_xavp_via_reply_params.len > 0) { xparams.s = pv_get_buffer(); - xparams.len = xavp_serialize_fields( - &_ksr_xavp_via_reply_params, xparams.s, pv_get_buffer_size()); + xparams.len = xavp_serialize_fields_style(&_ksr_xavp_via_reply_params, + 1, xparams.s, pv_get_buffer_size()); if(xparams.len > 0) { - anchor = anchor_lump(msg, msg->via2->params.s - + msg->via2->params.len - msg->buf, 0, 0); + 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) { + if(insert_new_lump_after(anchor, xparams.s, xparams.len, 0) + == 0) { LM_ERR("unable to add via reply xavp params\n"); } } @@ -2481,10 +2483,10 @@ char *build_res_buf_from_sip_req(unsigned int code, str *text, str *new_tag, if(msg && (msg->msg_flags & FL_ADD_XAVP_VIA_REPLY_PARAMS) && _ksr_xavp_via_reply_params.len > 0) { xparams.s = pv_get_buffer(); - xparams.len = xavp_serialize_fields( - &_ksr_xavp_via_reply_params, xparams.s, pv_get_buffer_size()); + xparams.len = xavp_serialize_fields_style(&_ksr_xavp_via_reply_params, + 1, xparams.s, pv_get_buffer_size()); if(xparams.len > 0) { - len += xparams.len; /* ending ';' included */ + len += xparams.len; /* starting ';' included */ } } @@ -2621,8 +2623,7 @@ char *build_res_buf_from_sip_req(unsigned int code, str *text, str *new_tag, (hdr->body.s + hdr->body.len) - hdr->name.s, msg); } if(xparams.len > 0) { - append_str(p, ";", 1); - append_str(p, xparams.s, xparams.len - 1); + append_str(p, xparams.s, xparams.len); } append_str(p, CRLF, CRLF_LEN); /* if is HTTP, replace Via with Sia
1 year, 5 months
1
0
0
0
git:master:1e5d1e35: core: xavp - helper function to set style when serializing
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: 1e5d1e35fbebd25d3d4b81839e40dfbea841f7d2 URL:
https://github.com/kamailio/kamailio/commit/1e5d1e35fbebd25d3d4b81839e40dfb…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2023-09-07T08:39:41+02:00 core: xavp - helper function to set style when serializing --- Modified: src/core/xavp.c Modified: src/core/xavp.h --- Diff:
https://github.com/kamailio/kamailio/commit/1e5d1e35fbebd25d3d4b81839e40dfb…
Patch:
https://github.com/kamailio/kamailio/commit/1e5d1e35fbebd25d3d4b81839e40dfb…
--- diff --git a/src/core/xavp.c b/src/core/xavp.c index 9a0e4ad600a..551a039ab80 100644 --- a/src/core/xavp.c +++ b/src/core/xavp.c @@ -1105,19 +1105,22 @@ int xavp_set_child_sval(str *rname, str *cname, str *sval) } /** - * serialize the values in subfields of an xavp in name=value; format + * serialize the values in subfields of an xavp in name=value format styles * - rname - name of the root list xavp + * - mode - 0 - style is 'name=value;', 1 - style is ';name=value' * - obuf - buffer were to write the output * - olen - the size of obuf * return: 0 - not found; -1 - error; >0 - length of output */ -int xavp_serialize_fields(str *rname, char *obuf, int olen) +int xavp_serialize_fields_style(str *rname, int mode, char *obuf, int olen) { sr_xavp_t *ravp = NULL; sr_xavp_t *avp = NULL; str ostr; int rlen; + char *pr = ""; + char *sf = ""; ravp = xavp_get(rname, NULL); if(ravp == NULL || ravp->val.type != SR_XTYPE_XAVP) { @@ -1125,6 +1128,14 @@ int xavp_serialize_fields(str *rname, char *obuf, int olen) return 0; } + if(mode & 1) { + pr = ";"; + sf = ""; + } else { + pr = ""; + sf = ";"; + } + rlen = 0; ostr.s = obuf; avp = ravp->val.v.xavp; @@ -1132,9 +1143,9 @@ int xavp_serialize_fields(str *rname, char *obuf, int olen) switch(avp->val.type) { case SR_XTYPE_LONG: LM_DBG(" XAVP long int value: %ld\n", avp->val.v.l); - ostr.len = snprintf(ostr.s, olen - rlen, "%.*s=%lu;", - avp->name.len, avp->name.s, - (unsigned long)avp->val.v.l); + ostr.len = snprintf(ostr.s, olen - rlen, "%s%.*s=%lu%s", + pr, 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 int value (%d/%d\n", ostr.len, olen - rlen); @@ -1144,12 +1155,12 @@ int xavp_serialize_fields(str *rname, char *obuf, int olen) case SR_XTYPE_STR: LM_DBG(" XAVP str value: %s\n", avp->val.v.s.s); if(avp->val.v.s.len == 0) { - ostr.len = snprintf(ostr.s, olen - rlen, "%.*s;", - avp->name.len, avp->name.s); + ostr.len = snprintf(ostr.s, olen - rlen, "%s%.*s%s", + pr, avp->name.len, avp->name.s, sf); } else { - ostr.len = snprintf(ostr.s, olen - rlen, "%.*s=%.*s;", - avp->name.len, avp->name.s, avp->val.v.s.len, - avp->val.v.s.s); + ostr.len = snprintf(ostr.s, olen - rlen, "%s%.*s=%.*s%s", + pr, avp->name.len, avp->name.s, avp->val.v.s.len, + avp->val.v.s.s, sf); } if(ostr.len <= 0 || ostr.len >= olen - rlen) { LM_ERR("failed to serialize int value (%d/%d\n", ostr.len, @@ -1170,6 +1181,19 @@ int xavp_serialize_fields(str *rname, char *obuf, int olen) return rlen; } +/** + * serialize the values in subfields of an xavp in 'name=value;' format + * - rname - name of the root list xavp + * - obuf - buffer were to write the output + * - olen - the size of obuf + * return: 0 - not found; -1 - error; >0 - length of output + */ + +int xavp_serialize_fields(str *rname, char *obuf, int olen) +{ + return xavp_serialize_fields_style(rname, 0, obuf, olen); +} + /** * */ diff --git a/src/core/xavp.h b/src/core/xavp.h index c1aa7d8c651..4d5c30d989b 100644 --- a/src/core/xavp.h +++ b/src/core/xavp.h @@ -114,6 +114,7 @@ sr_xavp_t *xavp_get_child(str *rname, str *cname); sr_xavp_t *xavp_get_child_with_ival(str *rname, str *cname); sr_xavp_t *xavp_get_child_with_sval(str *rname, str *cname); int xavp_serialize_fields(str *rname, char *obuf, int olen); +int xavp_serialize_fields_style(str *rname, int mode, char *obuf, int olen); int xavp_set_child_ival(str *rname, str *cname, long ival); int xavp_set_child_sval(str *rname, str *cname, str *sval);
1 year, 5 months
1
0
0
0
git:master:1832880c: core: add via reply xavp params for generation when using another reply
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: 1832880c4d8e2e0c5b5444542d414b13bbab47ca URL:
https://github.com/kamailio/kamailio/commit/1832880c4d8e2e0c5b5444542d414b1…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2023-09-07T08:39:41+02:00 core: add via reply xavp params for generation when using another reply --- Modified: src/core/msg_translator.c --- Diff:
https://github.com/kamailio/kamailio/commit/1832880c4d8e2e0c5b5444542d414b1…
Patch:
https://github.com/kamailio/kamailio/commit/1832880c4d8e2e0c5b5444542d414b1…
--- diff --git a/src/core/msg_translator.c b/src/core/msg_translator.c index c5c4172c045..42f445983f1 100644 --- a/src/core/msg_translator.c +++ b/src/core/msg_translator.c @@ -2320,6 +2320,8 @@ char *generate_res_buf_from_sip_res( unsigned offset, s_offset, via_offset; char *buf; unsigned int len; + str xparams; + sr_lump_t *anchor; buf = msg->buf; len = msg->len; @@ -2339,6 +2341,23 @@ char *generate_res_buf_from_sip_res( } } + /* test and add xavp via reply params */ + if(msg && msg->via2 && (msg->msg_flags & FL_ADD_XAVP_VIA_REPLY_PARAMS) + && _ksr_xavp_via_reply_params.len > 0) { + xparams.s = pv_get_buffer(); + xparams.len = xavp_serialize_fields( + &_ksr_xavp_via_reply_params, xparams.s, pv_get_buffer_size()); + if(xparams.len > 0) { + 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"); + } + } + } + } + /* Calculate message body difference and adjust * Content-Length */ @@ -2458,7 +2477,7 @@ char *build_res_buf_from_sip_req(unsigned int code, str *text, str *new_tag, len -= msg->via1->rport->size + 1; /* include ';' */ } - /* test and add xavpvia params */ + /* test and add xavp via reply params */ if(msg && (msg->msg_flags & FL_ADD_XAVP_VIA_REPLY_PARAMS) && _ksr_xavp_via_reply_params.len > 0) { xparams.s = pv_get_buffer();
1 year, 5 months
1
0
0
0
git:master:c92a73f8: modules: readme files regenerated - corex ... [skip ci]
by Kamailio Dev
Module: kamailio Branch: master Commit: c92a73f84c1fc8701f5c1b938a40ba46f5a619c8 URL:
https://github.com/kamailio/kamailio/commit/c92a73f84c1fc8701f5c1b938a40ba4…
Author: Kamailio Dev <kamailio.dev(a)kamailio.org> Committer: Kamailio Dev <kamailio.dev(a)kamailio.org> Date: 2023-09-07T07:46:59+02:00 modules: readme files regenerated - corex ... [skip ci] --- Modified: src/modules/corex/README --- Diff:
https://github.com/kamailio/kamailio/commit/c92a73f84c1fc8701f5c1b938a40ba4…
Patch:
https://github.com/kamailio/kamailio/commit/c92a73f84c1fc8701f5c1b938a40ba4…
1 year, 5 months
1
0
0
0
git:master:3ed56db3: pv: proper name id for oc field of via variables
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: 3ed56db363ace8162abdfda6e5bc0cbd51a73c70 URL:
https://github.com/kamailio/kamailio/commit/3ed56db363ace8162abdfda6e5bc0cb…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2023-09-07T07:39:38+02:00 pv: proper name id for oc field of via variables --- Modified: src/modules/pv/pv_core.c --- Diff:
https://github.com/kamailio/kamailio/commit/3ed56db363ace8162abdfda6e5bc0cb…
Patch:
https://github.com/kamailio/kamailio/commit/3ed56db363ace8162abdfda6e5bc0cb…
--- diff --git a/src/modules/pv/pv_core.c b/src/modules/pv/pv_core.c index a491d10d643..dc611de7f1a 100644 --- a/src/modules/pv/pv_core.c +++ b/src/modules/pv/pv_core.c @@ -4490,7 +4490,7 @@ int pv_parse_via_name(pv_spec_p sp, str *in) break; case 2: if(strncmp(in->s, "oc", 2) == 0) - sp->pvp.pvn.u.isname.name.n = 0; + sp->pvp.pvn.u.isname.name.n = 9; else goto error; break;
1 year, 5 months
1
0
0
0
git:master:faa0bdcc: corex: docs for via_reply_add_xavp_params(flags) function
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: faa0bdcc5d87d40cac8a279c524fbe724c1f7f1d URL:
https://github.com/kamailio/kamailio/commit/faa0bdcc5d87d40cac8a279c524fbe7…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2023-09-07T07:38:51+02:00 corex: docs for via_reply_add_xavp_params(flags) function --- Modified: src/modules/corex/doc/corex_admin.xml --- Diff:
https://github.com/kamailio/kamailio/commit/faa0bdcc5d87d40cac8a279c524fbe7…
Patch:
https://github.com/kamailio/kamailio/commit/faa0bdcc5d87d40cac8a279c524fbe7…
--- diff --git a/src/modules/corex/doc/corex_admin.xml b/src/modules/corex/doc/corex_admin.xml index 0346c2bc3fd..b0babf26886 100644 --- a/src/modules/corex/doc/corex_admin.xml +++ b/src/modules/corex/doc/corex_admin.xml @@ -854,6 +854,41 @@ request_route { </programlisting> </example> </section> + <section id="corex.f.via_reply_add_xavp_params"> + <title><function moreinfo="none">via_reply_add_xavp_params(flags)</function></title> + <para> + Control if fields of the xavp with the name specified by + xavp_via_reply_params global parameter are added or not to the top Via + of replies. + </para> + <para>Meaning of the parameters is as follows:</para> + <itemizedlist> + <listitem> + <para> + <emphasis>flags</emphasis>: 1 - add xavp parameters; 0 - do not + add xavp parameters. + </para> + </listitem> + </itemizedlist> + <para> + This function can be used from ANY_ROUTE. + </para> + <example> + <title><function>via_reply_add_xavp_params</function> usage</title> + <programlisting format="linespecific"> +... +xavp_via_reply_params="xviarpl" +... +request_route { + ... + $xavp(xviarpl=>srvid) = "1"; + $xavp(xviarpl[0]=>myval) = "xyz"; + via_reply_add_xavp_params("1"); + ... +} +... +</programlisting> + </example> <section id="corex.f.is_faked_msg"> <title> <function moreinfo="none">is_faked_msg()</function>
1 year, 5 months
1
0
0
0
git:master:1880737b: cores: new function via_reply_add_xavp_params()
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: 1880737b9251a14eb7395f5968b955475848780d URL:
https://github.com/kamailio/kamailio/commit/1880737b9251a14eb7395f5968b9554…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2023-09-06T21:09:35+02:00 cores: new function via_reply_add_xavp_params() - enable adding parameters to top via of replies from xavp fields --- Modified: src/modules/corex/corex_mod.c --- Diff:
https://github.com/kamailio/kamailio/commit/1880737b9251a14eb7395f5968b9554…
Patch:
https://github.com/kamailio/kamailio/commit/1880737b9251a14eb7395f5968b9554…
--- diff --git a/src/modules/corex/corex_mod.c b/src/modules/corex/corex_mod.c index 24eba482489..d65f49dd8cf 100644 --- a/src/modules/corex/corex_mod.c +++ b/src/modules/corex/corex_mod.c @@ -70,6 +70,7 @@ static int w_set_source_address(sip_msg_t *msg, char *paddr, char *p2); static int w_via_add_srvid(sip_msg_t *msg, char *pflags, char *p2); static int w_via_add_xavp_params(sip_msg_t *msg, char *pflags, char *p2); static int w_via_use_xavp_fields(sip_msg_t *msg, char *pflags, char *p2); +static int w_via_reply_add_xavp_params(sip_msg_t *msg, char *pflags, char *p2); static int w_is_faked_msg(sip_msg_t *msg, char *p1, char *p2); static int w_is_socket_name(sip_msg_t *msg, char *psockname, char *p2); @@ -156,6 +157,8 @@ static cmd_export_t cmds[] = {{"forward_reply", (cmd_function)w_forward_reply, fixup_igp_null, fixup_free_igp_null, ANY_ROUTE}, {"via_use_xavp_fields", (cmd_function)w_via_use_xavp_fields, 1, fixup_igp_null, fixup_free_igp_null, ANY_ROUTE}, + {"via_reply_add_xavp_params", (cmd_function)w_via_reply_add_xavp_params, 1, + fixup_igp_null, fixup_free_igp_null, ANY_ROUTE}, {"is_faked_msg", (cmd_function)w_is_faked_msg, 0, 0, 0, ANY_ROUTE}, {"is_socket_name", (cmd_function)w_is_socket_name, 1, fixup_spve_null, fixup_free_spve_null, ANY_ROUTE}, @@ -1114,6 +1117,33 @@ static int w_via_use_xavp_fields(sip_msg_t *msg, char *pflags, char *s2) return ki_via_use_xavp_fields(msg, fval); } +/** + * + */ +static int ki_via_reply_add_xavp_params(sip_msg_t *msg, int fval) +{ + if(msg == NULL) + return -1; + if(fval) { + msg->msg_flags |= FL_ADD_XAVP_VIA_REPLY_PARAMS; + } else { + msg->msg_flags &= ~(FL_ADD_XAVP_VIA_REPLY_PARAMS); + } + return 1; +} + +/** + * + */ +static int w_via_reply_add_xavp_params(sip_msg_t *msg, char *pflags, char *s2) +{ + int fval = 0; + if(fixup_get_ivalue(msg, (gparam_t *)pflags, &fval) != 0) { + LM_ERR("no flag value\n"); + return -1; + } + return ki_via_reply_add_xavp_params(msg, fval); +} /** * @@ -1317,6 +1347,11 @@ static sr_kemi_t sr_kemi_corex_exports[] = { { SR_KEMIP_INT, SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE } }, + { str_init("corex"), str_init("via_reply_add_xavp_params"), + SR_KEMIP_INT, ki_via_reply_add_xavp_params, + { SR_KEMIP_INT, SR_KEMIP_NONE, SR_KEMIP_NONE, + SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE } + }, { str_init("corex"), str_init("has_ruri_user"), SR_KEMIP_INT, ki_has_ruri_user, { SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
1 year, 5 months
1
0
0
0
git:master:439eae7a: core: ability to add paramters to top via of generated sip replies
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: 439eae7aa2154a25a0d9143345e526e22162b24f URL:
https://github.com/kamailio/kamailio/commit/439eae7aa2154a25a0d9143345e526e…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2023-09-06T21:08:20+02:00 core: ability to add paramters to top via of generated sip replies - parameters and values are taken from xavp specified by xavp_via_reply_params --- Modified: src/core/globals.h Modified: src/core/msg_translator.c --- Diff:
https://github.com/kamailio/kamailio/commit/439eae7aa2154a25a0d9143345e526e…
Patch:
https://github.com/kamailio/kamailio/commit/439eae7aa2154a25a0d9143345e526e…
--- diff --git a/src/core/globals.h b/src/core/globals.h index da693a06bae..a11f8521a3b 100644 --- a/src/core/globals.h +++ b/src/core/globals.h @@ -218,6 +218,7 @@ extern int ksr_all_errors; extern int ksr_route_locks_size; extern str _ksr_xavp_via_params; extern str _ksr_xavp_via_fields; +extern str _ksr_xavp_via_reply_params; extern int ksr_sip_parser_mode; extern int ksr_cfg_print_mode; extern int ksr_return_mode; diff --git a/src/core/msg_translator.c b/src/core/msg_translator.c index fcc6f133439..c5c4172c045 100644 --- a/src/core/msg_translator.c +++ b/src/core/msg_translator.c @@ -114,6 +114,7 @@ extern int version_len; str _ksr_xavp_via_params = STR_NULL; str _ksr_xavp_via_fields = STR_NULL; +str _ksr_xavp_via_reply_params = STR_NULL; int ksr_local_rport = 0; /** per process fixup function for global_req_flags. @@ -2415,6 +2416,7 @@ char *build_res_buf_from_sip_req(unsigned int code, str *text, str *new_tag, char *totags; int httpreq; char *pvia; + str xparams = STR_NULL; body = 0; buf = 0; @@ -2456,6 +2458,17 @@ char *build_res_buf_from_sip_req(unsigned int code, str *text, str *new_tag, len -= msg->via1->rport->size + 1; /* include ';' */ } + /* test and add xavpvia params */ + if(msg && (msg->msg_flags & FL_ADD_XAVP_VIA_REPLY_PARAMS) + && _ksr_xavp_via_reply_params.len > 0) { + xparams.s = pv_get_buffer(); + xparams.len = xavp_serialize_fields( + &_ksr_xavp_via_reply_params, xparams.s, pv_get_buffer_size()); + if(xparams.len > 0) { + len += xparams.len; /* ending ';' included */ + } + } + /* first line */ len += msg->first_line.u.request.version.len + 1 /*space*/ + 3 /*code*/ + 1 /*space*/ + text->len @@ -2588,6 +2601,10 @@ char *build_res_buf_from_sip_req(unsigned int code, str *text, str *new_tag, append_str_trans(p, hdr->name.s, (hdr->body.s + hdr->body.len) - hdr->name.s, msg); } + if(xparams.len > 0) { + append_str(p, ";", 1); + append_str(p, xparams.s, xparams.len - 1); + } append_str(p, CRLF, CRLF_LEN); /* if is HTTP, replace Via with Sia * - HTTP Via format is different than SIP Via
1 year, 5 months
1
0
0
0
← Newer
1
...
25
26
27
28
29
30
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
Results per page:
10
25
50
100
200