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
May
April
March
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
March 2016
----- 2025 -----
May 2025
April 2025
March 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
27 participants
387 discussions
Start a n
N
ew thread
git:4.4:1b0638e1: topos: use headers to pass dlg id between receive and send of dlg requests
by Daniel-Constantin Mierla
30 Mar '16
30 Mar '16
Module: kamailio Branch: 4.4 Commit: 1b0638e1e71d0c724d389524b9fd77fa6e6adb5a URL:
https://github.com/kamailio/kamailio/commit/1b0638e1e71d0c724d389524b9fd77f…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2016-03-30T14:33:23+02:00 topos: use headers to pass dlg id between receive and send of dlg requests - it is no longer in the context to be used directly (cherry picked from commit 95572016c2d6764f75775230d5e6cf5d180c6e06) --- Modified: modules/topos/tps_msg.c Modified: modules/topos/tps_storage.c Modified: modules/topos/tps_storage.h --- Diff:
https://github.com/kamailio/kamailio/commit/1b0638e1e71d0c724d389524b9fd77f…
Patch:
https://github.com/kamailio/kamailio/commit/1b0638e1e71d0c724d389524b9fd77f…
1
0
0
0
git:4.4:f6697740: topos: restore stripped headers when receiving a dlg request
by Daniel-Constantin Mierla
30 Mar '16
30 Mar '16
Module: kamailio Branch: 4.4 Commit: f6697740e7d55f8eca2039c235feaff91f5aa14f URL:
https://github.com/kamailio/kamailio/commit/f6697740e7d55f8eca2039c235feaff…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2016-03-30T14:33:10+02:00 topos: restore stripped headers when receiving a dlg request (cherry picked from commit 2cb59f1716931e58b00ba7c0c177b0609c796b17) --- Modified: modules/topos/tps_msg.c --- Diff:
https://github.com/kamailio/kamailio/commit/f6697740e7d55f8eca2039c235feaff…
Patch:
https://github.com/kamailio/kamailio/commit/f6697740e7d55f8eca2039c235feaff…
--- diff --git a/modules/topos/tps_msg.c b/modules/topos/tps_msg.c index f35eeaf..7b3805a 100644 --- a/modules/topos/tps_msg.c +++ b/modules/topos/tps_msg.c @@ -33,6 +33,7 @@ #include "../../data_lump.h" #include "../../forward.h" #include "../../trim.h" +#include "../../dset.h" #include "../../msg_translator.h" #include "../../parser/parse_rr.h" #include "../../parser/parse_uri.h" @@ -258,6 +259,33 @@ int tps_skip_msg(sip_msg_t *msg) /** * */ +int tps_dlg_message_update(sip_msg_t *msg, tps_data_t *ptsd) +{ + if(parse_sip_msg_uri(msg)<0) { + LM_ERR("failed to parse r-uri\n"); + return -1; + } + if(msg->parsed_uri.user.len<10) { + LM_DBG("not an expected user format\n"); + return 1; + } + if(memcmp(msg->parsed_uri.user.s, "atpsh-", 6)==0) { + ptsd->a_uuid = msg->parsed_uri.user; + return 0; + } + if(memcmp(msg->parsed_uri.user.s, "btpsh-", 6)==0) { + ptsd->a_uuid = msg->parsed_uri.user; + ptsd->b_uuid = msg->parsed_uri.user; + return 0; + } + LM_DBG("not an expected user prefix\n"); + + return 1; +} + +/** + * + */ int tps_pack_message(sip_msg_t *msg, tps_data_t *ptsd) { hdr_field_t *hdr; @@ -537,13 +565,110 @@ int tps_reappend_rr(sip_msg_t *msg, tps_data_t *ptsd, str *hbody) /** * */ +int tps_reappend_route(sip_msg_t *msg, tps_data_t *ptsd, str *hbody, int rev) +{ + str hname = str_init("Route"); + + if(tps_add_headers(msg, &hname, hbody, 0)<0) { + return -1; + } + + return 0; +} + +/** + * + */ int tps_request_received(sip_msg_t *msg, int dialog) { + tps_data_t mtsd; + tps_data_t stsd; + str lkey; + str ftag; + str nuri; + uint32_t direction = TPS_DIR_DOWNSTREAM; + int ret; + if(dialog==0) { /* nothing to do for initial request */ return 0; } + + memset(&mtsd, 0, sizeof(tps_data_t)); + memset(&stsd, 0, sizeof(tps_data_t)); + + if(tps_pack_message(msg, &mtsd)<0) { + LM_ERR("failed to extract and pack the headers\n"); + return -1; + } + + ret = tps_dlg_message_update(msg, &mtsd); + if(ret<0) { + LM_ERR("failed to update on dlg message\n"); + return -1; + } + + lkey = msg->callid->body; + + tps_storage_lock_get(&lkey); + + if(tps_storage_load_dialog(msg, &mtsd, &stsd)<0) { + goto error; + } + + /* detect direction - get from-tag */ + if(parse_from_header(msg)<0 || msg->from==NULL) { + LM_ERR("failed getting 'from' header!\n"); + goto error; + } + ftag = get_from(msg)->tag_value; + + if(stsd.a_tag.len!=ftag.len) { + direction = TPS_DIR_UPSTREAM; + } else { + if(memcpy(stsd.a_tag.s, ftag.s, ftag.len)==0) { + direction = TPS_DIR_DOWNSTREAM; + } else { + direction = TPS_DIR_UPSTREAM; + } + } + mtsd.direction = direction; + + tps_storage_lock_release(&lkey); + + if(direction == TPS_DIR_UPSTREAM) { + nuri = stsd.a_contact; + } else { + nuri = stsd.b_contact; + } + if(nuri.len>0) { + if(rewrite_uri(msg, &nuri)<0) { + LM_ERR("failed to update r-uri\n"); + return -1; + } + } + + if(tps_reappend_route(msg, &stsd, &stsd.s_rr, + (direction==TPS_DIR_UPSTREAM)?0:1)<0) { + LM_ERR("failed to reappend s-route\n"); + return -1; + } + if(direction == TPS_DIR_UPSTREAM) { + if(tps_reappend_route(msg, &stsd, &stsd.a_rr, 0)<0) { + LM_ERR("failed to reappend a-route\n"); + return -1; + } + } else { + if(tps_reappend_route(msg, &stsd, &stsd.b_rr, 0)<0) { + LM_ERR("failed to reappend b-route\n"); + return -1; + } + } return 0; + +error: + tps_storage_lock_release(&lkey); + return -1; } /**
1
0
0
0
git:4.4:486341c7: geoip2: Improve detection of addresses used by anonymous proxies
by Daniel-Constantin Mierla
30 Mar '16
30 Mar '16
Module: kamailio Branch: 4.4 Commit: 486341c76bc09fb5ead0fa63b890adb260871740 URL:
https://github.com/kamailio/kamailio/commit/486341c76bc09fb5ead0fa63b890adb…
Author: Sergey Okhapkin <root(a)west2.callwithus.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2016-03-30T14:32:58+02:00 geoip2: Improve detection of addresses used by anonymous proxies (cherry picked from commit c49011c2cc63d35bca6904748da166814a792fc9) --- Modified: modules/geoip2/geoip2_pv.c --- Diff:
https://github.com/kamailio/kamailio/commit/486341c76bc09fb5ead0fa63b890adb…
Patch:
https://github.com/kamailio/kamailio/commit/486341c76bc09fb5ead0fa63b890adb…
--- diff --git a/modules/geoip2/geoip2_pv.c b/modules/geoip2/geoip2_pv.c index 69bd719..e239d96 100644 --- a/modules/geoip2/geoip2_pv.c +++ b/modules/geoip2/geoip2_pv.c @@ -407,7 +407,11 @@ int pv_get_geoip2(struct sip_msg *msg, pv_param_t *param, return pv_get_null(msg, param, res); if(MMDB_get_value(&gpv->item->r.record.entry, &entry_data, "country","iso_code", NULL - ) != MMDB_SUCCESS) + ) != MMDB_SUCCESS + && MMDB_get_value(&gpv->item->r.record.entry, &entry_data, + "registered_country","iso_code", NULL + ) != MMDB_SUCCESS + ) return pv_get_null(msg, param, res); if(entry_data.has_data && entry_data.type == MMDB_DATA_TYPE_UTF8_STRING) { gpv->item->r.country.s = (char *)entry_data.utf8_string;
1
0
0
0
git:4.4:75df6618: pv: fix compile warning for shm_initialized() test
by Daniel-Constantin Mierla
30 Mar '16
30 Mar '16
Module: kamailio Branch: 4.4 Commit: 75df6618a6eaec8314480de193e2a9a7cbe25324 URL:
https://github.com/kamailio/kamailio/commit/75df6618a6eaec8314480de193e2a9a…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2016-03-30T14:32:49+02:00 pv: fix compile warning for shm_initialized() test - coherent whitepacing across the file (cherry picked from commit d3d1592eb7148586cb70e93f549ff11fd5cf5316) --- Modified: modules/pv/pv_shv.c --- Diff:
https://github.com/kamailio/kamailio/commit/75df6618a6eaec8314480de193e2a9a…
Patch:
https://github.com/kamailio/kamailio/commit/75df6618a6eaec8314480de193e2a9a…
1
0
0
0
git:4.4:20fd3b1a: pv: coherent indentation and whitespacing
by Daniel-Constantin Mierla
30 Mar '16
30 Mar '16
Module: kamailio Branch: 4.4 Commit: 20fd3b1a1e1663fc79b3b44e39a874ecbfc6ce5c URL:
https://github.com/kamailio/kamailio/commit/20fd3b1a1e1663fc79b3b44e39a874e…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2016-03-30T14:32:40+02:00 pv: coherent indentation and whitespacing (cherry picked from commit 594d1090b1b4cea26892f14f0adebc46bc05314b) --- Modified: modules/pv/pv_core.c --- Diff:
https://github.com/kamailio/kamailio/commit/20fd3b1a1e1663fc79b3b44e39a874e…
Patch:
https://github.com/kamailio/kamailio/commit/20fd3b1a1e1663fc79b3b44e39a874e…
1
0
0
0
git:master:9aeaf65b: topos: remove unused variables
by Daniel-Constantin Mierla
30 Mar '16
30 Mar '16
Module: kamailio Branch: master Commit: 9aeaf65b042b7e65d962a9949b9a56e60743d89a URL:
https://github.com/kamailio/kamailio/commit/9aeaf65b042b7e65d962a9949b9a56e…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2016-03-30T14:37:45+02:00 topos: remove unused variables --- Modified: modules/topos/tps_storage.c --- Diff:
https://github.com/kamailio/kamailio/commit/9aeaf65b042b7e65d962a9949b9a56e…
Patch:
https://github.com/kamailio/kamailio/commit/9aeaf65b042b7e65d962a9949b9a56e…
--- diff --git a/modules/topos/tps_storage.c b/modules/topos/tps_storage.c index a78cca3..8951ee1 100644 --- a/modules/topos/tps_storage.c +++ b/modules/topos/tps_storage.c @@ -1000,7 +1000,6 @@ int tps_storage_update_dialog(sip_msg_t *msg, tps_data_t *md, tps_data_t *sd) db_val_t db_vals[4]; db_key_t db_ucols[TPS_NR_KEYS]; db_val_t db_uvals[TPS_NR_KEYS]; - db1_res_t* db_res = NULL; int nr_keys; int nr_ucols; int ret; @@ -1089,7 +1088,6 @@ int tps_storage_end_dialog(sip_msg_t *msg, tps_data_t *md, tps_data_t *sd) db_val_t db_vals[4]; db_key_t db_ucols[TPS_NR_KEYS]; db_val_t db_uvals[TPS_NR_KEYS]; - db1_res_t* db_res = NULL; int nr_keys; int nr_ucols;
1
0
0
0
git:master:7c48b0fc: topos: swapping direction handling for contact in response
by Daniel-Constantin Mierla
30 Mar '16
30 Mar '16
Module: kamailio Branch: master Commit: 7c48b0fce5d59f237103cd26a61e616d74cabcb3 URL:
https://github.com/kamailio/kamailio/commit/7c48b0fce5d59f237103cd26a61e616…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2016-03-30T14:28:27+02:00 topos: swapping direction handling for contact in response --- Modified: modules/topos/tps_msg.c Modified: modules/topos/tps_storage.c --- Diff:
https://github.com/kamailio/kamailio/commit/7c48b0fce5d59f237103cd26a61e616…
Patch:
https://github.com/kamailio/kamailio/commit/7c48b0fce5d59f237103cd26a61e616…
--- diff --git a/modules/topos/tps_msg.c b/modules/topos/tps_msg.c index 4d747cd..2f398e8 100644 --- a/modules/topos/tps_msg.c +++ b/modules/topos/tps_msg.c @@ -624,7 +624,7 @@ int tps_reappend_route(sip_msg_t *msg, tps_data_t *ptsd, str *hbody, int rev) if(rev==1) { c = 0; sb.len = 1; - for(i=hbody->len-2; i>=0; i++) { + for(i=hbody->len-2; i>=0; i--) { if(hbody->s[i]==',') { c = 1; if(sb.len>0) { @@ -707,7 +707,7 @@ int tps_request_received(sip_msg_t *msg, int dialog) if(stsd.a_tag.len!=ftag.len) { direction = TPS_DIR_UPSTREAM; } else { - if(memcpy(stsd.a_tag.s, ftag.s, ftag.len)==0) { + if(memcmp(stsd.a_tag.s, ftag.s, ftag.len)==0) { direction = TPS_DIR_DOWNSTREAM; } else { direction = TPS_DIR_UPSTREAM; @@ -718,9 +718,9 @@ int tps_request_received(sip_msg_t *msg, int dialog) tps_storage_lock_release(&lkey); if(direction == TPS_DIR_UPSTREAM) { - nuri = stsd.b_contact; - } else { nuri = stsd.a_contact; + } else { + nuri = stsd.b_contact; } if(nuri.len>0) { if(rewrite_uri(msg, &nuri)<0) { @@ -804,7 +804,7 @@ int tps_response_received(sip_msg_t *msg) if(stsd.a_tag.len!=ftag.len) { direction = TPS_DIR_UPSTREAM; } else { - if(memcpy(stsd.a_tag.s, ftag.s, ftag.len)==0) { + if(memcmp(stsd.a_tag.s, ftag.s, ftag.len)==0) { direction = TPS_DIR_DOWNSTREAM; } else { direction = TPS_DIR_UPSTREAM; diff --git a/modules/topos/tps_storage.c b/modules/topos/tps_storage.c index 8852369..a78cca3 100644 --- a/modules/topos/tps_storage.c +++ b/modules/topos/tps_storage.c @@ -311,10 +311,18 @@ int tps_storage_link_msg(sip_msg_t *msg, tps_data_t *td, int dir) LM_ERR("bad Contact header\n"); return -1; } - if(dir==TPS_DIR_DOWNSTREAM) { - td->a_contact = ((contact_body_t*)msg->contact->parsed)->contacts->uri; + if(msg->first_line.type==SIP_REQUEST) { + if(dir==TPS_DIR_DOWNSTREAM) { + td->a_contact = ((contact_body_t*)msg->contact->parsed)->contacts->uri; + } else { + td->b_contact = ((contact_body_t*)msg->contact->parsed)->contacts->uri; + } } else { - td->b_contact = ((contact_body_t*)msg->contact->parsed)->contacts->uri; + if(dir==TPS_DIR_DOWNSTREAM) { + td->b_contact = ((contact_body_t*)msg->contact->parsed)->contacts->uri; + } else { + td->a_contact = ((contact_body_t*)msg->contact->parsed)->contacts->uri; + } } return 0; @@ -862,21 +870,38 @@ int tps_storage_load_dialog(sip_msg_t *msg, tps_data_t *md, tps_data_t *sd) if(msg==NULL || md==NULL || sd==NULL || _tps_db_handle==NULL) return -1; + if(md->a_uuid.len<=0 && md->b_uuid.len<=0) { + LM_ERR("no dlg uuid provided\n"); + return -1; + } + nr_keys = 0; nr_cols = 0; - db_keys[nr_keys]=&td_col_a_uuid; db_ops[nr_keys]=OP_EQ; db_vals[nr_keys].type = DB1_STR; db_vals[nr_keys].nul = 0; - if(md->a_uuid.len>0 && md->a_uuid.s[0]=='a') { - db_vals[nr_keys].val.str_val = TPS_STRZ(md->a_uuid); + db_vals[nr_keys].val.str_val.len = 0; + if(md->a_uuid.len>0) { + if(md->a_uuid.s[0]=='a') { + db_keys[nr_keys]=&td_col_a_uuid; + db_vals[nr_keys].val.str_val = TPS_STRZ(md->a_uuid); + } else if(md->a_uuid.s[0]=='b') { + db_keys[nr_keys]=&td_col_b_uuid; + db_vals[nr_keys].val.str_val = TPS_STRZ(md->a_uuid); + } } else { - if(md->b_uuid.len<=0) { - LM_ERR("no valid dlg uuid\n"); - return -1; + if(md->b_uuid.s[0]=='a') { + db_keys[nr_keys]=&td_col_a_uuid; + db_vals[nr_keys].val.str_val = TPS_STRZ(md->b_uuid); + } else if(md->b_uuid.s[0]=='b') { + db_keys[nr_keys]=&td_col_b_uuid; + db_vals[nr_keys].val.str_val = TPS_STRZ(md->b_uuid); } - db_vals[nr_keys].val.str_val = TPS_STRZ(md->b_uuid); + } + if(db_vals[nr_keys].val.str_val.len<=0) { + LM_ERR("invalid dlg uuid provided\n"); + return -1; } nr_keys++;
1
0
0
0
git:master:ee67b5ee: topos: reset the flags of dlg storage record on bye
by Daniel-Constantin Mierla
30 Mar '16
30 Mar '16
Module: kamailio Branch: master Commit: ee67b5ee18dbd791f898ad5f472715b7bf818cfc URL:
https://github.com/kamailio/kamailio/commit/ee67b5ee18dbd791f898ad5f472715b…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2016-03-30T13:41:40+02:00 topos: reset the flags of dlg storage record on bye --- Modified: modules/topos/tps_msg.c Modified: modules/topos/tps_storage.c Modified: modules/topos/tps_storage.h --- Diff:
https://github.com/kamailio/kamailio/commit/ee67b5ee18dbd791f898ad5f472715b…
Patch:
https://github.com/kamailio/kamailio/commit/ee67b5ee18dbd791f898ad5f472715b…
--- diff --git a/modules/topos/tps_msg.c b/modules/topos/tps_msg.c index c350db5..4d747cd 100644 --- a/modules/topos/tps_msg.c +++ b/modules/topos/tps_msg.c @@ -908,6 +908,10 @@ int tps_request_sent(sip_msg_t *msg, int dialog, int local) tps_reinsert_contact(msg, ptsd, &ptsd->bs_contact); } + if(dialog!=0) { + tps_storage_end_dialog(msg, &mtsd, ptsd); + } + done: tps_storage_lock_release(&lkey); return 0; diff --git a/modules/topos/tps_storage.c b/modules/topos/tps_storage.c index 3eb2b2d..8852369 100644 --- a/modules/topos/tps_storage.c +++ b/modules/topos/tps_storage.c @@ -978,7 +978,6 @@ int tps_storage_update_dialog(sip_msg_t *msg, tps_data_t *md, tps_data_t *sd) db1_res_t* db_res = NULL; int nr_keys; int nr_ucols; - int n; int ret; if(msg==NULL || md==NULL || sd==NULL || _tps_db_handle==NULL) @@ -1058,6 +1057,72 @@ int tps_storage_update_dialog(sip_msg_t *msg, tps_data_t *md, tps_data_t *sd) /** * */ +int tps_storage_end_dialog(sip_msg_t *msg, tps_data_t *md, tps_data_t *sd) +{ + db_key_t db_keys[4]; + db_op_t db_ops[4]; + db_val_t db_vals[4]; + db_key_t db_ucols[TPS_NR_KEYS]; + db_val_t db_uvals[TPS_NR_KEYS]; + db1_res_t* db_res = NULL; + int nr_keys; + int nr_ucols; + + if(msg==NULL || md==NULL || sd==NULL || _tps_db_handle==NULL) + return -1; + + if(md->s_method_id != METHOD_BYE) { + return 0; + } + + memset(db_ucols, 0, TPS_NR_KEYS*sizeof(db_key_t)); + memset(db_uvals, 0, TPS_NR_KEYS*sizeof(db_val_t)); + + nr_keys = 0; + nr_ucols = 0; + + db_keys[nr_keys]=&td_col_a_uuid; + db_ops[nr_keys]=OP_EQ; + db_vals[nr_keys].type = DB1_STR; + db_vals[nr_keys].nul = 0; + if(sd->a_uuid.len>0 && sd->a_uuid.s[0]=='a') { + db_vals[nr_keys].val.str_val = TPS_STRZ(sd->a_uuid); + } else { + if(sd->b_uuid.len<=0) { + LM_ERR("no valid dlg uuid\n"); + return -1; + } + db_vals[nr_keys].val.str_val = TPS_STRZ(sd->b_uuid); + } + nr_keys++; + + db_ucols[nr_ucols] = &td_col_rectime; + db_uvals[nr_ucols].type = DB1_DATETIME; + db_uvals[nr_ucols].val.time_val = time(NULL); + nr_ucols++; + + db_ucols[nr_ucols] = &td_col_iflags; + db_uvals[nr_ucols].type = DB1_INT; + db_uvals[nr_ucols].val.int_val = 0; + nr_ucols++; + + if (_tpsdbf.use_table(_tps_db_handle, &td_table_name) < 0) { + LM_ERR("failed to perform use table\n"); + return -1; + } + + if(_tpsdbf.update(_tps_db_handle, db_keys, db_ops, db_vals, + db_ucols, db_uvals, nr_keys, nr_ucols)!=0) { + LM_ERR("failed to do db update for [%.*s]!\n", + md->a_uuid.len, md->a_uuid.s); + return -1; + } + return 0; +} + +/** + * + */ void tps_storage_clean(unsigned int ticks, void* param) { tps_db_clean_branches(); diff --git a/modules/topos/tps_storage.h b/modules/topos/tps_storage.h index 4fb7e04..63793db 100644 --- a/modules/topos/tps_storage.h +++ b/modules/topos/tps_storage.h @@ -85,6 +85,7 @@ int tps_storage_load_branch(sip_msg_t *msg, tps_data_t *md, tps_data_t *sd); int tps_storage_update_branch(sip_msg_t *msg, tps_data_t *md, tps_data_t *sd); int tps_storage_load_dialog(sip_msg_t *msg, tps_data_t *md, tps_data_t *sd); int tps_storage_update_dialog(sip_msg_t *msg, tps_data_t *md, tps_data_t *sd); +int tps_storage_end_dialog(sip_msg_t *msg, tps_data_t *md, tps_data_t *sd); int tps_storage_lock_set_init(void); int tps_storage_lock_get(str *lkey);
1
0
0
0
git:master:0103cc98: topos: clean not confrmed dialogs from db storage based on branch expires
by Daniel-Constantin Mierla
30 Mar '16
30 Mar '16
Module: kamailio Branch: master Commit: 0103cc98b80a16081c1da39d6d674e9eba98f91b URL:
https://github.com/kamailio/kamailio/commit/0103cc98b80a16081c1da39d6d674e9…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2016-03-30T13:30:07+02:00 topos: clean not confrmed dialogs from db storage based on branch expires --- Modified: modules/topos/tps_storage.c --- Diff:
https://github.com/kamailio/kamailio/commit/0103cc98b80a16081c1da39d6d674e9…
Patch:
https://github.com/kamailio/kamailio/commit/0103cc98b80a16081c1da39d6d674e9…
--- diff --git a/modules/topos/tps_storage.c b/modules/topos/tps_storage.c index 632d2ca..3eb2b2d 100644 --- a/modules/topos/tps_storage.c +++ b/modules/topos/tps_storage.c @@ -539,17 +539,18 @@ int tps_db_clean_dialogs(void) { db_key_t db_keys[2]; db_val_t db_vals[2]; - db_op_t db_ops[2] = { OP_LEQ }; + db_op_t db_ops[2]; int nr_keys; nr_keys = 0; LM_DBG("cleaning expired dialog records\n"); - db_keys[0] = &td_col_rectime; - db_vals[0].type = DB1_DATETIME; - db_vals[0].nul = 0; - db_vals[0].val.time_val = time(NULL) - _tps_dialog_expire; + db_keys[nr_keys] = &td_col_rectime; + db_ops[nr_keys] = OP_LEQ; + db_vals[nr_keys].type = DB1_DATETIME; + db_vals[nr_keys].nul = 0; + db_vals[nr_keys].val.time_val = time(NULL) - _tps_dialog_expire; nr_keys++; if (_tpsdbf.use_table(_tps_db_handle, &td_table_name) < 0) { @@ -560,6 +561,21 @@ int tps_db_clean_dialogs(void) if (_tpsdbf.delete(_tps_db_handle, db_keys, db_ops, db_vals, nr_keys) < 0) { LM_DBG("failed to clean expired dialog records\n"); } + + /* dialog not confirmed - delete dlg after branch expires */ + db_vals[0].val.time_val = time(NULL) - _tps_branch_expire; + + db_keys[nr_keys] = &td_col_iflags; + db_ops[nr_keys] = OP_EQ; + db_vals[nr_keys].type = DB1_INT; + db_vals[nr_keys].nul = 0; + db_vals[nr_keys].val.int_val = 0; + nr_keys++; + + if (_tpsdbf.delete(_tps_db_handle, db_keys, db_ops, db_vals, nr_keys) < 0) { + LM_DBG("failed to clean expired dialog records\n"); + } + return 0; } @@ -670,17 +686,18 @@ int tps_db_clean_branches(void) { db_key_t db_keys[2]; db_val_t db_vals[2]; - db_op_t db_ops[2] = { OP_LEQ }; + db_op_t db_ops[2]; int nr_keys; nr_keys = 0; LM_DBG("cleaning expired branch records\n"); - db_keys[0] = &tt_col_rectime; - db_vals[0].type = DB1_DATETIME; - db_vals[0].nul = 0; - db_vals[0].val.time_val = time(NULL) - _tps_branch_expire; + db_keys[nr_keys] = &tt_col_rectime; + db_ops[nr_keys] = OP_LEQ; + db_vals[nr_keys].type = DB1_DATETIME; + db_vals[nr_keys].nul = 0; + db_vals[nr_keys].val.time_val = time(NULL) - _tps_branch_expire; nr_keys++; if (_tpsdbf.use_table(_tps_db_handle, &tt_table_name) < 0) {
1
0
0
0
git:master:ed262dfb: topos: update the db storeage for confirmed dialogs
by Daniel-Constantin Mierla
30 Mar '16
30 Mar '16
Module: kamailio Branch: master Commit: ed262dfb056f94e2fc81bcb59cd744f4924a76ef URL:
https://github.com/kamailio/kamailio/commit/ed262dfb056f94e2fc81bcb59cd744f…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2016-03-30T13:30:07+02:00 topos: update the db storeage for confirmed dialogs --- Modified: modules/topos/tps_msg.c Modified: modules/topos/tps_storage.c --- Diff:
https://github.com/kamailio/kamailio/commit/ed262dfb056f94e2fc81bcb59cd744f…
Patch:
https://github.com/kamailio/kamailio/commit/ed262dfb056f94e2fc81bcb59cd744f…
--- diff --git a/modules/topos/tps_msg.c b/modules/topos/tps_msg.c index f11c0bb..c350db5 100644 --- a/modules/topos/tps_msg.c +++ b/modules/topos/tps_msg.c @@ -668,6 +668,8 @@ int tps_request_received(sip_msg_t *msg, int dialog) uint32_t direction = TPS_DIR_DOWNSTREAM; int ret; + LM_DBG("handling incoming request\n"); + if(dialog==0) { /* nothing to do for initial request */ return 0; @@ -765,6 +767,8 @@ int tps_response_received(sip_msg_t *msg) str ftag; uint32_t direction; + LM_DBG("handling incoming response\n"); + if(msg->first_line.u.reply.statuscode==100) { /* nothing to do - it should be absorbed */ return 0; @@ -840,6 +844,8 @@ int tps_request_sent(sip_msg_t *msg, int dialog, int local) str xuuid; int direction = TPS_DIR_DOWNSTREAM; + LM_DBG("handling outgoing request\n"); + memset(&mtsd, 0, sizeof(tps_data_t)); memset(&btsd, 0, sizeof(tps_data_t)); memset(&stsd, 0, sizeof(tps_data_t)); @@ -872,7 +878,7 @@ int tps_request_sent(sip_msg_t *msg, int dialog, int local) } if(dialog!=0) { - if(tps_storage_load_dialog(msg, &btsd, &stsd)==0) { + if(tps_storage_load_dialog(msg, &mtsd, &stsd)==0) { ptsd = &stsd; } } @@ -923,6 +929,8 @@ int tps_response_sent(sip_msg_t *msg) int direction = TPS_DIR_UPSTREAM; str xvbranch = {0, 0}; + LM_DBG("handling outgoing response\n"); + memset(&mtsd, 0, sizeof(tps_data_t)); memset(&stsd, 0, sizeof(tps_data_t)); memset(&btsd, 0, sizeof(tps_data_t)); diff --git a/modules/topos/tps_storage.c b/modules/topos/tps_storage.c index 4fb7cd6..632d2ca 100644 --- a/modules/topos/tps_storage.c +++ b/modules/topos/tps_storage.c @@ -1009,6 +1009,21 @@ int tps_storage_update_dialog(sip_msg_t *msg, tps_data_t *md, tps_data_t *sd) db_uvals[nr_ucols].val.str_val = TPS_STRZ(md->b_rr); nr_ucols++; + if(msg->first_line.type==SIP_REPLY) { + if(sd->b_tag.len<=0 + && msg->first_line.u.reply.statuscode>=200 + && msg->first_line.u.reply.statuscode<300) { + db_ucols[nr_ucols] = &td_col_b_tag; + db_uvals[nr_ucols].type = DB1_STR; + db_uvals[nr_ucols].val.str_val = TPS_STRZ(md->b_tag); + nr_ucols++; + + db_ucols[nr_ucols] = &td_col_iflags; + db_uvals[nr_ucols].type = DB1_INT; + db_uvals[nr_ucols].val.int_val = 1; + nr_ucols++; + } + } if (_tpsdbf.use_table(_tps_db_handle, &td_table_name) < 0) { LM_ERR("failed to perform use table\n"); return -1;
1
0
0
0
← Newer
1
...
5
6
7
8
9
10
11
...
39
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
35
36
37
38
39
Results per page:
10
25
50
100
200