Skip to content

Commit b9ba14d

Browse files
author
Andriy Pylypenko
committed
Merge remote-tracking branch 'upstream/master'
2 parents 83cc7f1 + 3f96487 commit b9ba14d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+4200
-1115
lines changed

.github/workflows/main.yml

+2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ jobs:
4444
steps:
4545
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
4646
- uses: actions/checkout@v2
47+
with:
48+
submodules: recursive
4749

4850
- name: before_install
4951
run: sh -x scripts/build/install_depends.sh

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "modules/wolfssl/lib/wolfssl"]
2+
path = modules/wolfssl/lib/wolfssl
3+
url = [email protected]:wolfSSL/wolfssl.git

Makefile.conf.template

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
#xmpp= Gateway between OpenSIPS and a jabber server. It enables the exchange of IMs between SIP clients and XMPP(jabber) clients. | parsing/building XML files, typically libexpat1-devel
6464
#uuid= UUID generator | uuid-dev
6565

66-
exclude_modules?= aaa_radius auth_jwt b2b_logic cachedb_cassandra cachedb_couchbase cachedb_memcached cachedb_mongodb cachedb_redis carrierroute cgrates compression cpl_c db_berkeley db_http db_mysql db_oracle db_perlvdb db_postgres db_sqlite db_unixodbc dialplan emergency event_rabbitmq h350 httpd identity jabber json ldap lua mi_xmlrpc_ng mmgeoip osp perl pi_http presence presence_dialoginfo presence_mwi presence_xml presence_dfks proto_sctp proto_tls proto_wss pua pua_bla pua_dialoginfo pua_mi pua_usrloc pua_xmpp python regex rabbitmq rabbitmq_consumer rest_client rls siprec sngtc snmpstats stir_shaken tls_mgm uuid xcap xcap_client xml xmpp
66+
exclude_modules?= aaa_radius auth_jwt b2b_logic cachedb_cassandra cachedb_couchbase cachedb_memcached cachedb_mongodb cachedb_redis carrierroute cgrates compression cpl_c db_berkeley db_http db_mysql db_oracle db_perlvdb db_postgres db_sqlite db_unixodbc dialplan emergency event_rabbitmq event_kafka h350 httpd identity jabber json ldap lua mi_xmlrpc_ng mmgeoip osp perl pi_http presence presence_dialoginfo presence_mwi presence_xml presence_dfks proto_sctp proto_tls proto_wss pua pua_bla pua_dialoginfo pua_mi pua_usrloc pua_xmpp python regex rabbitmq rabbitmq_consumer rest_client rls siprec sngtc snmpstats stir_shaken tls_mgm uuid xcap xcap_client xml xmpp
6767

6868
include_modules?=
6969

Makefile.rules

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ all_misclibs=reg
2222
all_misclibs:=$(addprefix lib/, $(all_misclibs))
2323

2424
#implicit rules
25-
%.o: %.c $(ALLDEP)
25+
%.o: %.c $(ALLDEP) $(DEPS)
2626
ifeq (,$(FASTER))
2727
@echo "Compiling $<"
2828
endif

action.c

+9
Original file line numberDiff line numberDiff line change
@@ -1260,6 +1260,15 @@ void release_dummy_sip_msg( struct sip_msg* req)
12601260
req->set_global_address.len = req->set_global_port.len = 0;
12611261
req->add_rm = req->body_lumps = NULL;
12621262
req->reply_lump = NULL;
1263+
req->ruri_q = Q_UNSPECIFIED;
1264+
req->ruri_bflags = 0;
1265+
req->force_send_socket = NULL;
1266+
req->parsed_uri_ok = 0;
1267+
req->parsed_orig_ruri_ok = 0;
1268+
req->add_to_branch_len = 0;
1269+
req->flags = 0;
1270+
req->msg_flags = 0;
1271+
memset( &req->time, 0, sizeof(struct timeval));
12631272
dummy_static_in_used = 0;
12641273
} else {
12651274
LM_DBG("freeing allocated sip msg %p\n",req);

ip_addr.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757

5858
enum sip_protos { PROTO_NONE = 0, PROTO_FIRST = 1, PROTO_UDP = 1, \
5959
PROTO_TCP, PROTO_TLS, PROTO_SCTP, PROTO_WS, PROTO_WSS, PROTO_BIN,
60-
PROTO_HEP_UDP, PROTO_HEP_TCP, PROTO_SMPP, PROTO_OTHER };
60+
PROTO_BINS, PROTO_HEP_UDP, PROTO_HEP_TCP, PROTO_SMPP, PROTO_OTHER };
6161
#define PROTO_LAST PROTO_OTHER
6262

6363
struct ip_addr{

main.c

+11-9
Original file line numberDiff line numberDiff line change
@@ -358,15 +358,17 @@ int main(int argc, char** argv)
358358
if (tmp &&(*tmp)){
359359
LM_ERR("bad pkgmem size number: -m %s\n", optarg);
360360
goto error00;
361-
};
362-
361+
}
363362
break;
364363
case 'm':
365364
shm_mem_size=strtol(optarg, &tmp, 10) * 1024 * 1024;
366365
if (tmp &&(*tmp)){
367366
LM_ERR("bad shmem size number: -m %s\n", optarg);
368367
goto error00;
369-
};
368+
}
369+
break;
370+
case 'd':
371+
*log_level = debug_mode ? L_DBG : (*log_level)+1;
370372
break;
371373
case 'u':
372374
user=optarg;
@@ -449,6 +451,7 @@ int main(int argc, char** argv)
449451
break;
450452
case 'm':
451453
case 'M':
454+
case 'd':
452455
case 'a':
453456
case 'k':
454457
case 's':
@@ -491,9 +494,6 @@ int main(int argc, char** argv)
491494
case 'R':
492495
received_dns|=DO_REV_DNS;
493496
break;
494-
case 'd':
495-
*log_level = debug_mode ? L_DBG : (*log_level)+1;
496-
break;
497497
case 'D':
498498
debug_mode=1;
499499
*log_level = L_DBG;
@@ -779,11 +779,13 @@ int main(int argc, char** argv)
779779
LM_NOTICE("version: %s\n", version);
780780

781781
/* print some data about the configuration */
782-
LM_INFO("using %ld Mb of shared memory\n", shm_mem_size/1024/1024);
782+
LM_NOTICE("using %ld MB of shared memory, allocator: %s\n",
783+
shm_mem_size/1024/1024, mm_str(mem_allocator_shm));
783784
#if defined(PKG_MALLOC)
784-
LM_INFO("using %ld Mb of private process memory\n", pkg_mem_size/1024/1024);
785+
LM_NOTICE("using %ld MB of private process memory, allocator: %s\n",
786+
pkg_mem_size/1024/1024, mm_str(mem_allocator_pkg));
785787
#else
786-
LM_INFO("using system memory for private process memory\n");
788+
LM_NOTICE("using system memory for private process memory\n");
787789
#endif
788790

789791
/* init async reactor */

modules/acc/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
include ../../Makefile.defs
99
auto_gen=
1010
NAME=acc.so
11-
LIBS=
11+
LIBS=-lm
1212

1313
# set ENABLE_DIAMETER_ACC to true if you wish to enable DIAMETER accounting
1414
# (uncomment next line or 'ENABLE_DIAMETER_ACC=true make all')

modules/acc/README

+2-2
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,7 @@ Chapter 3. Contributors
10671067
1. Bogdan-Andrei Iancu (@bogdan-iancu) 222 111 4302 4578
10681068
2. Jan Janak (@janakj) 145 16 5587 5074
10691069
3. Ionut Ionita (@ionutrazvanionita) 139 39 3730 4180
1070-
4. Razvan Crainea (@razvancrainea) 95 62 2678 616
1070+
4. Razvan Crainea (@razvancrainea) 97 64 2702 635
10711071
5. Liviu Chircu (@liviuchircu) 60 46 585 545
10721072
6. Jiri Kuthan (@jiriatipteldotorg) 56 26 2272 660
10731073
7. Daniel-Constantin Mierla (@miconda) 26 23 115 88
@@ -1104,7 +1104,7 @@ Chapter 3. Contributors
11041104

11051105
Table 3.2. Most recently active contributors^(1) to this module
11061106
Name Commit Activity
1107-
1. Razvan Crainea (@razvancrainea) Aug 2010 - Feb 2021
1107+
1. Razvan Crainea (@razvancrainea) Aug 2010 - Mar 2021
11081108
2. Maksym Sobolyev (@sobomax) Dec 2003 - Jan 2021
11091109
3. Liviu Chircu (@liviuchircu) Jan 2013 - Sep 2020
11101110
4. Bogdan-Andrei Iancu (@bogdan-iancu) Dec 2003 - May 2020

modules/acc/acc.c

+22-17
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
#include <stdio.h>
3737
#include <time.h>
38+
#include <math.h>
3839

3940
#include "../../dprint.h"
4041
#include "../../error.h"
@@ -178,7 +179,7 @@ static inline int core2strar( struct sip_msg *req, str *c_vals)
178179

179180
c_vals[5] = acc_env.reason;
180181

181-
gettimeofday(&acc_env.ts, NULL);
182+
acc_env.ts = *get_msg_time(req);
182183

183184
return ACC_CORE_LEN;
184185
}
@@ -221,6 +222,8 @@ int acc_log_cdrs(struct dlg_cell *dlg, struct sip_msg *msg, acc_ctx_t* ctx)
221222
{
222223
static char log_msg[MAX_SYSLOG_SIZE];
223224
static char *log_msg_end=log_msg+MAX_SYSLOG_SIZE-2;
225+
unsigned long ms_duration;
226+
unsigned long duration;
224227
char *p;
225228
int i, j, ret, res = -1, n;
226229
struct timeval start_time;
@@ -284,12 +287,13 @@ int acc_log_cdrs(struct dlg_cell *dlg, struct sip_msg *msg, acc_ctx_t* ctx)
284287
*(p++) = '\n';
285288
*(p++) = 0;
286289

290+
ms_duration = TIMEVAL_MS_DIFF(start_time, ctx->bye_time);
291+
duration = ceil((double)ms_duration/1000);
292+
287293
LM_GEN2(acc_log_facility, acc_log_level,
288294
"%.*screated=%lu;call_start_time=%lu;duration=%lu;ms_duration=%lu;setuptime=%lu%s",
289295
acc_env.text.len, acc_env.text.s,(unsigned long)ctx->created,
290-
(unsigned long)start_time.tv_sec,
291-
(unsigned long)(ctx->bye_time.tv_sec-start_time.tv_sec),
292-
(unsigned long)TIMEVAL_MS_DIFF(start_time, ctx->bye_time),
296+
(unsigned long)start_time.tv_sec, duration, ms_duration,
293297
(unsigned long)(start_time.tv_sec - ctx->created), log_msg);
294298

295299
res = 1;
@@ -680,10 +684,10 @@ int acc_db_cdrs(struct dlg_cell *dlg, struct sip_msg *msg, acc_ctx_t* ctx)
680684
start_time.tv_sec - ctx->created;
681685
VAL_NULL(db_vals+ret+nr_leg_vals+2) = 0;
682686
VAL_TIME(db_vals+ret+nr_leg_vals+2) = ctx->created;
683-
VAL_INT(db_vals+ret+nr_leg_vals+3) =
684-
ctx->bye_time.tv_sec - start_time.tv_sec;
685687
VAL_INT(db_vals+ret+nr_leg_vals+4) =
686688
TIMEVAL_MS_DIFF(start_time, ctx->bye_time);
689+
VAL_INT(db_vals+ret+nr_leg_vals+3) =
690+
ceil((double)VAL_INT(db_vals+ret+nr_leg_vals+4)/1000);
687691

688692
total = ret + 5;
689693
acc_dbf.use_table(db_handle, &table);
@@ -937,6 +941,7 @@ int acc_aaa_cdrs(struct dlg_cell *dlg, struct sip_msg *msg, acc_ctx_t* ctx)
937941
int offset, av_type;
938942
aaa_map *r_stat;
939943
int locked = 0;
944+
uint32_t duration, ms_duration;
940945

941946
struct acc_extra* extra;
942947

@@ -980,11 +985,11 @@ int acc_aaa_cdrs(struct dlg_cell *dlg, struct sip_msg *msg, acc_ctx_t* ctx)
980985
ADD_AAA_AVPAIR( offset + i, val_arr[i].s, val_arr[i].len );
981986
offset = ret + 2;
982987

988+
ms_duration = TIMEVAL_MS_DIFF(start_time, ctx->bye_time);
989+
duration = ceil((double)ms_duration/1000);
983990
/* add duration and setup values */
984-
av_type = (uint32_t)(ctx->bye_time.tv_sec - start_time.tv_sec);
985-
ADD_AAA_AVPAIR( offset + nr_leg_vals, &av_type, -1);
986-
av_type = (uint32_t)TIMEVAL_MS_DIFF(start_time, ctx->bye_time);
987-
ADD_AAA_AVPAIR( offset + nr_leg_vals + 1, &av_type, -1);
991+
ADD_AAA_AVPAIR( offset + nr_leg_vals, &duration, -1);
992+
ADD_AAA_AVPAIR( offset + nr_leg_vals + 1, &ms_duration, -1);
988993
av_type = (uint32_t)(start_time.tv_sec - ctx->created);
989994
ADD_AAA_AVPAIR( offset + nr_leg_vals + 2, &av_type, -1);
990995

@@ -1295,9 +1300,9 @@ int acc_evi_cdrs(struct dlg_cell *dlg, struct sip_msg *msg, acc_ctx_t* ctx)
12951300
{
12961301
int i, ret, res = -1, j;
12971302
int nr_leg_vals;
1298-
int aux_time;
12991303
struct timeval start_time;
13001304
str core_s, leg_s, extra_s;
1305+
unsigned long duration, ms_duration, setup_duration;
13011306

13021307
struct acc_extra* extra;
13031308

@@ -1335,19 +1340,19 @@ int acc_evi_cdrs(struct dlg_cell *dlg, struct sip_msg *msg, acc_ctx_t* ctx)
13351340
goto end;
13361341
}
13371342

1338-
aux_time = ctx->bye_time.tv_sec - start_time.tv_sec;
1339-
if (evi_param_set_int(evi_cdr_params[ret+nr_leg_vals+1], &aux_time) < 0) {
1343+
ms_duration = TIMEVAL_MS_DIFF(start_time, ctx->bye_time);
1344+
duration = ceil((double)ms_duration/1000);
1345+
if (evi_param_set_int(evi_cdr_params[ret+nr_leg_vals+1], &duration) < 0) {
13401346
LM_ERR("cannot set duration parameter\n");
13411347
goto end;
13421348
}
13431349

1344-
aux_time = TIMEVAL_MS_DIFF(start_time, ctx->bye_time);
1345-
if (evi_param_set_int(evi_cdr_params[ret+nr_leg_vals+2], &aux_time) < 0) {
1350+
if (evi_param_set_int(evi_cdr_params[ret+nr_leg_vals+2], &ms_duration) < 0) {
13461351
LM_ERR("cannot set duration parameter\n");
13471352
goto end;
13481353
}
1349-
aux_time = start_time.tv_sec - ctx->created;
1350-
if (evi_param_set_int(evi_cdr_params[ret+nr_leg_vals+3], &aux_time) < 0) {
1354+
setup_duration = start_time.tv_sec - ctx->created;
1355+
if (evi_param_set_int(evi_cdr_params[ret+nr_leg_vals+3], &setup_duration) < 0) {
13511356
LM_ERR("cannot set setuptime parameter\n");
13521357
goto end;
13531358
}

modules/acc/acc_logic.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ static void acc_dlg_ended(struct dlg_cell *dlg, int type,
851851
set_dlg_cb_used(ctx->flags);
852852

853853
/* this time will be used to set */
854-
gettimeofday(&ctx->bye_time, NULL);
854+
ctx->bye_time = *get_msg_time(_params->msg);
855855

856856
/* if it's not a local transaction we do the accounting on the tm callbacks */
857857
if (((t=tmb.t_gett()) == T_UNDEFINED) || !t ||

modules/acc/doc/contributors.xml

+5-5
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@
4545
<row>
4646
<entry>4. </entry>
4747
<entry>Razvan Crainea (<ulink url="https://github.com/razvancrainea">@razvancrainea</ulink>)</entry>
48-
<entry align="center">95</entry>
49-
<entry align="center">62</entry>
50-
<entry align="center">2678</entry>
51-
<entry align="center">616</entry>
48+
<entry align="center">97</entry>
49+
<entry align="center">64</entry>
50+
<entry align="center">2702</entry>
51+
<entry align="center">635</entry>
5252
</row>
5353
<row>
5454
<entry>5. </entry>
@@ -129,7 +129,7 @@
129129
<row>
130130
<entry>1. </entry>
131131
<entry>Razvan Crainea (<ulink url="https://github.com/razvancrainea">@razvancrainea</ulink>)</entry>
132-
<entry align="center">Aug 2010 - Feb 2021</entry>
132+
<entry align="center">Aug 2010 - Mar 2021</entry>
133133
</row>
134134
<row>
135135
<entry>2. </entry>

modules/auth_aaa/README

+11-13
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,8 @@ modparam("auth_aaa", "use_ruri_flag", "USE_RURI_FLAG")
216216
Example 1.6. aaa_www_authorize usage
217217

218218
...
219-
if (!aaa_www_authorize("siphub.net")) {
220-
www_challenge("siphub.net", "1");
221-
};
219+
if (!aaa_www_authorize("siphub.net"))
220+
www_challenge("siphub.net", "auth");
222221
...
223222

224223

@@ -257,14 +256,13 @@ if (!aaa_www_authorize("siphub.net")) {
257256
Example 1.7. proxy_authorize usage
258257

259258
...
260-
if (!aaa_proxy_authorize("")) { # Realm and URI user will be autogener
261-
ated
262-
proxy_challenge("", "1");
263-
};
259+
if (!aaa_proxy_authorize("")) # Realm and URI user will be autogenera
260+
ted
261+
proxy_challenge("", "auth");
264262
...
265-
if (!aaa_proxy_authorize($pd, $pU)) { # Realm and URI user are taken
266-
proxy_challenge($pd, "1"); # from P-Preferred-Identity
267-
}; # header field
263+
if (!aaa_proxy_authorize($pd, $pU)) # Realm and URI user are taken
264+
proxy_challenge($pd, "auth"); # from P-Preferred-Identity
265+
# header field
268266
...
269267

270268

@@ -317,7 +315,7 @@ Chapter 2. Contributors
317315
Name DevScore Commits Lines ++ Lines --
318316
1. Jan Janak (@janakj) 87 24 3294 2182
319317
2. Bogdan-Andrei Iancu (@bogdan-iancu) 44 31 892 255
320-
3. Liviu Chircu (@liviuchircu) 17 14 73 119
318+
3. Liviu Chircu (@liviuchircu) 19 15 80 128
321319
4. Daniel-Constantin Mierla (@miconda) 15 13 67 55
322320
5. Irina-Maria Stanescu 15 8 185 299
323321
6. Maksym Sobolyev (@sobomax) 11 6 167 171
@@ -351,8 +349,8 @@ Chapter 2. Contributors
351349

352350
Table 2.2. Most recently active contributors^(1) to this module
353351
Name Commit Activity
354-
1. Bogdan-Andrei Iancu (@bogdan-iancu) Jun 2005 - May 2020
355-
2. Liviu Chircu (@liviuchircu) Jan 2013 - Jan 2020
352+
1. Liviu Chircu (@liviuchircu) Jan 2013 - Mar 2021
353+
2. Bogdan-Andrei Iancu (@bogdan-iancu) Jun 2005 - May 2020
356354
3. Razvan Crainea (@razvancrainea) Feb 2012 - Sep 2019
357355
4. Vlad Patrascu (@rvlad-patrascu) May 2017 - Apr 2019
358356
5. Peter Lemenkov (@lemenkov) Jun 2018 - Jun 2018

modules/auth_aaa/doc/auth_aaa_admin.xml

+7-9
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,8 @@ modparam("auth_aaa", "use_ruri_flag", "USE_RURI_FLAG")
247247
<programlisting format="linespecific">
248248

249249
...
250-
if (!aaa_www_authorize("siphub.net")) {
251-
www_challenge("siphub.net", "1");
252-
};
250+
if (!aaa_www_authorize("siphub.net"))
251+
www_challenge("siphub.net", "auth");
253252
...
254253

255254
</programlisting>
@@ -305,13 +304,12 @@ if (!aaa_www_authorize("siphub.net")) {
305304
<programlisting format="linespecific">
306305

307306
...
308-
if (!aaa_proxy_authorize("")) { # Realm and URI user will be autogenerated
309-
proxy_challenge("", "1");
310-
};
307+
if (!aaa_proxy_authorize("")) # Realm and URI user will be autogenerated
308+
proxy_challenge("", "auth");
311309
...
312-
if (!aaa_proxy_authorize($pd, $pU)) { # Realm and URI user are taken
313-
proxy_challenge($pd, "1"); # from P-Preferred-Identity
314-
}; # header field
310+
if (!aaa_proxy_authorize($pd, $pU)) # Realm and URI user are taken
311+
proxy_challenge($pd, "auth"); # from P-Preferred-Identity
312+
# header field
315313
...
316314

317315
</programlisting>

0 commit comments

Comments
 (0)