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
September 2018
----- 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
24 participants
331 discussions
Start a n
N
ew thread
git:master:91211184: htable: exported sht_rm_value_re() and sht_rm_name_re() to kemi
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: 9121118444e638223c789641618ed4145a67b0f3 URL:
https://github.com/kamailio/kamailio/commit/9121118444e638223c789641618ed41…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2018-09-03T14:50:16+02:00 htable: exported sht_rm_value_re() and sht_rm_name_re() to kemi - GH #1614 --- Modified: src/modules/htable/htable.c --- Diff:
https://github.com/kamailio/kamailio/commit/9121118444e638223c789641618ed41…
Patch:
https://github.com/kamailio/kamailio/commit/9121118444e638223c789641618ed41…
--- diff --git a/src/modules/htable/htable.c b/src/modules/htable/htable.c index fbe016e0aa..43c58d1942 100644 --- a/src/modules/htable/htable.c +++ b/src/modules/htable/htable.c @@ -354,13 +354,49 @@ static int fixup_ht_key(void** param, int param_no) return 0; } -static int ht_rm_name_re(struct sip_msg* msg, char* key, char* foo) +/** + * + */ +static int ht_rm_re_helper(sip_msg_t *msg, ht_t *ht, str *rexp, int rmode) +{ + int_str isval; + + if (ht->dmqreplicate>0) { + isval.s = *rexp; + if (ht_dmq_replicate_action(HT_DMQ_RM_CELL_RE, &ht->name, NULL, + AVP_VAL_STR, &isval, rmode)!=0) { + LM_ERR("dmq relication failed for [%.*s]\n", ht->name.len, ht->name.s); + } + } + if(ht_rm_cell_re(rexp, ht, rmode)<0) + return -1; + return 1; +} + +/** + * + */ +static int ki_ht_rm_name_re(sip_msg_t *msg, str *htname, str *rexp) +{ + ht_t *ht; + + ht = ht_get_table(htname); + if(ht==NULL) { + return 1; + } + + return ht_rm_re_helper(msg, ht, rexp, 0); +} + +/** + * + */ +static int ht_rm_name_re(sip_msg_t* msg, char* key, char* foo) { ht_pv_t *hpv; str sre; pv_spec_t *sp; sp = (pv_spec_t*)key; - int_str isval; hpv = (ht_pv_t*)sp->pvp.pvn.u.dname; @@ -375,24 +411,33 @@ static int ht_rm_name_re(struct sip_msg* msg, char* key, char* foo) LM_ERR("cannot get $sht expression\n"); return -1; } - if (hpv->ht->dmqreplicate>0) { - isval.s = sre; - if (ht_dmq_replicate_action(HT_DMQ_RM_CELL_RE, &hpv->htname, NULL, AVP_VAL_STR, &isval, 0)!=0) { - LM_ERR("dmq relication failed\n"); - } + return ht_rm_re_helper(msg, hpv->ht, &sre, 0); +} + +/** + * + */ +static int ki_ht_rm_value_re(sip_msg_t *msg, str *htname, str *rexp) +{ + ht_t *ht; + + ht = ht_get_table(htname); + if(ht==NULL) { + return 1; } - if(ht_rm_cell_re(&sre, hpv->ht, 0)<0) - return -1; - return 1; + + return ht_rm_re_helper(msg, ht, rexp, 1); } -static int ht_rm_value_re(struct sip_msg* msg, char* key, char* foo) +/** + * + */ +static int ht_rm_value_re(sip_msg_t* msg, char* key, char* foo) { ht_pv_t *hpv; str sre; pv_spec_t *sp; sp = (pv_spec_t*)key; - int_str isval; hpv = (ht_pv_t*)sp->pvp.pvn.u.dname; @@ -407,16 +452,7 @@ static int ht_rm_value_re(struct sip_msg* msg, char* key, char* foo) LM_ERR("cannot get $sht expression\n"); return -1; } - - if (hpv->ht->dmqreplicate>0) { - isval.s = sre; - if (ht_dmq_replicate_action(HT_DMQ_RM_CELL_RE, &hpv->htname, NULL, AVP_VAL_STR, &isval, 1)!=0) { - LM_ERR("dmq relication failed\n"); - } - } - if(ht_rm_cell_re(&sre, hpv->ht, 1)<0) - return -1; - return 1; + return ht_rm_re_helper(msg, hpv->ht, &sre, 1); } static int ht_rm_items(sip_msg_t* msg, str* hname, str* op, str *val, @@ -1275,6 +1311,16 @@ static sr_kemi_t sr_kemi_htable_exports[] = { { SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE } }, + { str_init("htable"), str_init("sht_rm_name_re"), + SR_KEMIP_INT, ki_ht_rm_name_re, + { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE, + SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE } + }, + { str_init("htable"), str_init("sht_rm_value_re"), + SR_KEMIP_INT, ki_ht_rm_value_re, + { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE, + SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE } + }, { {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } } };
6 years, 2 months
1
0
0
0
git:master:23a4632f: modules: readme files regenerated - rr ... [skip ci]
by Kamailio Dev
Module: kamailio Branch: master Commit: 23a4632ffacedf5b80b1be4a47cab6fddec90502 URL:
https://github.com/kamailio/kamailio/commit/23a4632ffacedf5b80b1be4a47cab6f…
Author: Kamailio Dev <kamailio.dev(a)kamailio.org> Committer: Kamailio Dev <kamailio.dev(a)kamailio.org> Date: 2018-09-03T13:01:47+02:00 modules: readme files regenerated - rr ... [skip ci] --- Modified: src/modules/rr/README --- Diff:
https://github.com/kamailio/kamailio/commit/23a4632ffacedf5b80b1be4a47cab6f…
Patch:
https://github.com/kamailio/kamailio/commit/23a4632ffacedf5b80b1be4a47cab6f…
6 years, 2 months
1
0
0
0
git:master:096461d9: rr: docs for ignore_sips parameter
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: 096461d90c5fd301fdfb77a52e2906e3f591f643 URL:
https://github.com/kamailio/kamailio/commit/096461d90c5fd301fdfb77a52e2906e…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2018-09-03T12:49:39+02:00 rr: docs for ignore_sips parameter --- Modified: src/modules/rr/doc/rr_admin.xml --- Diff:
https://github.com/kamailio/kamailio/commit/096461d90c5fd301fdfb77a52e2906e…
Patch:
https://github.com/kamailio/kamailio/commit/096461d90c5fd301fdfb77a52e2906e…
--- diff --git a/src/modules/rr/doc/rr_admin.xml b/src/modules/rr/doc/rr_admin.xml index f5fe00e131..7dd1868e2a 100644 --- a/src/modules/rr/doc/rr_admin.xml +++ b/src/modules/rr/doc/rr_admin.xml @@ -290,6 +290,26 @@ record_route(); ... modparam("rr", "force_send_socket", 1) ... +</programlisting> + </example> + </section> + <section id="rr.p.ignore_sips"> + <title><varname>ignore_sips</varname> (int)</title> + + <para> + If set to 1, the Record-Route header are build with 'sip' schema + always, ignoring the presence of 'sips' schema in request URI. + </para> + + <para><emphasis>Default value is 0 (use 'sips' if present in R-URI).</emphasis></para> + + <example> + <title>Set <varname>ignore_sips</varname> parameter</title> + + <programlisting format="linespecific"> +... +modparam("rr", "ignore_sips", 1) +... </programlisting> </example> </section>
6 years, 2 months
1
0
0
0
git:master:65a50a5b: rr: ignore_sips - new parameter to control use of sips schema
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: 65a50a5b4a4e37d940f9a33ec6c0d8079249de59 URL:
https://github.com/kamailio/kamailio/commit/65a50a5b4a4e37d940f9a33ec6c0d80…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2018-09-03T12:27:41+02:00 rr: ignore_sips - new parameter to control use of sips schema - if set to different than 0, then record-route headers will be added with sip schema even if r-uri comes with sips. Allow interoperability with some UAs messing up routing when sips is used - default is 0 - use sips schema if in r-uri (existing behaviour) --- Modified: src/modules/rr/record.c Modified: src/modules/rr/rr_mod.c --- Diff:
https://github.com/kamailio/kamailio/commit/65a50a5b4a4e37d940f9a33ec6c0d80…
Patch:
https://github.com/kamailio/kamailio/commit/65a50a5b4a4e37d940f9a33ec6c0d80…
--- diff --git a/src/modules/rr/record.c b/src/modules/rr/record.c index 0d042b2d36..402e6d5573 100644 --- a/src/modules/rr/record.c +++ b/src/modules/rr/record.c @@ -69,6 +69,7 @@ #define RR_PARAM_BUF_SIZE 512 /*!< buffer for RR parameter */ +extern int rr_ignore_sips; /*! * \brief RR param buffer @@ -378,11 +379,11 @@ int record_route(struct sip_msg* _m, str *params) str user = {NULL, 0}; str* tag; int use_ob = rr_obb.use_outbound ? rr_obb.use_outbound(_m) : 0; - int sips; + int sips = 0; int ret = 0; - + user.len = 0; - + if (add_username) { /* check if there is a custom user set */ if (get_custom_user(_m, &user) < 0) { @@ -428,7 +429,9 @@ int record_route(struct sip_msg* _m, str *params) rr_param_buf.len = 0; } - sips = rr_is_sips(_m); + if(rr_ignore_sips==0) { + sips = rr_is_sips(_m); + } if (enable_double_rr) { l = anchor_lump(_m, _m->headers->name.s - _m->buf,0,HDR_RECORDROUTE_T); @@ -453,7 +456,7 @@ int record_route(struct sip_msg* _m, str *params) goto error; } } - + l = anchor_lump(_m, _m->headers->name.s - _m->buf, 0, HDR_RECORDROUTE_T); l2 = anchor_lump(_m, _m->headers->name.s - _m->buf, 0, 0); if (!l || !l2) { @@ -461,7 +464,7 @@ int record_route(struct sip_msg* _m, str *params) ret = -3; goto error; } - + if (build_rr(l, l2, &user, tag, params, INBOUND, sips) < 0) { LM_ERR("failed to insert inbound Record-Route\n"); ret = -4; @@ -499,10 +502,12 @@ int record_route_preset(struct sip_msg* _m, str* _data) int use_ob = rr_obb.use_outbound ? rr_obb.use_outbound(_m) : 0; char *rr_prefix; int rr_prefix_len; - int sips; + int sips = 0; int ret = 0; - sips = rr_is_sips(_m); + if(rr_ignore_sips==0) { + sips = rr_is_sips(_m); + } if(sips==0) { rr_prefix = RR_PREFIX_SIP; rr_prefix_len = RR_PREFIX_SIP_LEN; @@ -756,9 +761,9 @@ int record_route_advertised_address(struct sip_msg* _m, str* _data) struct lump* l; struct lump* l2; int use_ob = rr_obb.use_outbound ? rr_obb.use_outbound(_m) : 0; - int sips; + int sips = 0; int ret = 0; - + user.len = 0; user.s = 0; @@ -799,7 +804,9 @@ int record_route_advertised_address(struct sip_msg* _m, str* _data) tag = 0; } - sips = rr_is_sips(_m); + if(rr_ignore_sips==0) { + sips = rr_is_sips(_m); + } if (enable_double_rr) { l = anchor_lump(_m, _m->headers->name.s - _m->buf,0,HDR_RECORDROUTE_T); @@ -825,7 +832,7 @@ int record_route_advertised_address(struct sip_msg* _m, str* _data) goto error; } } - + l = anchor_lump(_m, _m->headers->name.s - _m->buf, 0, HDR_RECORDROUTE_T); l2 = anchor_lump(_m, _m->headers->name.s - _m->buf, 0, 0); if (!l || !l2) { @@ -833,7 +840,7 @@ int record_route_advertised_address(struct sip_msg* _m, str* _data) ret = -6; goto error; } - + if (build_advertised_rr(l, l2, _data, &user, tag, INBOUND, sips) < 0) { LM_ERR("failed to insert outbound Record-Route\n"); ret = -7; diff --git a/src/modules/rr/rr_mod.c b/src/modules/rr/rr_mod.c index 36b1c046a8..a3ef5e880a 100644 --- a/src/modules/rr/rr_mod.c +++ b/src/modules/rr/rr_mod.c @@ -61,6 +61,7 @@ int rr_force_send_socket = 0; /*!< control if socket is forced by rr */ int enable_socket_mismatch_warning = 1; /*!< enable socket mismatch warning */ static str custom_user_spec = {NULL, 0}; pv_spec_t custom_user_avp; +int rr_ignore_sips = 0; /*!< ignore sips schema when building record-route */ ob_api_t rr_obb; @@ -131,6 +132,7 @@ static param_export_t params[] ={ {"enable_socket_mismatch_warning",INT_PARAM,&enable_socket_mismatch_warning}, {"custom_user_avp", PARAM_STR, &custom_user_spec}, {"force_send_socket", PARAM_INT, &rr_force_send_socket}, + {"ignore_sips", PARAM_INT, &rr_ignore_sips}, {0, 0, 0 } };
6 years, 2 months
1
0
0
0
git:master:8cebf48e: core: parse via - set len for host/port_str only if there is a value
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: 8cebf48eeee70d23c6cf827e24b2f5fabda669ab URL:
https://github.com/kamailio/kamailio/commit/8cebf48eeee70d23c6cf827e24b2f5f…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2018-09-03T09:54:39+02:00 core: parse via - set len for host/port_str only if there is a value --- Modified: src/core/parser/parse_via.c --- Diff:
https://github.com/kamailio/kamailio/commit/8cebf48eeee70d23c6cf827e24b2f5f…
Patch:
https://github.com/kamailio/kamailio/commit/8cebf48eeee70d23c6cf827e24b2f5f…
--- diff --git a/src/core/parser/parse_via.c b/src/core/parser/parse_via.c index 8c3d54ea5e..318bb8e6c6 100644 --- a/src/core/parser/parse_via.c +++ b/src/core/parser/parse_via.c @@ -2073,7 +2073,7 @@ char *parse_via( break; case P_HOST: /*mark end of host*/ - vb->host.len = tmp - vb->host.s; + if(vb->host.s) vb->host.len = tmp - vb->host.s; state = L_PORT; break; case L_PORT: /*eat the spaces*/ @@ -2081,7 +2081,7 @@ char *parse_via( break; case P_PORT: /*end of port */ - vb->port_str.len = tmp - vb->port_str.s; + if(vb->port_str.s) vb->port_str.len = tmp - vb->port_str.s; state = L_PARAM; break; case L_PARAM: /* eat the space */ @@ -2131,13 +2131,13 @@ char *parse_via( break; case P_HOST: /*mark end of host*/ - vb->host.len = tmp - vb->host.s; + if(vb->host.s) vb->host.len = tmp - vb->host.s; saved_state = L_PORT; state = F_LF; break; case P_PORT: /*end of port */ - vb->port_str.len = tmp - vb->port_str.s; + if(vb->port_str.s) vb->port_str.len = tmp - vb->port_str.s; saved_state = L_PARAM; state = F_LF; break; @@ -2176,13 +2176,13 @@ char *parse_via( break; case P_HOST: /*mark end of host*/ - vb->host.len = tmp - vb->host.s; + if(vb->host.s) vb->host.len = tmp - vb->host.s; saved_state = L_PORT; state = F_CR; break; case P_PORT: /*end of port */ - vb->port_str.len = tmp - vb->port_str.s; + if(vb->port_str.s) vb->port_str.len = tmp - vb->port_str.s; saved_state = L_PARAM; state = F_CR; break; @@ -2212,7 +2212,7 @@ char *parse_via( break; case P_HOST: /*mark end of host*/ - vb->host.len = tmp - vb->host.s; + if(vb->host.s) vb->host.len = tmp - vb->host.s; state = F_PORT; break; case L_PORT: @@ -2257,13 +2257,13 @@ char *parse_via( LM_ERR("bad ipv6 reference\n"); goto error; case P_HOST: - vb->host.len = tmp - vb->host.s; + if(vb->host.s) vb->host.len = tmp - vb->host.s; state = F_PARAM; param_start = tmp + 1; break; case P_PORT: /*mark the end*/ - vb->port_str.len = tmp - vb->port_str.s; + if(vb->port_str.s) vb->port_str.len = tmp - vb->port_str.s; case L_PORT: case L_PARAM: state = F_PARAM; @@ -2313,12 +2313,12 @@ char *parse_via( goto error; case P_HOST: /*mark the end*/ - vb->host.len = tmp - vb->host.s; + if(vb->host.s) vb->host.len = tmp - vb->host.s; state = F_VIA; break; case P_PORT: /*mark the end*/ - vb->port_str.len = tmp - vb->port_str.s; + if(vb->port_str.s) vb->port_str.len = tmp - vb->port_str.s; state = F_VIA; break; case L_PORT: @@ -2363,13 +2363,13 @@ char *parse_via( goto error; case P_HOST: /*mark the end*/ - vb->host.len = tmp - vb->host.s; + if(vb->host.s) vb->host.len = tmp - vb->host.s; state = F_COMMENT; c_nest++; break; case P_PORT: /*mark the end*/ - vb->port_str.len = tmp - vb->port_str.s; + if(vb->port_str.s) vb->port_str.len = tmp - vb->port_str.s; state = F_COMMENT; c_nest++; break; @@ -2469,7 +2469,7 @@ char *parse_via( switch(state) { case P_IP6HOST: /*mark the end*/ - vb->host.len = (tmp - vb->host.s) + 1; /* include "]" */ + if(vb->host.s) vb->host.len = (tmp - vb->host.s) + 1; /* include "]" */ state = L_PORT; break; case F_CRLF:
6 years, 2 months
1
0
0
0
git:master:f8723954: dispatcher: more debug messages when updating dst
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: f8723954bf67359c92e8cd09ac6915f64ad1ce71 URL:
https://github.com/kamailio/kamailio/commit/f8723954bf67359c92e8cd09ac6915f…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2018-09-03T09:23:38+02:00 dispatcher: more debug messages when updating dst --- Modified: src/modules/dispatcher/dispatch.c --- Diff:
https://github.com/kamailio/kamailio/commit/f8723954bf67359c92e8cd09ac6915f…
Patch:
https://github.com/kamailio/kamailio/commit/f8723954bf67359c92e8cd09ac6915f…
--- diff --git a/src/modules/dispatcher/dispatch.c b/src/modules/dispatcher/dispatch.c index 7d7105df29..cb87392eb8 100644 --- a/src/modules/dispatcher/dispatch.c +++ b/src/modules/dispatcher/dispatch.c @@ -2250,6 +2250,7 @@ int ds_update_dst(struct sip_msg *msg, int upos, int mode) sr_xavp_t *rxavp = NULL; sr_xavp_t *lxavp = NULL; + LM_DBG("updating dst\n"); if(upos == DS_USE_NEXT) { if(!(ds_flags & DS_FAILOVER_ON) || ds_xavp_dst.len <= 0) { LM_WARN("failover support disabled\n"); @@ -2264,6 +2265,7 @@ int ds_update_dst(struct sip_msg *msg, int upos, int mode) } if(upos == DS_USE_NEXT) { + LM_DBG("updating dst with next record\n"); /* use next destination - delete the current one and search the next */ xavp_rm(rxavp, NULL); @@ -2282,7 +2284,7 @@ int ds_update_dst(struct sip_msg *msg, int upos, int mode) lxavp = xavp_get(&ds_xavp_dst_addr, rxavp); if(lxavp==NULL || lxavp->val.type!=SR_XTYPE_STR) { - LM_WARN("no xavp uri field in next destination record\n"); + LM_WARN("no xavp uri field in next destination record (%p)\n", lxavp); return -1; }
6 years, 2 months
1
0
0
0
git:master:3fef2b3c: core: xavp - more debug details when printing xavp
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: 3fef2b3c18f83add1af13c2b84303b507e27aeca URL:
https://github.com/kamailio/kamailio/commit/3fef2b3c18f83add1af13c2b84303b5…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2018-09-03T09:23:08+02:00 core: xavp - more debug details when printing xavp --- Modified: src/core/xavp.c --- Diff:
https://github.com/kamailio/kamailio/commit/3fef2b3c18f83add1af13c2b84303b5…
Patch:
https://github.com/kamailio/kamailio/commit/3fef2b3c18f83add1af13c2b84303b5…
--- diff --git a/src/core/xavp.c b/src/core/xavp.c index e1cf394171..66797f910b 100644 --- a/src/core/xavp.c +++ b/src/core/xavp.c @@ -540,11 +540,11 @@ void xavp_print_list_content(sr_xavp_t **head, int level) start = *head; else start=*_xavp_list_crt; - LM_INFO("+++++ start XAVP list: %p (level=%d)\n", start, level); + LM_INFO("+++++ start XAVP list: %p (%p) (level=%d)\n", start, head, level); avp = start; while(avp) { - LM_INFO(" *** XAVP name: %s\n", avp->name.s); + LM_INFO(" *** (l:%d - %p) XAVP name: %s\n", level, avp, avp->name.s); LM_INFO(" XAVP id: %u\n", avp->id); LM_INFO(" XAVP value type: %d\n", avp->val.type); switch(avp->val.type) { @@ -552,20 +552,20 @@ void xavp_print_list_content(sr_xavp_t **head, int level) LM_INFO(" XAVP value: <null>\n"); break; case SR_XTYPE_INT: - LM_INFO(" XAVP value: %d\n", avp->val.v.i); + LM_INFO(" XAVP value (int): %d\n", avp->val.v.i); break; case SR_XTYPE_STR: - LM_INFO(" XAVP value: %s\n", avp->val.v.s.s); + LM_INFO(" XAVP value (str): %s\n", avp->val.v.s.s); break; case SR_XTYPE_TIME: - LM_INFO(" XAVP value: %lu\n", + LM_INFO(" XAVP value (time): %lu\n", (long unsigned int)avp->val.v.t); break; case SR_XTYPE_LONG: - LM_INFO(" XAVP value: %ld\n", avp->val.v.l); + LM_INFO(" XAVP value (long): %ld\n", avp->val.v.l); break; case SR_XTYPE_LLONG: - LM_INFO(" XAVP value: %lld\n", avp->val.v.ll); + LM_INFO(" XAVP value (llong): %lld\n", avp->val.v.ll); break; case SR_XTYPE_XAVP: LM_INFO(" XAVP value: <xavp:%p>\n", avp->val.v.xavp); @@ -578,6 +578,7 @@ void xavp_print_list_content(sr_xavp_t **head, int level) LM_INFO(" XAVP value: <data:%p>\n", avp->val.v.data); break; } + LM_INFO(" *** (l:%d - %p) end\n", level, avp); avp = avp->next; } LM_INFO("----- end XAVP list: %p (level=%d)\n", start, level);
6 years, 2 months
1
0
0
0
git:master:6fadac0f: textopsx: use functions from core to apply changes
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: 6fadac0fc8107a80663da7f975f066738151456b URL:
https://github.com/kamailio/kamailio/commit/6fadac0fc8107a80663da7f975f0667…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2018-09-02T12:42:37+02:00 textopsx: use functions from core to apply changes --- Modified: src/modules/textopsx/textopsx.c --- Diff:
https://github.com/kamailio/kamailio/commit/6fadac0fc8107a80663da7f975f0667…
Patch:
https://github.com/kamailio/kamailio/commit/6fadac0fc8107a80663da7f975f0667…
--- diff --git a/src/modules/textopsx/textopsx.c b/src/modules/textopsx/textopsx.c index 24bdf0c84f..cf2fe52b84 100644 --- a/src/modules/textopsx/textopsx.c +++ b/src/modules/textopsx/textopsx.c @@ -145,8 +145,6 @@ static int mod_init(void) */ static int ki_msg_update_buffer(sip_msg_t *msg, str *obuf) { - sip_msg_t tmp; - if(obuf==NULL || obuf->s==NULL || obuf->len<=0) { LM_ERR("invalid buffer parameter\n"); return -1; @@ -156,52 +154,8 @@ static int ki_msg_update_buffer(sip_msg_t *msg, str *obuf) LM_ERR("new buffer is too large (%d)\n", obuf->len); return -1; } - /* temporary copy */ - memcpy(&tmp, msg, sizeof(sip_msg_t)); - - /* reset dst uri and path vector to avoid freeing - restored later */ - if(msg->dst_uri.s != NULL) { - msg->dst_uri.s = NULL; - msg->dst_uri.len = 0; - } - if(msg->path_vec.s != NULL) { - msg->path_vec.s = NULL; - msg->path_vec.len = 0; - } - - /* free old msg structure */ - free_sip_msg(msg); - memset(msg, 0, sizeof(sip_msg_t)); - - /* restore msg fields */ - msg->buf = tmp.buf; - msg->id = tmp.id; - msg->rcv = tmp.rcv; - msg->set_global_address = tmp.set_global_address; - msg->set_global_port = tmp.set_global_port; - msg->flags = tmp.flags; - msg->msg_flags = tmp.msg_flags; - msg->hash_index = tmp.hash_index; - msg->force_send_socket = tmp.force_send_socket; - msg->fwd_send_flags = tmp.fwd_send_flags; - msg->rpl_send_flags = tmp.rpl_send_flags; - msg->dst_uri = tmp.dst_uri; - msg->path_vec = tmp.path_vec; - - memcpy(msg->buf, obuf->s, obuf->len); - msg->len = obuf->len; - msg->buf[msg->len] = '\0'; - - /* reparse the message */ - LM_DBG("SIP message content updated - reparsing\n"); - if(parse_msg(msg->buf, msg->len, msg) != 0) { - LM_ERR("parsing new sip message failed [[%.*s]]\n", msg->len, msg->buf); - /* exit config execution - sip_msg_t structure is no longer - * valid/safe for config */ - return 0; - } - return 1; + return sip_msg_update_buffer(msg, obuf); } /** @@ -222,39 +176,12 @@ static int ki_msg_set_buffer(sip_msg_t *msg, str *obuf) */ static int ki_msg_apply_changes(sip_msg_t *msg) { - int ret; - dest_info_t dst; - str obuf; - if(msg->first_line.type != SIP_REPLY && get_route_type() != REQUEST_ROUTE) { LM_ERR("invalid usage - not in request route or a reply\n"); return -1; } - init_dest_info(&dst); - dst.proto = PROTO_UDP; - if(msg->first_line.type == SIP_REPLY) { - obuf.s = generate_res_buf_from_sip_res( - msg, (unsigned int *)&obuf.len, BUILD_NO_VIA1_UPDATE); - } else { - if(msg->msg_flags & FL_RR_ADDED) { - LM_ERR("cannot apply msg changes after adding record-route" - " header - it breaks conditional 2nd header\n"); - return -1; - } - obuf.s = build_req_buf_from_sip_req(msg, (unsigned int *)&obuf.len, - &dst, - BUILD_NO_PATH | BUILD_NO_LOCAL_VIA | BUILD_NO_VIA1_UPDATE); - } - if(obuf.s == NULL) { - LM_ERR("couldn't update msg buffer content\n"); - return -1; - } - ret = ki_msg_update_buffer(msg, &obuf); - /* free new buffer - copied in the static buffer from old sip_msg_t */ - pkg_free(obuf.s); - - return ret; + return sip_msg_apply_changes(msg); } /**
6 years, 2 months
1
0
0
0
git:master:8e581a3e: core: functions to apply changes and update internal sip msg buffer
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: 8e581a3ebe71eedb41ac7a41538e6b1b2b391744 URL:
https://github.com/kamailio/kamailio/commit/8e581a3ebe71eedb41ac7a41538e6b1…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2018-09-02T12:33:17+02:00 core: functions to apply changes and update internal sip msg buffer --- Modified: src/core/msg_translator.c Modified: src/core/msg_translator.h --- Diff:
https://github.com/kamailio/kamailio/commit/8e581a3ebe71eedb41ac7a41538e6b1…
Patch:
https://github.com/kamailio/kamailio/commit/8e581a3ebe71eedb41ac7a41538e6b1…
--- diff --git a/src/core/msg_translator.c b/src/core/msg_translator.c index f82d72c3cb..6929b22e0f 100644 --- a/src/core/msg_translator.c +++ b/src/core/msg_translator.c @@ -3176,3 +3176,106 @@ int build_sip_msg_from_buf(struct sip_msg *msg, char *buf, int len, return 0; } +/** + * + */ +int sip_msg_update_buffer(sip_msg_t *msg, str *obuf) +{ + sip_msg_t tmp; + + if(obuf==NULL || obuf->s==NULL || obuf->len<=0) { + LM_ERR("invalid buffer parameter\n"); + return -1; + } + + if(obuf->len >= BUF_SIZE) { + LM_ERR("new buffer is too large (%d)\n", obuf->len); + return -1; + } + /* temporary copy */ + memcpy(&tmp, msg, sizeof(sip_msg_t)); + + /* reset dst uri and path vector to avoid freeing - restored later */ + if(msg->dst_uri.s != NULL) { + msg->dst_uri.s = NULL; + msg->dst_uri.len = 0; + } + if(msg->path_vec.s != NULL) { + msg->path_vec.s = NULL; + msg->path_vec.len = 0; + } + + /* free old msg structure */ + free_sip_msg(msg); + memset(msg, 0, sizeof(sip_msg_t)); + + /* restore msg fields */ + msg->buf = tmp.buf; + msg->id = tmp.id; + msg->rcv = tmp.rcv; + msg->set_global_address = tmp.set_global_address; + msg->set_global_port = tmp.set_global_port; + msg->flags = tmp.flags; + msg->msg_flags = tmp.msg_flags; + msg->hash_index = tmp.hash_index; + msg->force_send_socket = tmp.force_send_socket; + msg->fwd_send_flags = tmp.fwd_send_flags; + msg->rpl_send_flags = tmp.rpl_send_flags; + msg->dst_uri = tmp.dst_uri; + msg->path_vec = tmp.path_vec; + + memcpy(msg->buf, obuf->s, obuf->len); + msg->len = obuf->len; + msg->buf[msg->len] = '\0'; + + /* reparse the message */ + LM_DBG("SIP message content updated - reparsing\n"); + if(parse_msg(msg->buf, msg->len, msg) != 0) { + LM_ERR("parsing new sip message failed [[%.*s]]\n", msg->len, msg->buf); + /* exit config execution - sip_msg_t structure is no longer + * valid/safe for config */ + return 0; + } + + return 1; +} + +/** + * + */ +int sip_msg_apply_changes(sip_msg_t *msg) +{ + int ret; + dest_info_t dst; + str obuf; + + if(msg->first_line.type != SIP_REPLY && get_route_type() != REQUEST_ROUTE) { + LM_ERR("invalid usage - not in request route or a reply\n"); + return -1; + } + + init_dest_info(&dst); + dst.proto = PROTO_UDP; + if(msg->first_line.type == SIP_REPLY) { + obuf.s = generate_res_buf_from_sip_res( + msg, (unsigned int *)&obuf.len, BUILD_NO_VIA1_UPDATE); + } else { + if(msg->msg_flags & FL_RR_ADDED) { + LM_ERR("cannot apply msg changes after adding record-route" + " header - it breaks conditional 2nd header\n"); + return -1; + } + obuf.s = build_req_buf_from_sip_req(msg, (unsigned int *)&obuf.len, + &dst, + BUILD_NO_PATH | BUILD_NO_LOCAL_VIA | BUILD_NO_VIA1_UPDATE); + } + if(obuf.s == NULL) { + LM_ERR("couldn't update msg buffer content\n"); + return -1; + } + ret = sip_msg_update_buffer(msg, &obuf); + /* free new buffer - copied in the static buffer from old sip_msg_t */ + pkg_free(obuf.s); + + return ret; +} diff --git a/src/core/msg_translator.h b/src/core/msg_translator.h index d95c89f5e4..b6360ce3ff 100644 --- a/src/core/msg_translator.h +++ b/src/core/msg_translator.h @@ -180,4 +180,15 @@ void process_lumps( struct sip_msg* msg, unsigned int* orig_offs, struct dest_info* send_info, int flag); + +/** + * set the internal buffer for sip msg with obuf and reparse + */ +int sip_msg_update_buffer(sip_msg_t *msg, str *obuf); + +/** + * apply changes to sip msg buffer and reparse + */ +int sip_msg_apply_changes(sip_msg_t *msg); + #endif
6 years, 2 months
1
0
0
0
Re: [sr-dev] [kamailio/kamailio] dmq: add optional parameter to dmq_handle_message() (bce0890)
by Emmanuel Schmidbauer
@miconda any chance this can get tagged for next release? -- 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/commit/bce08905dc0bea2f9bce44460dcaee4…
6 years, 2 months
1
0
0
0
← Newer
1
...
30
31
32
33
34
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
32
33
34
Results per page:
10
25
50
100
200