Project

General

Profile

Kamailio Keeps Failing » cop.txt

moumen pmg, 06/16/2019 08:34 AM

 
1
Hey everyone , i've read almost all the posts here , tried everything but this kamailio just won't start , i managed to start at first but with a self signed certificate now i'm using Let's encrypt with an ip&domain .Maybe i misconfigured something here is my codes .
2
This is a Centos7 Server From Digital Ocean , I followed the From Scratch installation & fixed a lot of ip's import databases manually and all that , all the posts have been really helpful
3
<kamailio.cfg>
4
<pre><code class="yaml">
5
#!KAMAILIO
6
#
7
#!define WITH_MYSQL
8
#!define WITH_AUTH
9
#!define WITH_USRLOCDB
10
#!define WITH_NAT
11
#!define WITH_ANTIFLOOD
12
#
13
#
14
# Kamailio (OpenSER) SIP Server v5.0 - default configuration script
15
#     - web: http://www.kamailio.org
16
#     - git: http://sip-router.org
17
#
18
# Direct your questions about this file to: <sr-users@lists.sip-router.org>
19
#
20
# Refer to the Core CookBook at http://www.kamailio.org/wiki/
21
# for an explanation of possible statements, functions and parameters.
22
#
23
# Several features can be enabled using '#!define WITH_FEATURE' directives:
24
#
25
# *** To run in debug mode: 
26
#     - define WITH_DEBUG
27
#
28
# *** To enable mysql: 
29
#     - define WITH_MYSQL
30
#
31
# *** To enable authentication execute:
32
#     - enable mysql
33
#     - define WITH_AUTH
34
#     - add users using 'kamctl'
35
#
36
# *** To enable IP authentication execute:
37
#     - enable mysql
38
#     - enable authentication
39
#     - define WITH_IPAUTH
40
#     - add IP addresses with group id '1' to 'address' table
41
#
42
# *** To enable persistent user location execute:
43
#     - enable mysql
44
#     - define WITH_USRLOCDB
45
#
46
# *** To enable presence server execute:
47
#     - enable mysql
48
#     - define WITH_PRESENCE
49
#
50
# *** To enable nat traversal execute:
51
#     - define WITH_NAT
52
#     - install RTPProxy: http://www.rtpproxy.org
53
#     - start RTPProxy:
54
#        rtpproxy -l _your_public_ip_ -s udp:localhost:7722
55
#     - option for NAT SIP OPTIONS keepalives: WITH_NATSIPPING
56
#
57
# *** To enable PSTN gateway routing execute:
58
#     - define WITH_PSTN
59
#     - set the value of pstn.gw_ip
60
#     - check route[PSTN] for regexp routing condition
61
#
62
# *** To enable database aliases lookup execute:
63
#     - enable mysql
64
#     - define WITH_ALIASDB
65
#
66
# *** To enable speed dial lookup execute:
67
#     - enable mysql
68
#     - define WITH_SPEEDDIAL
69
#
70
# *** To enable multi-domain support execute:
71
#     - enable mysql
72
#     - define WITH_MULTIDOMAIN
73
#
74
# *** To enable TLS support execute:
75
#     - adjust CFGDIR/tls.cfg as needed
76
#     - define WITH_TLS
77
#
78
# *** To enable XMLRPC support execute:
79
#     - define WITH_XMLRPC
80
#     - adjust route[XMLRPC] for access policy
81
#
82
# *** To enable anti-flood detection execute:
83
#     - adjust pike and htable=>ipban settings as needed (default is
84
#       block if more than 16 requests in 2 seconds and ban for 300 seconds)
85
#     - define WITH_ANTIFLOOD
86
#
87
# *** To block 3XX redirect replies execute:
88
#     - define WITH_BLOCK3XX
89
#
90
# *** To enable VoiceMail routing execute:
91
#     - define WITH_VOICEMAIL
92
#     - set the value of voicemail.srv_ip
93
#     - adjust the value of voicemail.srv_port
94
#
95
# *** To enhance accounting execute:
96
#     - enable mysql
97
#     - define WITH_ACCDB
98
#     - add following columns to database
99
#!ifdef ACCDB_COMMENT
100
  ALTER TABLE acc ADD COLUMN src_user VARCHAR(64) NOT NULL DEFAULT '';
101
  ALTER TABLE acc ADD COLUMN src_domain VARCHAR(128) NOT NULL DEFAULT '';
102
  ALTER TABLE acc ADD COLUMN src_ip varchar(64) NOT NULL default '';
103
  ALTER TABLE acc ADD COLUMN dst_ouser VARCHAR(64) NOT NULL DEFAULT '';
104
  ALTER TABLE acc ADD COLUMN dst_user VARCHAR(64) NOT NULL DEFAULT '';
105
  ALTER TABLE acc ADD COLUMN dst_domain VARCHAR(128) NOT NULL DEFAULT '';
106
  ALTER TABLE missed_calls ADD COLUMN src_user VARCHAR(64) NOT NULL DEFAULT '';
107
  ALTER TABLE missed_calls ADD COLUMN src_domain VARCHAR(128) NOT NULL DEFAULT '';
108
  ALTER TABLE missed_calls ADD COLUMN src_ip varchar(64) NOT NULL default '';
109
  ALTER TABLE missed_calls ADD COLUMN dst_ouser VARCHAR(64) NOT NULL DEFAULT '';
110
  ALTER TABLE missed_calls ADD COLUMN dst_user VARCHAR(64) NOT NULL DEFAULT '';
111
  ALTER TABLE missed_calls ADD COLUMN dst_domain VARCHAR(128) NOT NULL DEFAULT '';
112
#!endif
113

    
114
####### Include Local Config If Exists #########
115
import_file "kamailio-local.cfg" 
116

    
117
####### Defined Values #########
118

    
119
# *** Value defines - IDs used later in config
120
#!ifdef WITH_MYSQL
121
# - database URL - used to connect to database server by modules such
122
#       as: auth_db, acc, usrloc, a.s.o.
123
#!ifndef DBURL
124
#!define DBURL "mysql://kamailiou:kamailiou1234@localhost/kamailio" 
125
#!endif
126
#!endif
127
#!ifdef WITH_MULTIDOMAIN
128
# - the value for 'use_domain' parameters
129
#!define MULTIDOMAIN 1
130
#!else
131
#!define MULTIDOMAIN 0
132
#!endif
133

    
134
# - flags
135
#   FLT_ - per transaction (message) flags
136
#    FLB_ - per branch flags
137
#!define FLT_ACC 1
138
#!define FLT_ACCMISSED 2
139
#!define FLT_ACCFAILED 3
140
#!define FLT_NATS 5
141

    
142
#!define FLB_NATB 6
143
#!define FLB_NATSIPPING 7
144

    
145
#!substdef "!MY_IP_ADDR!165.22.15.111!g" 
146
#!substdef "!MY_DOMAIN!callcenter.siarum.com!g" 
147
#!substdef "!MY_WS_PORT!8081!g" 
148
#!substdef "!MY_WSS_PORT!4443!g" 
149
#!substdef "!MY_MSRP_PORT!9080!g" 
150
#!substdef "!MY_WS_ADDR!tcp:MY_IP_ADDR:MY_WS_PORT!g" 
151
#!substdef "!MY_WSS_ADDR!tls:MY_IP_ADDR:MY_WSS_PORT!g" 
152
#!substdef "!MY_MSRP_ADDR!tls:MY_IP_ADDR:MY_MSRP_PORT!g" 
153
#!substdef "!MSRP_MIN_EXPIRES!1800!g" 
154
#!substdef "!MSRP_MAX_EXPIRES!3600!g" 
155

    
156
#!define WITH_TLS
157
#!define WITH_WEBSOCKETS
158
#!define WITH_MSRP
159

    
160
####### Global Parameters #########
161

    
162
### LOG Levels: 3=DBG, 2=INFO, 1=NOTICE, 0=WARN, -1=ERR
163
#!ifdef WITH_DEBUG
164
debug=4
165
log_stderror=no
166
#!else
167
debug=2
168
log_stderror=no
169
#!endif
170

    
171
memdbg=5
172
memlog=5
173

    
174
log_facility=LOG_LOCAL0
175

    
176
fork=yes
177
children=4
178

    
179
/* uncomment the next line to disable TCP (default on) */
180
#disable_tcp=yes
181

    
182
/* uncomment the next line to disable the auto discovery of local aliases
183
   based on reverse DNS on IPs (default on) */
184
#auto_aliases=no
185

    
186
/* add local domain aliases */
187
alias="callcenter.siarum.com" 
188
alias="165.22.15.111"
189

    
190
/* uncomment and configure the following line if you want Kamailio to 
191
   bind on a specific interface/port/proto (default bind on all available) */
192
listen=udp:165.22.15.111:5060
193
listen=udp:callcenter.siarum.com:5060
194
/* port to listen to
195
 * - can be specified more than once if needed to listen on many ports */
196
port=5060
197

    
198

    
199
#!ifdef WITH_TLS
200
enable_tls=yes
201
#!endif
202

    
203
listen=MY_IP_ADDR
204
#!ifdef WITH_WEBSOCKETS
205
listen=MY_WS_ADDR
206
#!ifdef WITH_TLS
207
listen=MY_WSS_ADDR
208
#!endif
209
#!endif
210
#!ifdef WITH_MSRP
211
listen=MY_MSRP_ADDR
212
#!endif
213
listen=tls:MY_IP_ADDR:5061
214

    
215

    
216

    
217

    
218
tcp_connection_lifetime=3604
219
tcp_accept_no_cl=yes
220
tcp_rd_buf_size=16384
221

    
222
# life time of TCP connection when there is no traffic
223
# - a bit higher than registration expires to cope with UA behind NAT
224
#tcp_connection_lifetime=3605
225

    
226
####### Custom Parameters #########
227

    
228
# These parameters can be modified runtime via RPC interface
229
# - see the documentation of 'cfg_rpc' module.
230
#
231
# Format: group.id = value 'desc' description
232
# Access: $sel(cfg_get.group.id) or @cfg_get.group.id
233
#
234

    
235
#!ifdef WITH_PSTN
236
# PSTN GW Routing
237
#
238
# - pstn.gw_ip: valid IP or hostname as string value, example:
239
# pstn.gw_ip = "10.0.0.101" desc "My PSTN GW Address" 
240
#
241
# - by default is empty to avoid misrouting
242
pstn.gw_ip = "" desc "tos.cloud.goautodial.com GW Address" 
243
pstn.gw_port = "" desc "PSTN GW Port" 
244
#!endif
245

    
246
#!ifdef WITH_VOICEMAIL
247
# VoiceMail Routing on offline, busy or no answer
248
#
249
# - by default Voicemail server IP is empty to avoid misrouting
250
voicemail.srv_ip = "" desc "VoiceMail IP Address" 
251
voicemail.srv_port = "5060" desc "VoiceMail Port" 
252
#!endif
253

    
254
# don't advertise server headers
255
server_signature=no
256
sip_warning=0
257

    
258
####### Modules Section ########
259

    
260
# set paths to location of modules (to sources or installation folders)
261
#!ifdef WITH_SRCPATH
262
mpath="modules/" 
263
#!else
264
mpath="/usr/lib64/kamailio/modules/" 
265
#mpath="/usr/lib/x86_64-linux-gnu/kamailio/modules/" 
266
#!endif
267

    
268
#!ifdef WITH_MYSQL
269
loadmodule "db_mysql.so" 
270
#!endif
271

    
272
#loadmodule "topoh.so" 
273
#loadmodule "mi_fifo.so" 
274
loadmodule "jsonrpcs.so" 
275
loadmodule "kex.so" 
276
loadmodule "corex.so" 
277
loadmodule "tm.so" 
278
loadmodule "tmx.so" 
279
loadmodule "sl.so" 
280
loadmodule "rr.so" 
281
loadmodule "pv.so" 
282
loadmodule "maxfwd.so" 
283
loadmodule "usrloc.so" 
284
loadmodule "registrar.so" 
285
loadmodule "textops.so" 
286
loadmodule "siputils.so" 
287
loadmodule "xlog.so" 
288
loadmodule "sanity.so" 
289
loadmodule "ctl.so" 
290
loadmodule "cfg_rpc.so" 
291
loadmodule "acc.so" 
292

    
293
#!ifdef WITH_AUTH
294
loadmodule "auth.so" 
295
loadmodule "auth_db.so" 
296
#!ifdef WITH_IPAUTH
297
loadmodule "permissions.so" 
298
#!endif
299
#!endif
300

    
301
#!ifdef WITH_ALIASDB
302
loadmodule "alias_db.so" 
303
#!endif
304

    
305
#!ifdef WITH_SPEEDDIAL
306
loadmodule "speeddial.so" 
307
#!endif
308

    
309
#!ifdef WITH_MULTIDOMAIN
310
loadmodule "domain.so" 
311
#!endif
312

    
313
#!ifdef WITH_PRESENCE
314
loadmodule "presence.so" 
315
loadmodule "presence_xml.so" 
316
#!endif
317

    
318
#!ifdef WITH_NAT
319
loadmodule "nathelper.so" 
320
loadmodule "rtpengine.so" 
321
#loadmodule "rtpproxy.so" 
322
#!endif
323

    
324
#!ifdef WITH_TLS
325
loadmodule "tls.so" 
326
#!endif
327

    
328
#!ifdef WITH_MSRP
329
loadmodule "msrp.so" 
330
#loadmodule "htable.so" 
331
loadmodule "cfgutils.so" 
332
#!endif
333

    
334
#!ifdef WITH_WEBSOCKETS
335
loadmodule "xhttp.so" 
336
loadmodule "websocket.so" 
337
loadmodule "sdpops.so" 
338
loadmodule "textopsx.so" 
339
loadmodule "dialog.so" 
340
loadmodule "sst.so" 
341
#!endif
342

    
343
#!ifdef WITH_ANTIFLOOD
344
loadmodule "htable.so" 
345
loadmodule "pike.so" 
346
#!endif
347

    
348
#!ifdef WITH_XMLRPC
349
loadmodule "xmlrpc.so" 
350
#!endif
351

    
352
#!ifdef WITH_DEBUG
353
loadmodule "debugger.so" 
354
#!endif
355

    
356
# ----------------- setting module-specific parameters ---------------
357

    
358
# ---- topoh params -----
359
#modparam("topoh", "mask_key", "Gu3ssWh@T1tS2016")
360
#modparam("topoh", "mask_ip", "10.0.0.1")
361
#modparam("topoh", "mask_callid", 1)
362

    
363
# ----- mi_fifo params -----
364
#modparam("mi_fifo", "fifo_name", "/var/run/kamailio/kamailio_fifo")
365

    
366
# ----- jsonrpcs params -----
367
modparam("jsonrpcs", "pretty_format", 1)
368
/* set the path to RPC fifo control file */
369
modparam("jsonrpcs", "fifo_name", "/var/run/kamailio/kamailio_rpc.fifo")
370
/* set the path to RPC unix socket control file */
371
modparam("jsonrpcs", "dgram_socket", "/var/run/kamailio/kamailio_rpc.sock")
372

    
373
# ----- tm params -----
374
# auto-discard branches from previous serial forking leg
375
modparam("tm", "failure_reply_mode", 3)
376
# default retransmission timeout: 30sec
377
modparam("tm", "fr_timer", 30000)
378
# default invite retransmission timeout after 1xx: 120sec
379
modparam("tm", "fr_inv_timer", 120000)
380

    
381
# ----- rr params -----
382
# set next param to 1 to add value to ;lr param (helps with some UAs)
383
modparam("rr", "enable_full_lr", 0)
384
# do not append from tag to the RR (no need for this script)
385
modparam("rr", "append_fromtag", 0)
386

    
387
# ----- registrar params -----
388
modparam("registrar", "method_filtering", 1)
389
/* uncomment the next line to disable parallel forking via location */
390
modparam("registrar", "append_branches", 0)
391
/* uncomment the next line not to allow more than 100 contacts per AOR */
392
modparam("registrar", "max_contacts", 100)
393
# max value for expires of registrations
394
modparam("registrar", "max_expires", 3600)
395
# set it to 1 to enable GRUU
396
modparam("registrar", "gruu_enabled", 0)
397

    
398
# ----- acc params -----
399
/* what special events should be accounted ? */
400
modparam("acc", "early_media", 0)
401
modparam("acc", "report_ack", 0)
402
modparam("acc", "report_cancels", 0)
403
/* by default ww do not adjust the direct of the sequential requests.
404
   if you enable this parameter, be sure the enable "append_fromtag" 
405
   in "rr" module */
406
modparam("acc", "detect_direction", 0)
407
/* account triggers (flags) */
408
modparam("acc", "log_flag", FLT_ACC)
409
modparam("acc", "log_missed_flag", FLT_ACCMISSED)
410
modparam("acc", "log_extra", 
411
    "src_user=$fU;src_domain=$fd;src_ip=$si;" 
412
    "dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")
413
modparam("acc", "failed_transaction_flag", FLT_ACCFAILED)
414
/* enhanced DB accounting */
415
#!ifdef WITH_ACCDB
416
modparam("acc", "db_flag", FLT_ACC)
417
modparam("acc", "db_missed_flag", FLT_ACCMISSED)
418
modparam("acc", "db_url", DBURL)
419
modparam("acc", "db_extra",
420
    "src_user=$fU;src_domain=$fd;src_ip=$si;" 
421
    "dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")
422
#!endif
423

    
424
# ----- usrloc params -----
425
/* enable DB persistency for location entries */
426
#!ifdef WITH_USRLOCDB
427
modparam("usrloc", "db_url", DBURL)
428
modparam("usrloc", "db_mode", 1)
429
modparam("usrloc", "use_domain", MULTIDOMAIN)
430
modparam("usrloc", "timer_interval", 60)
431
modparam("usrloc", "timer_procs", 4)
432
#!endif
433

    
434
# ----- auth_db params -----
435
#!ifdef WITH_AUTH
436
modparam("auth_db", "db_url", DBURL)
437
modparam("auth_db", "calculate_ha1", 0)
438
modparam("auth_db", "password_column", "ha1")
439
modparam("auth_db", "load_credentials", "")
440
modparam("auth_db", "use_domain", MULTIDOMAIN)
441

    
442
modparam("auth", "nonce_count", 1) # enable nonce_count support
443
modparam("auth", "qop", "auth")    # enable qop=auth
444
modparam("auth", "nonce_expire", 60)
445
modparam("auth", "nonce_auth_max_drift", 2)
446

    
447
# For REGISTER requests we hash the Request-URI, Call-ID, and source IP of the
448
# request into the nonce string. This ensures that the generated credentials
449
# cannot be used with another registrar, user agent with another source IP
450
# address or Call-ID. Note that user agents that change Call-ID with every
451
# REGISTER message will not be able to register if you enable this.
452
modparam("auth", "auth_checks_register", 11)
453

    
454
# For dialog-establishing requests (such as the original INVITE, OPTIONS, etc)
455
# we hash the Request-URI and source IP. Hashing Call-ID and From tags takes
456
# some extra precaution, because these checks could render some UA unusable.
457
modparam("auth", "auth_checks_no_dlg", 9)
458

    
459
# For mid-dialog requests, such as re-INVITE, we can hash source IP and
460
# Request-URI just like in the previous case. In addition to that we can hash
461
# Call-ID and From tag because these are fixed within a dialog and are
462
# guaranteed not to change. This settings effectively restrict the usage of
463
# generated credentials to a single user agent within a single dialog.
464
modparam("auth", "auth_checks_in_dlg", 15)
465

    
466
# ----- permissions params -----
467
#!ifdef WITH_IPAUTH
468
modparam("permissions", "db_url", DBURL)
469
modparam("permissions", "db_mode", 1)
470
#!endif
471

    
472
#!endif
473

    
474
# ----- alias_db params -----
475
#!ifdef WITH_ALIASDB
476
modparam("alias_db", "db_url", DBURL)
477
modparam("alias_db", "use_domain", MULTIDOMAIN)
478
#!endif
479

    
480
# ----- speeddial params -----
481
#!ifdef WITH_SPEEDDIAL
482
modparam("speeddial", "db_url", DBURL)
483
modparam("speeddial", "use_domain", MULTIDOMAIN)
484
#!endif
485

    
486
# ----- domain params -----
487
#!ifdef WITH_MULTIDOMAIN
488
modparam("domain", "db_url", DBURL)
489
# register callback to match myself condition with domains list
490
modparam("domain", "register_myself", 1)
491
#!endif
492

    
493
#!ifdef WITH_PRESENCE
494
# ----- presence params -----
495
modparam("presence", "db_url", DBURL)
496

    
497
# ----- presence_xml params -----
498
modparam("presence_xml", "db_url", DBURL)
499
modparam("presence_xml", "force_active", 1)
500
#!endif
501

    
502
#!ifdef WITH_NAT
503
# ----- rtpengine params -----
504
modparam("rtpengine", "rtpengine_sock", "udp:165.22.15.111:5066")
505
modparam("rtpengine", "rtpengine_disable_tout", 20)
506
#modparam("rtpengine", "db_url", DBURL)
507

    
508
# ----- nathelper params -----
509
modparam("nathelper", "natping_interval", 30)
510
modparam("nathelper", "ping_nated_only", 1)
511
modparam("nathelper", "sipping_bflag", FLB_NATSIPPING)
512
modparam("nathelper", "sipping_from", "sip:pinger@kamailio.org")
513

    
514
# params needed for NAT traversal in other modules
515
modparam("nathelper|registrar", "received_avp", "$avp(RECEIVED)")
516
modparam("usrloc", "nat_bflag", FLB_NATB)
517
#!endif
518

    
519
#!ifdef WITH_TLS
520
# ----- tls params -----
521
#modparam("tls", "config", "/etc/kamailio/tls.cfg")
522
modparam("tls", "private_key", "/etc/letsencrypt/live/callcenter.siarum.com/privkey.pem")
523
modparam("tls", "certificate", "/etc/letsencrypt/live/callcenter.siarum.com/fullchain.pem")
524
#modparam("tls", "ca_list", "/etc/httpd/certs/essentialSSL/wildcard.goautodial.com.ca-bundle")
525
#!endif
526

    
527
#!ifdef WITH_WEBSOCKETS
528
# ----- nathelper params -----
529
modparam("nathelper|registrar", "received_avp", "$avp(RECEIVED)")
530
# Note: leaving NAT pings turned off here as nathelper is _only_ being used for
531
#       WebSocket connections.  NAT pings are not needed as WebSockets have
532
#       their own keep-alives.
533
modparam("dialog", "dlg_flag", 10)
534
modparam("dialog", "track_cseq_updates", 0)
535
modparam("dialog", "dlg_match_mode", 2)
536

    
537
modparam("dialog", "timeout_avp", "$avp(i:10)")
538
# Set the sst modules timeout_avp to be the same value
539
modparam("sst", "timeout_avp", "$avp(i:10)")
540
modparam("sst", "sst_flag", 11)
541
#!endif
542

    
543
#!ifdef WITH_MSRP
544
# ----- htable params -----
545
modparam("htable", "htable", "msrp=>size=8;autoexpire=MSRP_MAX_EXPIRES;")
546
#!endif
547

    
548
#!ifdef WITH_ANTIFLOOD
549
# ----- pike params -----
550
modparam("pike", "sampling_time_unit", 2)
551
modparam("pike", "reqs_density_per_unit", 32)
552
modparam("pike", "remove_latency", 4)
553

    
554
# ----- htable params -----
555
# ip ban htable with autoexpire after 5 minutes
556
# modparam("htable", "htable", "ipban=>size=8;autoexpire=300;")
557
#!endif
558

    
559
#!ifdef WITH_XMLRPC
560
# ----- xmlrpc params -----
561
modparam("xmlrpc", "route", "XMLRPC");
562
modparam("xmlrpc", "url_match", "^/RPC")
563
#!endif
564

    
565
#!ifdef WITH_DEBUG
566
# ----- debugger params -----
567
modparam("debugger", "cfgtrace", 1)
568
modparam("debugger", "log_level_name", "exec")
569
#!endif
570

    
571
####### Routing Logic ########
572

    
573
# Main SIP request routing logic
574
# - processing of any incoming SIP request starts with this route
575
# - note: this is the same as route { ... }
576
request_route {
577

    
578
    # per request initial checks
579
    route(REQINIT);
580

    
581
#!ifdef WITH_WEBSOCKETS
582
    if (nat_uac_test(64)) {
583
        # Do NAT traversal stuff for requests from a WebSocket
584
        # connection - even if it is not behind a NAT!
585
        # This won't be needed in the future if Kamailio and the
586
        # WebSocket client support Outbound and Path.
587
        force_rport();
588
        if (is_method("REGISTER")) {
589
            fix_nated_register();
590
        } else {
591
            if (!add_contact_alias()) {
592
                xlog("L_ERR", "Error aliasing contact <$ct>\n");
593
                sl_send_reply("400", "Bad Request");
594
                exit;
595
            }
596
        }
597
    }
598
#!endif
599

    
600
    # NAT detection
601
    route(NATDETECT);
602

    
603
    # CANCEL processing
604
    if (is_method("CANCEL")) {
605
        if (t_check_trans()) {
606
            route(RELAY);
607
        }
608
        exit;
609
    }
610

    
611
    # handle requests within SIP dialogs
612
    route(WITHINDLG);
613

    
614
    ### only initial requests (no To tag)
615

    
616
    # handle retransmissions
617
    if(t_precheck_trans()) {
618
        t_check_trans();
619
        exit;
620
    }
621
    t_check_trans();
622

    
623
    # authentication
624
    route(AUTH);
625

    
626
    # record routing for dialog forming requests (in case they are routed)
627
    # - remove preloaded route headers
628
    remove_hf("Route");
629
    if (is_method("INVITE|SUBSCRIBE"))
630
        record_route();
631

    
632
    # account only INVITEs
633
    if (is_method("INVITE")) {
634
        setflag(FLT_ACC); # do accounting
635
        setflag(10); # set the dialog flag
636
        setflag(11); # Set the sst flag
637
    }
638

    
639
    if (is_method("UPDATE")) {
640
        setflag(FLT_ACC); # do accounting
641
        setflag(10); # set the dialog flag
642
        setflag(11); # Set the sst flag
643
    }
644

    
645
    # dispatch requests to foreign domains
646
    route(SIPOUT);
647

    
648
    ### requests for my local domains
649

    
650
    # handle presence related requests
651
    route(PRESENCE);
652

    
653
    # handle registrations
654
    route(REGISTRAR);
655

    
656
    if ($rU==$null) {
657
        # request with no Username in RURI
658
        sl_send_reply("484","Address Incomplete");
659
        exit;
660
    }
661

    
662
    # dispatch destinations to PSTN
663
    route(PSTN);
664

    
665
    # user location service
666
    route(LOCATION);
667
    route(RELAY);
668
}
669

    
670
# Wrapper for relaying requests
671
route[RELAY] {
672
    # enable additional event routes for forwarded requests
673
    # - serial forking, RTP relaying handling, a.s.o.
674
    if (is_method("INVITE|BYE|SUBSCRIBE|UPDATE")) {
675
        if(!t_is_set("branch_route")) t_on_branch("MANAGE_BRANCH");
676
    }
677
    if (is_method("INVITE|SUBSCRIBE|UPDATE")) {
678
        if(!t_is_set("onreply_route")) t_on_reply("MANAGE_REPLY");
679
    }
680
    if (is_method("INVITE")) {
681
        dlg_manage();
682
        route(SETUP_BY_TRANSPORT);
683
        if(!t_is_set("failure_route")) t_on_failure("MANAGE_FAILURE");
684
    }
685
    if (!t_relay()) {
686
        sl_reply_error();
687
    }
688
    exit;
689
}
690

    
691
route[SETUP_BY_TRANSPORT] {
692
    if ($ru =~ "transport=ws") {
693
        xlog("L_INFO", "Request going to WS");
694
        if(sdp_with_transport("RTP/SAVPF")) {
695
            xlog("L_INFO", "RTP/SAVPF detected");
696
            rtpengine_manage("force trust-address replace-origin replace-session-connection ICE=force");
697
            t_on_reply("REPLY_WS_TO_WS");
698
            return;
699
        }
700
        rtpengine_manage("trust-address replace-origin replace-session-connection ICE=force RTP/SAVPF rtcp-mux-offer rtcp-mux-accept SDES-off");
701
        t_on_reply("REPLY_FROM_WS");
702
    }
703
    else if ($proto =~ "ws") {
704
        xlog("L_INFO", "Request coming from WS");
705
        rtpengine_manage("RTP/AVP");
706
        t_on_reply("REPLY_TO_WS");
707
    }
708
    else {
709
        xlog("L_INFO", "This is a classic phone call");
710
        rtpengine_manage("trust-address replace-origin replace-session-connection RTP/AVP");
711
        t_on_reply("MANAGE_CLASSIC_REPLY");
712
    }
713
}
714

    
715
onreply_route[REPLY_WS_TO_WS] {
716
    xlog("L_INFO", "WS to WS");
717
    if(status=~"[12][0-9][0-9]") {
718
        rtpengine_manage("force trust-address replace-origin replace-session-connection ICE=force");
719
        route(NATMANAGE);
720
    }
721
}
722

    
723
onreply_route[REPLY_FROM_WS] {
724
    xlog("L_INFO", "Reply from webrtc client: $rs");
725
    if(status=~"[12][0-9][0-9]") {
726
        rtpengine_manage("trust-address replace-origin replace-session-connection ICE=remove RTP/AVP rtcp-mux-offer rtcp-mux-accept SDES-off");
727
        route(NATMANAGE);
728
    }
729
}
730

    
731
onreply_route[REPLY_TO_WS] {
732
    xlog("L_INFO", "Reply from softphone: $rs");
733

    
734
    if (t_check_status("183")) {
735
        change_reply_status("180", "Ringing");
736
        remove_body();
737
        exit;
738
    }
739

    
740
    if(!(status=~"[12][0-9][0-9]"))
741
        return;
742

    
743
    rtpengine_manage("froc+SP");
744
    route(NATMANAGE);
745
}
746

    
747
onreply_route[MANAGE_CLASSIC_REPLY] {
748
    xlog("L_INFO", "Boring reply from softphone: $rs");
749

    
750
    if(status=~"[12][0-9][0-9]") {
751
        xlog("L_INFO", "rtpengine_manage - trust-address replace-origin replace-session-connection RTP/AVP");
752
        rtpengine_manage("trust-address replace-origin replace-session-connection RTP/AVP");    
753
                route(NATMANAGE);
754
    }
755
}
756

    
757
# Per SIP request initial checks
758
route[REQINIT] {
759
#!ifdef WITH_ANTIFLOOD
760
    # flood dection from same IP and traffic ban for a while
761
    # be sure you exclude checking trusted peers, such as pstn gateways
762
    # - local host excluded (e.g., loop to self)
763
    if(src_ip!=myself) {
764
        if($sht(ipban=>$si)!=$null) {
765
            # ip is already blocked
766
            xdbg("request from blocked IP - $rm from $fu (IP:$si:$sp)\n");
767
            exit;
768
        }
769
        if (!pike_check_req()) {
770
            xlog("L_ALERT","ALERT: pike blocking $rm from $fu (IP:$si:$sp)\n");
771
            $sht(ipban=>$si) = 1;
772
            exit;
773
        }
774
    }
775
    if($ua =~ "friendly-scanner") {
776
        sl_send_reply("200", "OK");
777
        exit;
778
    }
779
#!endif
780

    
781
    if (!mf_process_maxfwd_header("10")) {
782
        sl_send_reply("483","Too Many Hops");
783
        exit;
784
    }
785

    
786
    if(is_method("OPTIONS") && uri==myself && $rU==$null) {
787
        sl_send_reply("200","Keepalive");
788
        exit;
789
    }
790

    
791
    if(!sanity_check("1511", "7")) {
792
        xlog("Malformed SIP message from $si:$sp\n");
793
        exit;
794
    }
795
}
796

    
797
# Handle requests within SIP dialogs
798
route[WITHINDLG] {
799
    if (!has_totag()) return;
800

    
801
    # sequential request withing a dialog should
802
    # take the path determined by record-routing
803
    if (loose_route()) {
804
#!ifdef WITH_WEBSOCKETS
805
        if ($du == "") {
806
            if (!handle_ruri_alias()) {
807
                xlog("L_ERR", "Bad alias <$ru>\n");
808
                sl_send_reply("400", "Bad Request");
809
                exit;
810
            }
811
        }
812
#!endif
813
        route(DLGURI);
814
        if (is_method("BYE")) {
815
            setflag(FLT_ACC); # do accounting ...
816
            setflag(FLT_ACCFAILED); # ... even if the transaction fails
817
        }
818
        else if ( is_method("ACK") ) {
819
            # ACK is forwarded statelessy
820
            route(NATMANAGE);
821
        }
822
        else if ( is_method("NOTIFY") ) {
823
            # Add Record-Route for in-dialog NOTIFY as per RFC 6665.
824
            record_route();
825
        }
826
        route(RELAY);
827
        exit;
828
    }
829

    
830
    if (is_method("SUBSCRIBE") && uri == myself) {
831
        # in-dialog subscribe requests
832
        route(PRESENCE);
833
        exit;
834
    }
835
    if ( is_method("ACK") ) {
836
        if ( t_check_trans() ) {
837
            # no loose-route, but stateful ACK;
838
            # must be an ACK after a 487
839
            # or e.g. 404 from upstream server
840
            route(RELAY);
841
            exit;
842
        } else {
843
            # ACK without matching transaction ... ignore and discard
844
            exit;
845
        }
846
    }
847
    sl_send_reply("404","Not here");
848
    exit;
849
}
850

    
851
# Handle SIP registrations
852
route[REGISTRAR] {
853
    if (!is_method("REGISTER")) return;
854

    
855
    if(isflagset(FLT_NATS)) {
856
        setbflag(FLB_NATB);
857
#!ifdef WITH_NATSIPPING
858
        # do SIP NAT pinging
859
        setbflag(FLB_NATSIPPING);
860
#!endif
861
    }
862
    if (!save("location", "0x04"))
863
        sl_reply_error();
864
    exit;
865
}
866

    
867
# User location service
868
route[LOCATION] {
869

    
870
#!ifdef WITH_SPEEDDIAL
871
    # search for short dialing - 2-digit extension
872
    if($rU=~"^[0-9][0-9]$")
873
        if(sd_lookup("speed_dial"))
874
            route(SIPOUT);
875
#!endif
876

    
877
#!ifdef WITH_ALIASDB
878
    # search in DB-based aliases
879
    if(alias_db_lookup("dbaliases"))
880
        route(SIPOUT);
881
#!endif
882

    
883
    $avp(oexten) = $rU;
884
    if (!lookup("location")) {
885
        $var(rc) = $rc;
886
        route(TOVOICEMAIL);
887
        t_newtran();
888
        switch ($var(rc)) {
889
            case -1:
890
            case -3:
891
                send_reply("404", "Not Found");
892
                exit;
893
            case -2:
894
                send_reply("405", "Method Not Allowed");
895
                exit;
896
        }
897
    }
898

    
899
    # when routing via usrloc, log the missed calls also
900
    if (is_method("INVITE")) {
901
        setflag(FLT_ACCMISSED);
902
    }
903

    
904
    # t_on_failure("UA_FAILURE");
905
    route(RELAY);
906
    exit;
907
}
908

    
909
# Presence server processing
910
route[PRESENCE] {
911
    if(!is_method("PUBLISH|SUBSCRIBE"))
912
        return;
913

    
914
    if(is_method("SUBSCRIBE") && $hdr(Event)=="message-summary") {
915
        route(TOVOICEMAIL);
916
        # returns here if no voicemail server is configured
917
        sl_send_reply("404", "No voicemail service");
918
        exit;
919
    }
920

    
921
#!ifdef WITH_PRESENCE
922
    if (!t_newtran()) {
923
        sl_reply_error();
924
        exit;
925
    }
926

    
927
    if(is_method("PUBLISH")) {
928
        handle_publish();
929
        t_release();
930
    } else if(is_method("SUBSCRIBE")) {
931
        handle_subscribe();
932
        t_release();
933
    }
934
    exit;
935
#!endif
936

    
937
    # if presence enabled, this part will not be executed
938
    if (is_method("PUBLISH") || $rU==$null) {
939
        sl_send_reply("404", "Not here");
940
        exit;
941
    }
942
    return;
943
}
944

    
945
# IP authorization and user uthentication
946
route[AUTH] {
947
#!ifdef WITH_AUTH
948

    
949
#!ifdef WITH_IPAUTH
950
    if((!is_method("REGISTER")) && allow_source_address()) {
951
        # source IP allowed
952
        return;
953
    }
954
#!endif
955

    
956
    if (is_method("REGISTER") || from_uri==myself)
957
    {
958
        # authenticate requests
959
        if (!auth_check("$fd", "subscriber", "1")) {
960
            auth_challenge("$fd", "0");
961
            exit;
962
        }        
963
        # user authenticated - remove auth header
964
        if(!is_method("REGISTER|PUBLISH"))
965
            consume_credentials();
966
    }
967
    # if caller is not local subscriber, then check if it calls
968
    # a local destination, otherwise deny, not an open relay here
969
    if (from_uri!=myself && uri!=myself) {
970
        sl_send_reply("403","Not relaying");
971
        exit;
972
    }
973

    
974
#!endif
975
    return;
976
}
977

    
978
# Caller NAT detection
979
route[NATDETECT] {
980
#!ifdef WITH_NAT
981
    force_rport();
982
    if (nat_uac_test("19")) {
983
        if (is_method("REGISTER")) {
984
            fix_nated_register();
985
        } else {
986
            if(is_first_hop())
987
                set_contact_alias();
988
        }
989
        setflag(FLT_NATS);
990
    }
991
#!endif
992
    return;
993
}
994

    
995
# RTPengine control and singaling updates for NAT traversal
996
route[NATMANAGE] {
997
#!ifdef WITH_NAT
998
    if (is_request()) {
999
        if(has_totag()) {
1000
            if(check_route_param("nat=yes")) {
1001
                setbflag(FLB_NATB);
1002
            }
1003
        }
1004
    }
1005
    if (!(isflagset(FLT_NATS) || isbflagset(FLB_NATB)))
1006
        return;
1007

    
1008
    if (is_request()) {
1009
        if (!has_totag()) {
1010
            if(t_is_branch_route()) {
1011
                add_rr_param(";nat=yes");
1012
            }
1013
        }
1014
    }
1015
    if (is_reply()) {
1016
        if(isbflagset(FLB_NATB)) {
1017
            if(is_first_hop())
1018
                set_contact_alias();
1019
        }
1020
    }
1021
#!endif
1022
    return;
1023
}
1024

    
1025
# URI update for dialog requests
1026
route[DLGURI] {
1027
#!ifdef WITH_NAT
1028
    if(!isdsturiset()) {
1029
        handle_ruri_alias();
1030
    }
1031
#!endif
1032
    return;
1033
}
1034

    
1035
# Routing to foreign domains
1036
route[SIPOUT] {
1037
    if (uri==myself) return;
1038

    
1039
    append_hf("P-hint: outbound\r\n");
1040
    route(RELAY);
1041
    exit;
1042
}
1043

    
1044
# PSTN GW routing
1045
route[PSTN] {
1046
#!ifdef WITH_PSTN
1047
    # check if PSTN GW IP is defined
1048
    if (strempty($sel(cfg_get.pstn.gw_ip))) {
1049
        xlog("SCRIPT: PSTN rotuing enabled but pstn.gw_ip not defined\n");
1050
        return;
1051
    }
1052

    
1053
    # route to PSTN dialed numbers starting with '+' or '00'
1054
    #     (international format)
1055
    # - update the condition to match your dialing rules for PSTN routing
1056
    if(!($rU=~"^(\+|00)[1-9][0-9]{3,20}$"))
1057
        return;
1058

    
1059
    # only local users allowed to call
1060
    if(from_uri!=myself) {
1061
        sl_send_reply("403", "Not Allowed");
1062
        exit;
1063
    }
1064

    
1065
    if (strempty($sel(cfg_get.pstn.gw_port))) {
1066
        $ru = "sip:" + $rU + "@" + $sel(cfg_get.pstn.gw_ip);
1067
    } else {
1068
        $ru = "sip:" + $rU + "@" + $sel(cfg_get.pstn.gw_ip) + ":" 
1069
                    + $sel(cfg_get.pstn.gw_port);
1070
    }
1071

    
1072
    route(RELAY);
1073
    exit;
1074
#!endif
1075

    
1076
    return;
1077
}
1078

    
1079
# XMLRPC routing
1080
#!ifdef WITH_XMLRPC
1081
route[XMLRPC] {
1082
    # allow XMLRPC from localhost
1083
    if ((method=="POST" || method=="GET")
1084
            && (src_ip==165.22.15.111)) {
1085
        # close connection only for xmlrpclib user agents (there is a bug in
1086
        # xmlrpclib: it waits for EOF before interpreting the response).
1087
        if ($hdr(User-Agent) =~ "xmlrpclib")
1088
            set_reply_close();
1089
        set_reply_no_connect();
1090
        dispatch_rpc();
1091
        exit;
1092
    }
1093
    send_reply("403", "Forbidden");
1094
    exit;
1095
}
1096
#!endif
1097

    
1098
# Routing to voicemail server
1099
route[TOVOICEMAIL] {
1100
#!ifdef WITH_VOICEMAIL
1101
    if(!is_method("INVITE|SUBSCRIBE"))
1102
        return;
1103

    
1104
    # check if VoiceMail server IP is defined
1105
    if (strempty($sel(cfg_get.voicemail.srv_ip))) {
1106
        xlog("SCRIPT: VoiceMail rotuing enabled but IP not defined\n");
1107
        return;
1108
    }
1109
    if(is_method("INVITE")) {
1110
        if($avp(oexten)==$null)
1111
            return;
1112
        $ru = "sip:" + $avp(oexten) + "@" + $sel(cfg_get.voicemail.srv_ip)
1113
                + ":" + $sel(cfg_get.voicemail.srv_port);
1114
    } else {
1115
        if($rU==$null)
1116
            return;
1117
        $ru = "sip:" + $rU + "@" + $sel(cfg_get.voicemail.srv_ip)
1118
                + ":" + $sel(cfg_get.voicemail.srv_port);
1119
    }
1120
    route(RELAY);
1121
    exit;
1122
#!endif
1123

    
1124
    return;
1125
}
1126

    
1127
# Manage outgoing branches
1128
branch_route[MANAGE_BRANCH] {
1129
    xdbg("new branch [$T_branch_idx] to $ru\n");
1130
    route(NATMANAGE);
1131
}
1132

    
1133
# Manage incoming replies
1134
onreply_route[MANAGE_REPLY] {
1135
    xdbg("incoming reply\n");
1136
    if(status=~"[12][0-9][0-9]")
1137
        route(NATMANAGE);
1138
}
1139

    
1140
# Manage failure routing cases
1141
failure_route[MANAGE_FAILURE] {
1142
    route(NATMANAGE);
1143

    
1144
    if (t_is_canceled()) {
1145
        exit;
1146
    }
1147

    
1148
#!ifdef WITH_BLOCK3XX
1149
    # block call redirect based on 3xx replies.
1150
    if (t_check_status("3[0-9][0-9]")) {
1151
        t_reply("404","Not found");
1152
        exit;
1153
    }
1154
#!endif
1155

    
1156
#!ifdef WITH_VOICEMAIL
1157
    # serial forking
1158
    # - route to voicemail on busy or no answer (timeout)
1159
    if (t_check_status("486|408")) {
1160
        $du = $null;
1161
        route(TOVOICEMAIL);
1162
        exit;
1163
    }
1164
#!endif
1165
}
1166

    
1167
#!ifdef WITH_WEBSOCKETS
1168
onreply_route {
1169
    if ((($Rp == MY_WS_PORT || $Rp == MY_WSS_PORT)
1170
        && !(proto == WS || proto == WSS)) || $Rp == MY_MSRP_PORT) {
1171
        xlog("L_WARN", "SIP response received on $Rp\n");
1172
        drop;
1173
        exit;
1174
    }
1175

    
1176
    if (nat_uac_test(64)) {
1177
        # Do NAT traversal stuff for replies to a WebSocket connection
1178
        # - even if it is not behind a NAT!
1179
        # This won't be needed in the future if Kamailio and the
1180
        # WebSocket client support Outbound and Path.
1181
        add_contact_alias();
1182
    }
1183
}
1184

    
1185
event_route[xhttp:request] {
1186
    set_reply_close();
1187
    set_reply_no_connect();
1188

    
1189
    if ($Rp != MY_WS_PORT
1190
#!ifdef WITH_TLS
1191
        && $Rp != MY_WSS_PORT
1192
#!endif
1193
    ) {
1194
        xlog("L_WARN", "HTTP request received on $Rp\n");
1195
        xhttp_reply("403", "Forbidden", "", "");
1196
        exit;
1197
    }
1198

    
1199
    xlog("L_DBG", "HTTP Request Received\n");
1200

    
1201
    if ($hdr(Upgrade)=~"websocket" 
1202
            && $hdr(Connection)=~"Upgrade" 
1203
            && $rm=~"GET") {
1204

    
1205
        # Validate Host - make sure the client is using the correct
1206
        # alias for WebSockets
1207
        # Sasa: commented out, see http://sip-router.1086192.n5.nabble.com/Testing-the-Websocket-module-with-sipml5-org-td65069.html
1208
        #if ($hdr(Host) == $null || !is_myself("sip:" + $hdr(Host))) {
1209
        #    xlog("L_WARN", "Bad host $hdr(Host)\n");
1210
        #    xhttp_reply("403", "Forbidden", "", "");
1211
        #    exit;
1212
        #}
1213

    
1214
        # Optional... validate Origin - make sure the client is from an
1215
        # authorised website.  For example,
1216
        #
1217
        # if ($hdr(Origin) != "http://communicator.MY_DOMAIN" 
1218
        #     && $hdr(Origin) != "https://communicator.MY_DOMAIN") {
1219
        #    xlog("L_WARN", "Unauthorised client $hdr(Origin)\n");
1220
        #    xhttp_reply("403", "Forbidden", "", "");
1221
        #    exit;
1222
        # }
1223

    
1224
        # Optional... perform HTTP authentication
1225

    
1226
        # ws_handle_handshake() exits (no further configuration file
1227
        # processing of the request) when complete.
1228
        if (ws_handle_handshake())
1229
        {
1230
            # Optional... cache some information about the
1231
            # successful connection
1232
            exit;
1233
        }
1234
    }
1235

    
1236
    xhttp_reply("404", "Not Found", "", "");
1237
}
1238

    
1239
event_route[websocket:closed] {
1240
    xlog("L_INFO", "WebSocket connection from $si:$sp has closed\n");
1241
}
1242

    
1243
failure_route[UA_FAILURE] {
1244
    xlog("L_INFO", "Triggered UA_FAILURE\n");
1245
    if (t_check_status("488") && sdp_content()) {
1246
        if (sdp_get_line_startswith("$avp(mline)", "m=")) {
1247
            if ($avp(mline) =~ "SAVPF") {
1248
                $avp(rtpengine_offer_flags) = "froc-sp";
1249
                $avp(rtpengine_answer_flags) = "froc+SP";
1250
            } else {
1251
                $avp(rtpengine_offer_flags) = "froc+SP";
1252
                $avp(rtpengine_answer_flags) = "froc-sp";
1253
            }
1254
        }
1255
        append_branch();
1256
        rtpengine_offer($avp(rtpengine_offer_flags));
1257
        t_on_reply("RTPPROXY_REPLY");
1258
        route(RELAY);
1259
    }
1260
}
1261

    
1262
onreply_route[RTPPROXY_REPLY] {
1263
    xlog("L_INFO", "Triggered RTPPROXY_REPLY\n");
1264
    if (status =~ "18[03]") {
1265
        change_reply_status(180, "Ringing");
1266
        remove_body();
1267
    } else if (status =~ "2[0-9][0-9]" && sdp_content()) {
1268
        rtpengine_answer($avp(rtpengine_answer_flags));
1269
    }
1270
}
1271
#!endif
1272

    
1273
#!ifdef WITH_MSRP
1274
event_route[msrp:frame-in] {
1275
    msrp_reply_flags("1");
1276

    
1277
    if ((($Rp == MY_WS_PORT || $Rp == MY_WSS_PORT)
1278
        && !(proto == WS || proto == WSS)) && $Rp != MY_MSRP_PORT) {
1279
        xlog("L_WARN", "MSRP request received on $Rp\n");
1280
        msrp_reply("403", "Action-not-allowed");
1281
        exit;
1282
    }
1283

    
1284
    if (msrp_is_reply()) {
1285
        msrp_relay();
1286
    } else if($msrp(method)=="AUTH") {
1287
        if($msrp(nexthops)>0) {
1288
            msrp_relay();
1289
            exit;
1290
        }
1291

    
1292
        if (!www_authenticate("MY_DOMAIN", "subscriber",
1293
                    "$msrp(method)")) {
1294
            if (auth_get_www_authenticate("MY_DOMAIN", "1",
1295
                            "$var(wauth)")) {
1296
                msrp_reply("401", "Unauthorized",
1297
                            "$var(wauth)");
1298
            } else {
1299
                msrp_reply("500", "Server Error");
1300
            }
1301
            exit;
1302
        }
1303

    
1304
        if ($hdr(Expires) != $null) {
1305
            $var(expires) = (int) $hdr(Expires);
1306
            if ($var(expires) < MSRP_MIN_EXPIRES) {
1307
                msrp_reply("423", "Interval Out-of-Bounds",
1308
                    "Min-Expires: MSRP_MIN_EXPIRES\r\n");
1309
                exit;
1310
            } else if ($var(expires) > MSRP_MAX_EXPIRES) {
1311
                msrp_reply("423", "Interval Out-of-Bounds",
1312
                    "Max-Expires: MSRP_MAX_EXPIRES\r\n");
1313
                exit;
1314
            }
1315
        } else {
1316
            $var(expires) = MSRP_MAX_EXPIRES;
1317
        }
1318

    
1319
        $var(cnt) = $var(cnt) + 1;
1320
        pv_printf("$var(sessid)", "s.$(pp).$(var(cnt)).$(RANDOM)");
1321
        $sht(msrp=>$var(sessid)::srcaddr) = $msrp(srcaddr);
1322
        $sht(msrp=>$var(sessid)::srcsock) = $msrp(srcsock);
1323
        $shtex(msrp=>$var(sessid)) = $var(expires) + 5;
1324
        # - Use-Path: the MSRP address for server + session id
1325
        $var(hdrs) = "Use-Path: msrps://MY_IP_ADDR:MY_MSRP_PORT/" 
1326
                    + $var(sessid) + ";tcp\r\n" 
1327
                    + "Expires: " + $var(expires) + "\r\n";
1328
        msrp_reply("200", "OK", "$var(hdrs)");
1329
    } else if ($msrp(method)=="SEND" || $msrp(method)=="REPORT") {
1330
        if ($msrp(nexthops)>1) {
1331
            if ($msrp(method)!="REPORT") {
1332
                msrp_reply("200", "OK");
1333
            }
1334
            msrp_relay();
1335
            exit;
1336
        }
1337
        $var(sessid) = $msrp(sessid);
1338
        if ($sht(msrp=>$var(sessid)::srcaddr) == $null) {
1339
            # one more hop, but we don't have address in htable
1340
            msrp_reply("481", "Session-does-not-exist");
1341
            exit;
1342
        } else if ($msrp(method)!="REPORT") {
1343
            msrp_reply("200", "OK");
1344
        }
1345
        msrp_relay_flags("1");
1346
        msrp_set_dst("$sht(msrp=>$var(sessid)::srcaddr)",
1347
                "$sht(msrp=>$var(sessid)::srcsock)");
1348
        msrp_relay();
1349
    } else {
1350
        msrp_reply("501", "Request-method-not-understood");
1351
    }
1352
}
1353
#!endif
1354
</code></pre>
1355
<tls.cfg>
1356
<pre><code class="yaml">
1357
#
1358
# $Id$
1359
#
1360
# Example Kamailio TLS Configuration File
1361
#
1362

    
1363
# This is the default server domain, settings
1364
# in this domain will be used for all incoming
1365
# connections that do not match any other server
1366
# domain in this configuration file.
1367
#
1368
# We do not enable anything else than TLSv1
1369
# over the public internet. Clients do not have
1370
# to present client certificates by default.
1371
#
1372
[server:default]
1373
method = TLSv1 
1374
verify_certificate = no  
1375
require_certificate = no
1376
private_key = /etc/letsencrypt/live/callcenter.siarum.com/privkey.pem
1377
certificate = /etc/letsencrypt/live/callcenter.siarum.com/fullchain.pem
1378
#ca_list = /etc/letsencrypt/live/callcenter.siarum.com/fullchain.pem
1379
#ca_list = /etc/ssl/certs/ca-bundle.crt
1380
#crl = ./modules/tls/crl.pem
1381

    
1382
# This is the default client domain, settings
1383
# in this domain will be used for all outgoing
1384
# TLS connections that do not match any other
1385
# client domain in this configuration file.
1386
# We require that servers present valid certificate.
1387
#
1388
[client:default]
1389
verify_certificate = no 
1390
require_certificate = no 
1391

    
1392
# This is an example server domain for TLS connections
1393
# received from the loopback interface. We allow
1394
# the use of SSLv2 and SSLv3 protocols here, we do
1395
# not require that clients present client certificates
1396
# but if they present it it must be valid. We also use
1397
# a special certificate and CA list for loopback
1398
# interface.
1399
#
1400
#[server:127.0.0.1:5061]
1401
#method = SSLv23
1402
#verify_certificate = yes
1403
#require_certificate = no
1404
#private_key = ./modules/tls/local_key.pem
1405
#certificate = ./modules/tls/local_cert.pem
1406
#verify_depth = 3
1407
#ca_list = local_ca.pem
1408
#crl = local_crl.pem
1409

    
1410
# Special settings for the iptel.org public SIP
1411
# server. We do not verify the certificate of the
1412
# server because it can be expired. The server
1413
# implements authentication using SSL client
1414
# certificates so configure the client certificate
1415
# that was given to use by iptel.org staff here.
1416
#
1417
#[client:195.37.77.101:5061]
1418
#verify_certificate = no
1419
#certificate = ./modules/tls/iptel_client.pem
1420
#private_key = ./modules/tls/iptel_key.pem
1421
#ca_list = ./modules/tls/iptel_ca.pem
1422
#crl = ./modules/tls/iptel_crl.pem
1423

    
1424
</code></pre>
1425

    
1426
sip-goautodial.conf
1427
<pre><code class="yaml">
1428
[kamailio]
1429
encryption=yes 
1430
disallow=all
1431
allow=opus
1432
allow=ulaw
1433
type=friend
1434
dtmfmode=rfc2833
1435
context=default
1436
qualify=yes
1437
nat=force_rport,comedia
1438
host=callcenter.siarum.com 
1439
insecure=port,invite
1440

    
1441
</code></pre>
1442
kamctlrc
1443
<pre><code class="yaml">
1444
# The Kamailio configuration file for the control tools.
1445
#
1446
# Here you can set variables used in the kamctl and kamdbctl setup
1447
# scripts. Per default all variables here are commented out, the control tools
1448
# will use their internal default values.
1449

    
1450
## your SIP domain
1451
SIP_DOMAIN=callcenter.siarum.com
1452

    
1453
## chrooted directory
1454
# $CHROOT_DIR="/path/to/chrooted/directory"
1455

    
1456
## database type: MYSQL, PGSQL, ORACLE, DB_BERKELEY, DBTEXT, or SQLITE
1457
# by default none is loaded
1458
#
1459
# If you want to setup a database with kamdbctl, you must at least specify
1460
# this parameter.
1461
DBENGINE=MYSQL
1462

    
1463
## database host
1464
DBHOST=localhost
1465

    
1466
## database host
1467
DBPORT=3306
1468

    
1469
## database name (for ORACLE this is TNS name)
1470
DBNAME=kamailio
1471

    
1472
# database path used by dbtext, db_berkeley or sqlite
1473
# DB_PATH="/usr/local/etc/kamailio/dbtext"
1474

    
1475
## database read/write user
1476
DBRWUSER="kamailio"
1477

    
1478
## password for database read/write user
1479
DBRWPW="kamailiorw"
1480

    
1481
## database read only user
1482
DBROUSER="kamailioro"
1483

    
1484
## password for database read only user
1485
DBROPW="kamailioro"
1486

    
1487
## database access host (from where is kamctl used)
1488
# DBACCESSHOST=192.168.0.1
1489

    
1490
## database super user (for ORACLE this is 'scheme-creator' user)
1491
DBROOTUSER="root"
1492

    
1493
## password for database super user
1494
## - important: this is insecure, targeting the use only for automatic testing
1495
## - known to work for: mysql
1496
# DBROOTPW="dbrootpw"
1497

    
1498
## database character set (used by MySQL when creating database)
1499
#CHARSET="latin1"
1500

    
1501
## user name column
1502
# USERCOL="username"
1503

    
1504

    
1505
# SQL definitions
1506
# If you change this definitions here, then you must change them
1507
# in db/schema/entities.xml too.
1508
# FIXME
1509

    
1510
# FOREVER="2030-05-28 21:32:15"
1511
# DEFAULT_Q="1.0"
1512

    
1513

    
1514
# Program to calculate a message-digest fingerprint
1515
# MD5="md5sum"
1516

    
1517
# awk tool
1518
# AWK="awk"
1519

    
1520
# gdb tool
1521
# GDB="gdb"
1522

    
1523
# If you use a system with a grep and egrep that is not 100% gnu grep compatible,
1524
# e.g. solaris, install the gnu grep (ggrep) and specify this below.
1525
#
1526
# grep tool
1527
# GREP="grep"
1528

    
1529
# egrep tool
1530
# EGREP="egrep"
1531

    
1532
# sed tool
1533
# SED="sed"
1534

    
1535
# tail tool
1536
# LAST_LINE="tail -n 1"
1537

    
1538
# expr tool
1539
# EXPR="expr"
1540

    
1541

    
1542
# Describe what additional tables to install. Valid values for the variables
1543
# below are yes/no/ask. With ask (default) it will interactively ask the user
1544
# for an answer, while yes/no allow for automated, unassisted installs.
1545
#
1546

    
1547
# If to install tables for the modules in the EXTRA_MODULES variable.
1548
# INSTALL_EXTRA_TABLES=ask
1549

    
1550
# If to install presence related tables.
1551
# INSTALL_PRESENCE_TABLES=ask
1552

    
1553
# If to install uid modules related tables.
1554
# INSTALL_DBUID_TABLES=ask
1555

    
1556
# Define what module tables should be installed.
1557
# If you use the postgres database and want to change the installed tables, then you
1558
# must also adjust the STANDARD_TABLES or EXTRA_TABLES variable accordingly in the
1559
# kamdbctl.base script.
1560

    
1561
# Kamailio standard modules
1562
# STANDARD_MODULES="standard acc lcr domain group permissions registrar usrloc msilo
1563
#                   alias_db uri_db speeddial avpops auth_db pdt dialog dispatcher
1564
#                   dialplan"
1565

    
1566
# Kamailio extra modules
1567
# EXTRA_MODULES="imc cpl siptrace domainpolicy carrierroute userblacklist htable purple sca"
1568

    
1569

    
1570
## type of aliases used: DB - database aliases; UL - usrloc aliases
1571
## - default: none
1572
# ALIASES_TYPE="DB"
1573

    
1574
## control engine: RPCFIFO
1575
## - default RPCFIFO
1576
CTLENGINE="RPCFIFO"
1577

    
1578
## path to FIFO file for engine RPCFIFO
1579
RPCFIFOPATH="/var/run/kamailio/kamailio_rpc.fifo"
1580

    
1581
## check ACL names; default on (1); off (0)
1582
# VERIFY_ACL=1
1583

    
1584
## ACL names - if VERIFY_ACL is set, only the ACL names from below list
1585
## are accepted
1586
# ACL_GROUPS="local ld int voicemail free-pstn"
1587

    
1588
## verbose - debug purposes - default '0'
1589
VERBOSE=1
1590

    
1591
## do (1) or don't (0) store plaintext passwords
1592
## in the subscriber table - default '1'
1593
STORE_PLAINTEXT_PW=0
1594

    
1595
## Kamailio START Options
1596
## PID file path - default is: /var/run/kamailio/kamailio.pid
1597
PID_FILE=/var/run/kamailio/kamailio.pid
1598

    
1599
## Extra start options - default is: not set
1600
# example: start Kamailio with 64MB share memory: STARTOPTIONS="-m 64"
1601
# STARTOPTIONS=
1602

    
1603

    
1604

    
1605
Terminal With this Tests (Kamailio seems to start then crash)
1606
systemctl status php-fpm 
1607
systemctl status httpd
1608
systemctl status mariadb
1609
systemctl status mysqld 
1610
systemctl status ngcp-rtpengine
1611
systemctl status asterisk
1612
systemctl status kamailio
1613
systemctl restart kamailio
1614
systemctl disable kamailio
1615
systemctl enable kamailio
1616
systemctl start kamailio
1617
systemctl status kamailio -l
1618
kamailio -c
1619

    
1620
<pre><code class="text">
1621
[root@centos-s-2vcpu-4gb-nyc1-01 ~]# clear
1622
[root@centos-s-2vcpu-4gb-nyc1-01 ~]# systemctl status php-fpm
1623
● php-fpm.service - The PHP FastCGI Process Manager
1624
   Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; vendor preset: disabled)
1625
   Active: active (running) since Sun 2019-06-16 02:32:50 UTC; 9h ago
1626
 Main PID: 3061 (php-fpm)
1627
   Status: "Processes active: 0, idle: 17, Requests: 2275, slow: 0, Traffic: 0req/sec"
1628
   CGroup: /system.slice/php-fpm.service
1629
           ├─ 3061 php-fpm: master process (/etc/php-fpm.conf)
1630
           ├─ 3136 php-fpm: pool www
1631
           ├─ 3138 php-fpm: pool www
1632
           ├─ 3139 php-fpm: pool www
1633
           ├─ 3140 php-fpm: pool www
1634
           ├─ 3141 php-fpm: pool www
1635
           ├─ 3692 php-fpm: pool www
1636
           ├─30243 php-fpm: pool www
1637
           ├─30272 php-fpm: pool www
1638
           ├─30281 php-fpm: pool www
1639
           ├─30282 php-fpm: pool www
1640
           ├─30299 php-fpm: pool www
1641
           ├─30300 php-fpm: pool www
1642
           ├─30301 php-fpm: pool www
1643
           ├─30302 php-fpm: pool www
1644
           ├─30313 php-fpm: pool www
1645
           ├─30314 php-fpm: pool www
1646
           └─30572 php-fpm: pool www
1647

    
1648
Jun 16 02:32:49 centos-s-2vcpu-4gb-nyc1-01 systemd[1]: Starting The PHP FastCGI Process Manager...
1649
Jun 16 02:32:50 centos-s-2vcpu-4gb-nyc1-01 systemd[1]: Started The PHP FastCGI Process Manager.
1650
[root@centos-s-2vcpu-4gb-nyc1-01 ~]# systemctl status httpd
1651
● httpd.service - The Apache HTTP Server
1652
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
1653
   Active: active (running) since Sun 2019-06-16 02:32:50 UTC; 9h ago
1654
     Docs: man:httpd(8)
1655
           man:apachectl(8)
1656
 Main PID: 3065 (httpd)
1657
   Status: "Total requests: 0; Current requests/sec: 0; Current traffic:   0 B/sec"
1658
   CGroup: /system.slice/httpd.service
1659
           ├─ 3065 /usr/sbin/httpd -DFOREGROUND
1660
           ├─31423 /usr/sbin/httpd -DFOREGROUND
1661
           ├─31556 /usr/sbin/httpd -DFOREGROUND
1662
           ├─31681 /usr/sbin/httpd -DFOREGROUND
1663
           ├─31735 /usr/sbin/httpd -DFOREGROUND
1664
           ├─31809 /usr/sbin/httpd -DFOREGROUND
1665
           ├─31878 /usr/sbin/httpd -DFOREGROUND
1666
           ├─32056 /usr/sbin/httpd -DFOREGROUND
1667
           ├─32064 /usr/sbin/httpd -DFOREGROUND
1668
           ├─32171 /usr/sbin/httpd -DFOREGROUND
1669
           └─32228 /usr/sbin/httpd -DFOREGROUND
1670

    
1671
Jun 16 02:32:49 centos-s-2vcpu-4gb-nyc1-01 systemd[1]: Starting The Apache HTTP Server...
1672
Jun 16 02:32:50 centos-s-2vcpu-4gb-nyc1-01 systemd[1]: Started The Apache HTTP Server.
1673
Jun 16 03:21:02 centos-s-2vcpu-4gb-nyc1-01 systemd[1]: Reloading The Apache HTTP Server.
1674
Jun 16 03:21:02 centos-s-2vcpu-4gb-nyc1-01 systemd[1]: Reloaded The Apache HTTP Server.
1675
[root@centos-s-2vcpu-4gb-nyc1-01 ~]# systemctl status mariadb
1676
● mariadb.service - MariaDB 10.1.36 database server
1677
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
1678
  Drop-In: /etc/systemd/system/mariadb.service.d
1679
           └─migrated-from-my.cnf-settings.conf
1680
   Active: active (running) since Sun 2019-06-16 02:32:52 UTC; 9h ago
1681
     Docs: man:mysqld(8)
1682
           https://mariadb.com/kb/en/library/systemd/
1683
 Main PID: 3244 (mysqld)
1684
   Status: "Taking your SQL requests now..."
1685
   CGroup: /system.slice/mariadb.service
1686
           └─3244 /usr/sbin/mysqld
1687

    
1688
Jun 16 02:32:49 centos-s-2vcpu-4gb-nyc1-01 systemd[1]: Starting MariaDB 10.1.36 database server...
1689
Jun 16 02:32:51 centos-s-2vcpu-4gb-nyc1-01 mysqld[3244]: 2019-06-16  2:32:51 139919916591360 [Note] Using unique option prefix 'max_heap_table' is error-prone and can break in the future. Please use the full name 'max_h..._size' instead.
1690
Jun 16 02:32:51 centos-s-2vcpu-4gb-nyc1-01 mysqld[3244]: 2019-06-16  2:32:51 139919916591360 [Note] /usr/sbin/mysqld (mysqld 10.1.36-MariaDB) starting as process 3244 ...
1691
Jun 16 02:32:52 centos-s-2vcpu-4gb-nyc1-01 systemd[1]: Started MariaDB 10.1.36 database server.
1692
Hint: Some lines were ellipsized, use -l to show in full.
1693
[root@centos-s-2vcpu-4gb-nyc1-01 ~]# systemctl status mysqld
1694
● mariadb.service - MariaDB 10.1.36 database server
1695
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
1696
  Drop-In: /etc/systemd/system/mariadb.service.d
1697
           └─migrated-from-my.cnf-settings.conf
1698
   Active: active (running) since Sun 2019-06-16 02:32:52 UTC; 9h ago
1699
     Docs: man:mysqld(8)
1700
           https://mariadb.com/kb/en/library/systemd/
1701
 Main PID: 3244 (mysqld)
1702
   Status: "Taking your SQL requests now..."
1703
   CGroup: /system.slice/mariadb.service
1704
           └─3244 /usr/sbin/mysqld
1705

    
1706
Jun 16 02:32:49 centos-s-2vcpu-4gb-nyc1-01 systemd[1]: Starting MariaDB 10.1.36 database server...
1707
Jun 16 02:32:51 centos-s-2vcpu-4gb-nyc1-01 mysqld[3244]: 2019-06-16  2:32:51 139919916591360 [Note] Using unique option prefix 'max_heap_table' is error-prone and can break in the future. Please use the full name 'max_h..._size' instead.
1708
Jun 16 02:32:51 centos-s-2vcpu-4gb-nyc1-01 mysqld[3244]: 2019-06-16  2:32:51 139919916591360 [Note] /usr/sbin/mysqld (mysqld 10.1.36-MariaDB) starting as process 3244 ...
1709
Jun 16 02:32:52 centos-s-2vcpu-4gb-nyc1-01 systemd[1]: Started MariaDB 10.1.36 database server.
1710
Hint: Some lines were ellipsized, use -l to show in full.
1711
[root@centos-s-2vcpu-4gb-nyc1-01 ~]# systemctl status ngcp-rtpengine
1712
● ngcp-rtpengine.service - LSB: NGCP rtpengine
1713
   Loaded: loaded (/etc/rc.d/init.d/ngcp-rtpengine; bad; vendor preset: disabled)
1714
   Active: active (running) since Sun 2019-06-16 02:32:53 UTC; 9h ago
1715
     Docs: man:systemd-sysv-generator(8)
1716
 Main PID: 3595 (rtpengine)
1717
   CGroup: /system.slice/ngcp-rtpengine.service
1718
           └─3595 /usr/sbin/rtpengine --no-fallback --config-file=/etc/rtpengine/rtpengine.conf --pidfile=/var/run/rtpengine.pid
1719

    
1720
Jun 16 02:32:52 centos-s-2vcpu-4gb-nyc1-01 systemd[1]: Starting LSB: NGCP rtpengine...
1721
Jun 16 02:32:52 centos-s-2vcpu-4gb-nyc1-01 ngcp-rtpengine[3482]: Loading module for in-kernel packet forwarding
1722
Jun 16 02:32:53 centos-s-2vcpu-4gb-nyc1-01 rtpengine[3581]: INFO: Generating new DTLS certificate
1723
Jun 16 02:32:53 centos-s-2vcpu-4gb-nyc1-01 ngcp-rtpengine[3482]: Starting rtpengine: [  OK  ]
1724
Jun 16 02:32:53 centos-s-2vcpu-4gb-nyc1-01 rtpengine[3595]: INFO: Startup complete, version 6.4.0.0-1.el7
1725
Jun 16 02:32:53 centos-s-2vcpu-4gb-nyc1-01 systemd[1]: Started LSB: NGCP rtpengine.
1726
[root@centos-s-2vcpu-4gb-nyc1-01 ~]# systemctl status asterisk
1727
● asterisk.service - Asterisk PBX and telephony daemon.
1728
   Loaded: loaded (/usr/lib/systemd/system/asterisk.service; enabled; vendor preset: disabled)
1729
   Active: active (running) since Sun 2019-06-16 02:32:49 UTC; 9h ago
1730
 Main PID: 3068 (asterisk)
1731
   CGroup: /system.slice/asterisk.service
1732
           └─3068 /usr/sbin/asterisk -f -C /etc/asterisk/asterisk.conf
1733

    
1734
Jun 16 12:28:21 centos-s-2vcpu-4gb-nyc1-01 asterisk[3068]: [Jun 16 12:28:21] NOTICE[5488]: manager.c:3399 authenticate: 209.126.73.112 failed to authenticate as 'admin'
1735
Jun 16 12:29:08 centos-s-2vcpu-4gb-nyc1-01 asterisk[3068]: [Jun 16 12:29:08] NOTICE[5578]: manager.c:3362 authenticate: 209.126.73.112 tried to authenticate with nonexistent user 'admin'
1736
Jun 16 12:29:08 centos-s-2vcpu-4gb-nyc1-01 asterisk[3068]: [Jun 16 12:29:08] NOTICE[5578]: manager.c:3399 authenticate: 209.126.73.112 failed to authenticate as 'admin'
1737
Jun 16 12:29:11 centos-s-2vcpu-4gb-nyc1-01 asterisk[3068]: [Jun 16 12:29:11] NOTICE[3477][C-0000005e]: chan_sip.c:26307 handle_request_invite: Failed to authenticate device <sip:101@165.22.15.111>;tag=1834104104
1738
Jun 16 12:29:43 centos-s-2vcpu-4gb-nyc1-01 asterisk[3068]: [Jun 16 12:29:43] WARNING[3477]: chan_sip.c:4072 retrans_pkt: Retransmission timeout reached on transmission 638053857-1119118654-564395875 for seqno 2 (Critica...Retransmissions
1739
Jun 16 12:29:43 centos-s-2vcpu-4gb-nyc1-01 asterisk[3068]: Packet timed out after 32000ms with no response
1740
Jun 16 12:29:53 centos-s-2vcpu-4gb-nyc1-01 asterisk[3068]: [Jun 16 12:29:53] NOTICE[5635]: manager.c:3362 authenticate: 209.126.73.112 tried to authenticate with nonexistent user 'admin'
1741
Jun 16 12:29:53 centos-s-2vcpu-4gb-nyc1-01 asterisk[3068]: [Jun 16 12:29:53] NOTICE[5635]: manager.c:3399 authenticate: 209.126.73.112 failed to authenticate as 'admin'
1742
Jun 16 12:30:38 centos-s-2vcpu-4gb-nyc1-01 asterisk[3068]: [Jun 16 12:30:38] NOTICE[5733]: manager.c:3362 authenticate: 209.126.73.112 tried to authenticate with nonexistent user 'admin'
1743
Jun 16 12:30:38 centos-s-2vcpu-4gb-nyc1-01 asterisk[3068]: [Jun 16 12:30:38] NOTICE[5733]: manager.c:3399 authenticate: 209.126.73.112 failed to authenticate as 'admin'
1744
Hint: Some lines were ellipsized, use -l to show in full.
1745
[root@centos-s-2vcpu-4gb-nyc1-01 ~]# systemctl status kamailio
1746
● kamailio.service - Kamailio (OpenSER) - the Open Source SIP Server
1747
   Loaded: loaded (/usr/lib/systemd/system/kamailio.service; enabled; vendor preset: disabled)
1748
   Active: failed (Result: start-limit) since Sun 2019-06-16 12:22:33 UTC; 8min ago
1749
  Process: 4872 ExecStart=/usr/sbin/kamailio -DD -P /var/run/kamailio/kamailio.pid -f $CFGFILE -m $SHM_MEMORY -M $PKG_MEMORY (code=exited, status=255)
1750
 Main PID: 4872 (code=exited, status=255)
1751

    
1752
Jun 16 12:22:33 centos-s-2vcpu-4gb-nyc1-01 systemd[1]: kamailio.service: main process exited, code=exited, status=255/n/a
1753
Jun 16 12:22:33 centos-s-2vcpu-4gb-nyc1-01 systemd[1]: Unit kamailio.service entered failed state.
1754
Jun 16 12:22:33 centos-s-2vcpu-4gb-nyc1-01 systemd[1]: kamailio.service failed.
1755
Jun 16 12:22:33 centos-s-2vcpu-4gb-nyc1-01 systemd[1]: kamailio.service holdoff time over, scheduling restart.
1756
Jun 16 12:22:33 centos-s-2vcpu-4gb-nyc1-01 systemd[1]: Stopped Kamailio (OpenSER) - the Open Source SIP Server.
1757
Jun 16 12:22:33 centos-s-2vcpu-4gb-nyc1-01 systemd[1]: start request repeated too quickly for kamailio.service
1758
Jun 16 12:22:33 centos-s-2vcpu-4gb-nyc1-01 systemd[1]: Failed to start Kamailio (OpenSER) - the Open Source SIP Server.
1759
Jun 16 12:22:33 centos-s-2vcpu-4gb-nyc1-01 systemd[1]: Unit kamailio.service entered failed state.
1760
Jun 16 12:22:33 centos-s-2vcpu-4gb-nyc1-01 systemd[1]: kamailio.service failed.
1761
[root@centos-s-2vcpu-4gb-nyc1-01 ~]# systemctl restart kamailio
1762
[root@centos-s-2vcpu-4gb-nyc1-01 ~]# systemctl disable kamailio
1763
Removed symlink /etc/systemd/system/multi-user.target.wants/kamailio.service.
1764
[root@centos-s-2vcpu-4gb-nyc1-01 ~]# systemctl enable kamailio
1765
Created symlink from /etc/systemd/system/multi-user.target.wants/kamailio.service to /usr/lib/systemd/system/kamailio.service.
1766
[root@centos-s-2vcpu-4gb-nyc1-01 ~]# systemctl start kamailio
1767
[root@centos-s-2vcpu-4gb-nyc1-01 ~]# systemctl status kamailio -l
1768
● kamailio.service - Kamailio (OpenSER) - the Open Source SIP Server
1769
   Loaded: loaded (/usr/lib/systemd/system/kamailio.service; enabled; vendor preset: disabled)
1770
   Active: active (running) since Sun 2019-06-16 12:30:52 UTC; 86ms ago
1771
 Main PID: 5808 (kamailio)
1772
   CGroup: /system.slice/kamailio.service
1773
           └─5808 /usr/sbin/kamailio -DD -P /var/run/kamailio/kamailio.pid -f /etc/kamailio/kamailio.cfg -m 64 -M 4
1774

    
1775
Jun 16 12:30:52 centos-s-2vcpu-4gb-nyc1-01 kamailio[5808]: tcp: 165.22.15.111:5060
1776
Jun 16 12:30:52 centos-s-2vcpu-4gb-nyc1-01 kamailio[5808]: tcp: 165.22.15.111:8081
1777
Jun 16 12:30:52 centos-s-2vcpu-4gb-nyc1-01 kamailio[5808]: tls: 165.22.15.111:5061
1778
Jun 16 12:30:52 centos-s-2vcpu-4gb-nyc1-01 kamailio[5808]: tls: 165.22.15.111:4443
1779
Jun 16 12:30:52 centos-s-2vcpu-4gb-nyc1-01 kamailio[5808]: tls: 165.22.15.111:9080
1780
Jun 16 12:30:52 centos-s-2vcpu-4gb-nyc1-01 kamailio[5808]: Aliases:
1781
Jun 16 12:30:52 centos-s-2vcpu-4gb-nyc1-01 kamailio[5808]: *: 165.22.15.111:*
1782
Jun 16 12:30:52 centos-s-2vcpu-4gb-nyc1-01 kamailio[5808]: *: callcenter.siarum.com:*
1783
Jun 16 12:30:52 centos-s-2vcpu-4gb-nyc1-01 kamailio[5808]: INFO: <core> [core/sctp_core.c:75]: sctp_core_check_support(): SCTP API not enabled - if you want to use it, load sctp module
1784
Jun 16 12:30:52 centos-s-2vcpu-4gb-nyc1-01 kamailio[5808]: INFO: <core> [core/tcp_main.c:4671]: init_tcp(): using epoll_lt as the io watch method (auto detected)
1785
[root@centos-s-2vcpu-4gb-nyc1-01 ~]# kamailio -c
1786
loading modules under config path: /usr/lib64/kamailio/modules/
1787
 0(5813) INFO: tls [tls_init.c:497]: init_tls_compression(): tls: init_tls: disabling compression...
1788
 0(5813) WARNING: <core> [core/ppcfg.c:221]: pp_ifdef_level_check(): different number of preprocessor directives: N(#!IF[N]DEF) - N(#!ENDIF) = 1
1789
 0(5813) INFO: <core> [core/sctp_core.c:75]: sctp_core_check_support(): SCTP API not enabled - if you want to use it, load sctp module
1790
!endifListening on
1791
             udp: 165.22.15.111:5060
1792
             udp: callcenter.siarum.com [127.0.0.1]:5060
1793
             tcp: 165.22.15.111:5060
1794
             tcp: 165.22.15.111:8081
1795
             tls: 165.22.15.111:5061
1796
             tls: 165.22.15.111:4443
1797
             tls: 165.22.15.111:9080
1798
Aliases:
1799
             *: 165.22.15.111:*
1800
             *: callcenter.siarum.com:*
1801

    
1802
config file ok, exiting...
1803
[root@centos-s-2vcpu-4gb-nyc1-01 ~]# systemctl start kamailio
1804
[root@centos-s-2vcpu-4gb-nyc1-01 ~]# systemctl status kamailio -l
1805
● kamailio.service - Kamailio (OpenSER) - the Open Source SIP Server
1806
   Loaded: loaded (/usr/lib/systemd/system/kamailio.service; enabled; vendor preset: disabled)
1807
   Active: failed (Result: start-limit) since Sun 2019-06-16 12:31:06 UTC; 1s ago
1808
  Process: 5876 ExecStart=/usr/sbin/kamailio -DD -P /var/run/kamailio/kamailio.pid -f $CFGFILE -m $SHM_MEMORY -M $PKG_MEMORY (code=exited, status=255)
1809
 Main PID: 5876 (code=exited, status=255)
1810

    
1811
Jun 16 12:31:06 centos-s-2vcpu-4gb-nyc1-01 systemd[1]: kamailio.service: main process exited, code=exited, status=255/n/a
1812
Jun 16 12:31:06 centos-s-2vcpu-4gb-nyc1-01 systemd[1]: Unit kamailio.service entered failed state.
1813
Jun 16 12:31:06 centos-s-2vcpu-4gb-nyc1-01 systemd[1]: kamailio.service failed.
1814
Jun 16 12:31:06 centos-s-2vcpu-4gb-nyc1-01 systemd[1]: kamailio.service holdoff time over, scheduling restart.
1815
Jun 16 12:31:06 centos-s-2vcpu-4gb-nyc1-01 systemd[1]: Stopped Kamailio (OpenSER) - the Open Source SIP Server.
1816
Jun 16 12:31:06 centos-s-2vcpu-4gb-nyc1-01 systemd[1]: start request repeated too quickly for kamailio.service
1817
Jun 16 12:31:06 centos-s-2vcpu-4gb-nyc1-01 systemd[1]: Failed to start Kamailio (OpenSER) - the Open Source SIP Server.
1818
Jun 16 12:31:06 centos-s-2vcpu-4gb-nyc1-01 systemd[1]: Unit kamailio.service entered failed state.
1819
Jun 16 12:31:06 centos-s-2vcpu-4gb-nyc1-01 systemd[1]: kamailio.service failed.
1820
[root@centos-s-2vcpu-4gb-nyc1-01 ~]#
1821

    
1822
</code></pre>
(2-2/2) Go to top