[SR-Users] Can't add permanent location

2018-10-31 Thread David Villasmil
Hello all,

I'm trying to add a permanent location.

i’m using db_mode 1, use_domain = 1, i tried that command

kamctl rpc ul.add location 361119...@m.domain.com sip:361119997@4.3.2.1
3600 0 sip:4.3.2.1:5060


Response is:

{
"jsonrpc": "2.0",
"error": {
"code": -32000,
"message": "Execution Error"
},
"id": 25950
}


Anyone knows what this might be?

David
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Store TLS handshake date from Kamailio to an external DB

2018-10-31 Thread Toffi Bossol

Hello Joel,


manythanks for your reply.

Background info: Iam trying to implement Kamailio as stateless as possible and 
wonder how I cancache and reuse the information from a TLS connection within a 
database.

 

And does cachingmake sense?

Best regards,

Toffi







 

Am Mittwoch, 31. Oktober 2018, 02:01:04 MEZ hat Joel Serrano 
 Folgendes geschrieben:  
 
 Maybe use a pseudovariable from the TLS module to get the data you want and 
then use sqlops to insert it to database?
Have a look: 
https://www.kamailio.org/wiki/cookbooks/5.1.x/pseudovariables#tls_module_pseudo-variableshttps://kamailio.org/docs/modules/5.1.x/modules/sqlops.html

On Tue, Oct 30, 2018 at 8:11 AM Toffi Bossol  wrote:

Dear community,

I am new in Kamailio hence the following question:
Does any one know how to  tell Kamailio to store the TLS session data in an 
external DB?
Many Thanks in advance!

BR;
Toffi
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
  ___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Determine destination address family

2018-10-31 Thread Alex Balashov
On Wed, Oct 31, 2018 at 10:16:40AM -0700, Isaac wrote:

> How can I determine the address family (IPv6 or IPv4) of a destination? The
> destination in this case is a hostname. I'd like to set a flag if the
> destination is IPv6 but not sure how to go about it.

Hi,

You can look up the underlying IP address with dns_query() from the
ipops module:

https://kamailio.org/docs/modules/5.1.x/modules/ipops.html#ipops.f.dns_query

Which also provides these testing functions:

https://kamailio.org/docs/modules/5.1.x/modules/ipops.html#ipops.f.is_ipv4
https://kamailio.org/docs/modules/5.1.x/modules/ipops.html#ipops.f.is_ipv6

-- Alex

-- 
Alex Balashov | Principal | Evariste Systems LLC

Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free) 
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Can't add permanent location

2018-10-31 Thread David Villasmil
Hey thanks!!

not working, but i'm finally getting some useful erros:

Oct 31 13:22:52 sip2 /usr/sbin/kamailio[1326]: DEBUG: jsonrpcs
[jsonrpcs_fifo.c:449]: jsonrpc_fifo_server(): preparing to execute fifo
jsonrpc [{"jsonrpc": "2.0", "method": "ul.add", "params": ["location", "
361119...@sip2.domain.com", "sip:361119997@4.3.2.1", 3600, 1, "sip:
4.3.2.1:5060", 0, 0, 13279, ".", "."], "reply_name":
"kamailio_receiver_2583", "id": 2583}]
Oct 31 13:22:52 sip2 /usr/sbin/kamailio[1326]: DEBUG: usrloc
[ul_rpc.c:573]: ul_rpc_add(): ret: 9 table:location
aor:361119...@sip2.hayo.sn contact:sip:361119997@4.3.2.1 expires:3600
dtemp:1.00 path:sip:4.3.2.1:5060 flags:0 bflags:0 methods:13279
Oct 31 13:22:52 sip2 /usr/sbin/kamailio[1326]: DEBUG: usrloc
[ul_rpc.c:580]: ul_rpc_add(): q:1
Oct 31 13:22:52 sip2 /usr/sbin/kamailio[1326]: DEBUG:  [sruid.c:183]:
sruid_next(): new sruid is [ulcx-5bd9ddde-525-a] (10 / 19)
Oct 31 13:22:52 sip2 /usr/sbin/kamailio[1326]: ERROR:  [db.c:452]:
db_use_table(): invalid parameter value
Oct 31 13:22:52 sip2 /usr/sbin/kamailio[1326]: ERROR: usrloc
[udomain.c:631]: db_load_urecord(): failed to use table location
Oct 31 13:22:52 sip2 /usr/sbin/kamailio[1326]: ERROR:  [db.c:452]:
db_use_table(): invalid parameter value
Oct 31 13:22:52 sip2 /usr/sbin/kamailio[1326]: ERROR: usrloc
[ucontact.c:678]: db_insert_ucontact(): sql use_table failed
Oct 31 13:22:52 sip2 /usr/sbin/kamailio[1326]: ERROR: usrloc
[urecord.c:582]: insert_ucontact(): failed to insert in database
Oct 31 13:22:52 sip2 /usr/sbin/kamailio[1326]: DEBUG: jsonrpcs
[jsonrpcs_mod.c:395]: jsonrpc_send(): sending response with body: (nil) -
500 Can't insert contact
Oct 31 13:22:52 sip2 /usr/sbin/kamailio[1326]: DEBUG: jsonrpcs
[jsonrpcs_fifo.c:461]: jsonrpc_fifo_server(): command executed - result:
[kamailio_receiver_2583] [500] [0x143dd50]
[{#012#011"jsonrpc":#011"2.0",#012#011"error":#0



Regards,

David Villasmil
email: david.villasmil.w...@gmail.com
phone: +34669448337

ᐧ

On Wed, Oct 31, 2018 at 6:14 PM Joel Serrano  wrote:

> Hi David,
>
> Sorry for the delay.. You are missing parameters:
>
> root@sbc02:~# kamctl rpc ul.add location 361119...@m.domain.com
> sip:361119997@4.3.2.1 3600 1 sip:4.3.2.1:5060
> {
>   "jsonrpc":  "2.0",
>   "error":  {
> "code": 500,
> "message":  "Not enough parameters or wrong format"
>   },
>   "id": 31201
> }
> root@sbc02:~#
>
> root@sbc02:~# kamctl rpc ul.add location 361119...@m.domain.com
> sip:361119997@4.3.2.1 3600 1 sip:4.3.2.1:5060 0 0 13279 . .
> {
>   "jsonrpc":  "2.0",
>   "result": {
>   },
>   "id": 31249
> }
> root@sbc02:~#
>
> root@sbc02:~# kamctl rpc ul.dump
> {
>   "jsonrpc":  "2.0",
>   "result": {
> "Domains":  [{
> "Domain": {
>   "Domain": "location",
>   "Size": 1024,
>   "AoRs": [{
>   "Info": {
> "AoR":  "361119997",
> "HashID": 1820329880,
> "Contacts": [{
> "Contact":  {
>   "Address":  "sip:361119997@4.3.2.1",
>   "Expires":  3592,
>   "Q":  1,
>   "Call-ID":  "dfjrewr12386fd6-...@kamailio.rpc",
>   "CSeq": 1,
>   "User-Agent": "kamailio SIP Router - RPC Server",
>   "Received": "[not set]",
>   "Path": "sip:4.3.2.1:5060",
>   "State":  "CS_SYNC",
>   "Flags":  0,
>   "CFlags": 0,
>   "Socket": "[not set]",
>   "Methods":  13279,
>   "Ruid": "ulcx-5bd875a3-712-1",
>   "Instance": "[not set]",
>   "Reg-Id": 0,
>   "Server-Id":  0,
>   "Tcpconn-Id": 0,
>   "Keepalive":  0,
>   "Last-Keepalive": 0,
>   "Last-Modified":  0
> }
>   }]
>   }
> }
>   ],
>   "Stats":  {
> "Records":  1,
> "Max-Slots":  1
>   }
> }
>   }]
>   },
>   "id": 31347
> }
> root@sbc02:~#
>
>
> More info:
> https://kamailio.org/docs/modules/5.1.x/modules/usrloc.html#usrloc.r.add
>
>
>
>
>
>
> On Wed, Oct 31, 2018 at 10:05 AM David Villasmil <
> david.villasmil.w...@gmail.com> wrote:
>
>> Ok, I checked my config and i had
>>
>> save("location","0x01")
>>
>> which disables saving the location in db, now when i register i see the
>> location in the table...
>> But i still can't add a location:
>>
>> Some help would be appreciated!
>>
>> David
>>
>>
>> Regards,
>>
>> David Villasmil
>> email: david.villasmil.w...@gmail.com
>> phone: +34669448337
>>
>> ᐧ
>>
>> On Wed, Oct 31, 2018 at 3:22 PM David Villasmil <
>> david.villasmil.w...@gmail.com> wrote:
>>
>>> Hello all,
>>>
>>> I'm trying to add a permanent location.
>>>
>>> i’m using db_mode 1, use_domain = 1, i tried 

[SR-Users] Crash ims_diameter_server

2018-10-31 Thread Iman Mohammadi
When the below format is sent from rest , kamailio crashes

List[{
List[{
List[{
 ]}
 ]}
 ]}
(Json with 3 nested lists),
With 2 lists it works properly,
When diameter is translated to json with 3 lists by this module it also
works properly,
Json format is correct too.

gdb:

gdb) bt full
#0  0x7f5e23c4a11e in diameterserver_add_avp (m=0x0,
d=0x7f5e1b5c2240 "", len=12, avp_code=431, flags=64, vendorid=0,
data_do=2,
func=0x7f5e23c51d6c <__FUNCTION__.20148> "parselist") at avp_helper.c:208
avp = 0x7f5e1b5c3bd0
__FUNCTION__ = "diameterserver_add_avp"
#1  0x7f5e23c4d0c8 in parselist (response=0x0,
list=0x7fff9f21a8d0, item=0x11b67d0, level=2) at avp_helper.c:309
i = 1
flags = 64
x = "p\250!\237"
avp_list = {head = 0x0, tail = 0x0}
avp_list_s = {s = 0x7f5e1b5c2240 "", len = 12}
__FUNCTION__ = "parselist"
#2  0x7f5e23c4cffc in parselist (response=0x7f5e1b5c3ab8,
list=0x0, item=0x11b6550, level=1) at avp_helper.c:304
subitem = 0x11b67d0
i = 0
flags = 64
x = "\000\000\000"
avp_list = {head = 0x0, tail = 0x0}
avp_list_s = {s = 0x7fff9f21a8f0 "@\251!\237\377\177", len = 600070897}
__FUNCTION__ = "parselist"
#3  0x7f5e23c4db3a in addAVPsfromJSON (response=0x7f5e1b5c3ab8,
json=0x7f5e23e53950 ) at avp_helper.c:349
subitem = 0x11b6550
i = 4
__FUNCTION__ = "addAVPsfromJSON"
root = 0x11b4210
#4  0x7f5e23c3fbdb in callback_cdp_request
(request_in=0x7f5e1b5c19b0, param=0x0) at ims_diameter_server.c:193
fmsg = 0xab7840 <_faked_msg>
backup_rt = 1
ctx = {rec_lev = 0, run_flags = 0, last_retcode = 1, jmp_env =
{{__jmpbuf = {1, -5713032302318786866, 7971288, 7971288,
140042162528420, 0, -5713032302339758386,
5712822384154044110}, __mask_was_saved = 0, __saved_mask = {__val = {
  140735863172072, 127, 0, 140042162532340,
140042389578761, 4222451713, 140042162532340, 140042162532340,
140042162532340,
  140042162532340, 140042162532358, 140042162532467,
140042162532340, 140042162532467, 0, 0}
response = 0x7f5e1b5c3ab8
__FUNCTION__ = "callback_cdp_request"
#5  0x7f5e24a705c0 in api_callback (p=0x7f5e1b598f50,
msg=0x7f5e1b5c19b0, ptr=0x0) at api_process.c:83
t = 0x7f5e1b598f50
auto_drop = 32767
h = 0x7f5e1b5b3358
---Type  to continue, or q  to quit---
x = {type = (unknown: 2669784000), handler = {requestHandler =
0x7f5e23c3eed1 ,
responseHandler = 0x7f5e23c3eed1 },
param = 0x3ee9f21ac10, next = 0x7f5e1b5988b8, prev = 0x19f210069}
type = REQUEST_HANDLER
rsp = 0x7f5e1b5c19b0
__FUNCTION__ = "api_callback"
#6  0x7f5e24a857d7 in worker_process (id=5) at worker.c:346
t = {p = 0x7f5e1b598f50, msg = 0x7f5e1b5c19b0}
cb = 0x7f5e1b59df30
r = 128
__FUNCTION__ = "worker_process"
#7  0x7f5e24a62a8e in diameter_peer_start (blocking=0) at
diameter_peer.c:242
pid = 0
k = 5
p = 0x36
__FUNCTION__ = "diameter_peer_start"
#8  0x7f5e24a559bc in cdp_child_init (rank=0) at cdp_mod.c:243
__FUNCTION__ = "cdp_child_init"
#9  0x00547e54 in init_mod_child (m=0x7f5e28656fb8, rank=0) at
core/sr_module.c:943
__FUNCTION__ = "init_mod_child"
#10 0x00547b16 in init_mod_child (m=0x7f5e28657c38, rank=0) at
core/sr_module.c:939
__FUNCTION__ = "init_mod_child"
#11 0x00547b16 in init_mod_child (m=0x7f5e28658010, rank=0) at
core/sr_module.c:939
__FUNCTION__ = "init_mod_child"
#12 0x00547b16 in init_mod_child (m=0x7f5e28658790, rank=0) at
core/sr_module.c:939
__FUNCTION__ = "init_mod_child"
#13 0x00547b16 in init_mod_child (m=0x7f5e28658d68, rank=0) at
core/sr_module.c:939
__FUNCTION__ = "init_mod_child"
#14 0x005481e6 in init_child (rank=0) at core/sr_module.c:970
No locals.
#15 0x004250f5 in main_loop () at main.c:1701
i = 8
pid = 1964
si = 0x0
si_desc = "udp receiver child=7
sock=10.25.5.23:5060\000y\000\000\000\000\000x\333i(^\177\000\000@\264!\237\377\177",
'\000' ,
"`\263!\237\377\177\000\000\347L\340(^\177\000\000\360\260!\237\377\177\000\000\060\000\000\000\060\000\000\000\260\261!\237\377\177\000\000\350\226i(^\177\000"
nrprocs = 8
---Type  to continue, or q  to quit---
woneinit = 1
__FUNCTION__ = "main_loop"
#16 0x0042b99b in main (argc=13, argv=0x7fff9f21b448) at main.c:2638
cfg_stream = 0x111c020
c = -1
r = 0
tmp = 0x7fff9f21bf69 ""
tmp_len = 32606
port = 693647725
proto = 0
options = 0x74cd90
":f:cm:M:dVIhEeb:l:L:n:vKrRDTN:W:w:t:u:g:P:G:SQ:O:a:A:x:X:Y:"
ret = -1
seed = 898203166
rfd = 4
debug_save = 0
debug_flag = 0
dont_fork_cnt = 0

Re: [SR-Users] Can't add permanent location

2018-10-31 Thread David Villasmil
doesn't say which param, upping the debug!

Regards,

David Villasmil
email: david.villasmil.w...@gmail.com
phone: +34669448337

ᐧ

On Wed, Oct 31, 2018 at 6:24 PM David Villasmil <
david.villasmil.w...@gmail.com> wrote:

> Hey thanks!!
>
> not working, but i'm finally getting some useful erros:
>
> Oct 31 13:22:52 sip2 /usr/sbin/kamailio[1326]: DEBUG: jsonrpcs
> [jsonrpcs_fifo.c:449]: jsonrpc_fifo_server(): preparing to execute fifo
> jsonrpc [{"jsonrpc": "2.0", "method": "ul.add", "params": ["location", "
> 361119...@sip2.domain.com", "sip:361119997@4.3.2.1", 3600, 1, "sip:
> 4.3.2.1:5060", 0, 0, 13279, ".", "."], "reply_name":
> "kamailio_receiver_2583", "id": 2583}]
> Oct 31 13:22:52 sip2 /usr/sbin/kamailio[1326]: DEBUG: usrloc
> [ul_rpc.c:573]: ul_rpc_add(): ret: 9 table:location
> aor:361119...@sip2.hayo.sn contact:sip:361119997@4.3.2.1 expires:3600
> dtemp:1.00 path:sip:4.3.2.1:5060 flags:0 bflags:0 methods:13279
> Oct 31 13:22:52 sip2 /usr/sbin/kamailio[1326]: DEBUG: usrloc
> [ul_rpc.c:580]: ul_rpc_add(): q:1
> Oct 31 13:22:52 sip2 /usr/sbin/kamailio[1326]: DEBUG: 
> [sruid.c:183]: sruid_next(): new sruid is [ulcx-5bd9ddde-525-a] (10 / 19)
> Oct 31 13:22:52 sip2 /usr/sbin/kamailio[1326]: ERROR:  [db.c:452]:
> db_use_table(): invalid parameter value
> Oct 31 13:22:52 sip2 /usr/sbin/kamailio[1326]: ERROR: usrloc
> [udomain.c:631]: db_load_urecord(): failed to use table location
> Oct 31 13:22:52 sip2 /usr/sbin/kamailio[1326]: ERROR:  [db.c:452]:
> db_use_table(): invalid parameter value
> Oct 31 13:22:52 sip2 /usr/sbin/kamailio[1326]: ERROR: usrloc
> [ucontact.c:678]: db_insert_ucontact(): sql use_table failed
> Oct 31 13:22:52 sip2 /usr/sbin/kamailio[1326]: ERROR: usrloc
> [urecord.c:582]: insert_ucontact(): failed to insert in database
> Oct 31 13:22:52 sip2 /usr/sbin/kamailio[1326]: DEBUG: jsonrpcs
> [jsonrpcs_mod.c:395]: jsonrpc_send(): sending response with body: (nil) -
> 500 Can't insert contact
> Oct 31 13:22:52 sip2 /usr/sbin/kamailio[1326]: DEBUG: jsonrpcs
> [jsonrpcs_fifo.c:461]: jsonrpc_fifo_server(): command executed - result:
> [kamailio_receiver_2583] [500] [0x143dd50]
> [{#012#011"jsonrpc":#011"2.0",#012#011"error":#0
>
>
>
> Regards,
>
> David Villasmil
> email: david.villasmil.w...@gmail.com
> phone: +34669448337
>
> ᐧ
>
> On Wed, Oct 31, 2018 at 6:14 PM Joel Serrano  wrote:
>
>> Hi David,
>>
>> Sorry for the delay.. You are missing parameters:
>>
>> root@sbc02:~# kamctl rpc ul.add location 361119...@m.domain.com
>> sip:361119997@4.3.2.1 3600 1 sip:4.3.2.1:5060
>> {
>>   "jsonrpc":  "2.0",
>>   "error":  {
>> "code": 500,
>> "message":  "Not enough parameters or wrong format"
>>   },
>>   "id": 31201
>> }
>> root@sbc02:~#
>>
>> root@sbc02:~# kamctl rpc ul.add location 361119...@m.domain.com
>> sip:361119997@4.3.2.1 3600 1 sip:4.3.2.1:5060 0 0 13279 . .
>> {
>>   "jsonrpc":  "2.0",
>>   "result": {
>>   },
>>   "id": 31249
>> }
>> root@sbc02:~#
>>
>> root@sbc02:~# kamctl rpc ul.dump
>> {
>>   "jsonrpc":  "2.0",
>>   "result": {
>> "Domains":  [{
>> "Domain": {
>>   "Domain": "location",
>>   "Size": 1024,
>>   "AoRs": [{
>>   "Info": {
>> "AoR":  "361119997",
>> "HashID": 1820329880,
>> "Contacts": [{
>> "Contact":  {
>>   "Address":  "sip:361119997@4.3.2.1",
>>   "Expires":  3592,
>>   "Q":  1,
>>   "Call-ID":  "dfjrewr12386fd6-...@kamailio.rpc",
>>   "CSeq": 1,
>>   "User-Agent": "kamailio SIP Router - RPC Server",
>>   "Received": "[not set]",
>>   "Path": "sip:4.3.2.1:5060",
>>   "State":  "CS_SYNC",
>>   "Flags":  0,
>>   "CFlags": 0,
>>   "Socket": "[not set]",
>>   "Methods":  13279,
>>   "Ruid": "ulcx-5bd875a3-712-1",
>>   "Instance": "[not set]",
>>   "Reg-Id": 0,
>>   "Server-Id":  0,
>>   "Tcpconn-Id": 0,
>>   "Keepalive":  0,
>>   "Last-Keepalive": 0,
>>   "Last-Modified":  0
>> }
>>   }]
>>   }
>> }
>>   ],
>>   "Stats":  {
>> "Records":  1,
>> "Max-Slots":  1
>>   }
>> }
>>   }]
>>   },
>>   "id": 31347
>> }
>> root@sbc02:~#
>>
>>
>> More info:
>> https://kamailio.org/docs/modules/5.1.x/modules/usrloc.html#usrloc.r.add
>>
>>
>>
>>
>>
>>
>> On Wed, Oct 31, 2018 at 10:05 AM David Villasmil <
>> david.villasmil.w...@gmail.com> wrote:
>>
>>> Ok, I checked my config and i had
>>>
>>> save("location","0x01")
>>>
>>> which disables saving the location in db, now when i register i see the
>>> location in the table...
>>> But i 

Re: [SR-Users] Can't add permanent location

2018-10-31 Thread Joel Serrano
In my test it added it correctly. I tried with master.

On Wed, Oct 31, 2018 at 10:28 AM David Villasmil <
david.villasmil.w...@gmail.com> wrote:

> doesn't say which param, upping the debug!
>
> Regards,
>
> David Villasmil
> email: david.villasmil.w...@gmail.com
> phone: +34669448337
>
> ᐧ
>
> On Wed, Oct 31, 2018 at 6:24 PM David Villasmil <
> david.villasmil.w...@gmail.com> wrote:
>
>> Hey thanks!!
>>
>> not working, but i'm finally getting some useful erros:
>>
>> Oct 31 13:22:52 sip2 /usr/sbin/kamailio[1326]: DEBUG: jsonrpcs
>> [jsonrpcs_fifo.c:449]: jsonrpc_fifo_server(): preparing to execute fifo
>> jsonrpc [{"jsonrpc": "2.0", "method": "ul.add", "params": ["location", "
>> 361119...@sip2.domain.com", "sip:361119997@4.3.2.1", 3600, 1, "sip:
>> 4.3.2.1:5060", 0, 0, 13279, ".", "."], "reply_name":
>> "kamailio_receiver_2583", "id": 2583}]
>> Oct 31 13:22:52 sip2 /usr/sbin/kamailio[1326]: DEBUG: usrloc
>> [ul_rpc.c:573]: ul_rpc_add(): ret: 9 table:location
>> aor:361119...@sip2.hayo.sn contact:sip:361119997@4.3.2.1 expires:3600
>> dtemp:1.00 path:sip:4.3.2.1:5060 flags:0 bflags:0 methods:13279
>> Oct 31 13:22:52 sip2 /usr/sbin/kamailio[1326]: DEBUG: usrloc
>> [ul_rpc.c:580]: ul_rpc_add(): q:1
>> Oct 31 13:22:52 sip2 /usr/sbin/kamailio[1326]: DEBUG: 
>> [sruid.c:183]: sruid_next(): new sruid is [ulcx-5bd9ddde-525-a] (10 / 19)
>> Oct 31 13:22:52 sip2 /usr/sbin/kamailio[1326]: ERROR:  [db.c:452]:
>> db_use_table(): invalid parameter value
>> Oct 31 13:22:52 sip2 /usr/sbin/kamailio[1326]: ERROR: usrloc
>> [udomain.c:631]: db_load_urecord(): failed to use table location
>> Oct 31 13:22:52 sip2 /usr/sbin/kamailio[1326]: ERROR:  [db.c:452]:
>> db_use_table(): invalid parameter value
>> Oct 31 13:22:52 sip2 /usr/sbin/kamailio[1326]: ERROR: usrloc
>> [ucontact.c:678]: db_insert_ucontact(): sql use_table failed
>> Oct 31 13:22:52 sip2 /usr/sbin/kamailio[1326]: ERROR: usrloc
>> [urecord.c:582]: insert_ucontact(): failed to insert in database
>> Oct 31 13:22:52 sip2 /usr/sbin/kamailio[1326]: DEBUG: jsonrpcs
>> [jsonrpcs_mod.c:395]: jsonrpc_send(): sending response with body: (nil) -
>> 500 Can't insert contact
>> Oct 31 13:22:52 sip2 /usr/sbin/kamailio[1326]: DEBUG: jsonrpcs
>> [jsonrpcs_fifo.c:461]: jsonrpc_fifo_server(): command executed - result:
>> [kamailio_receiver_2583] [500] [0x143dd50]
>> [{#012#011"jsonrpc":#011"2.0",#012#011"error":#0
>>
>>
>>
>> Regards,
>>
>> David Villasmil
>> email: david.villasmil.w...@gmail.com
>> phone: +34669448337
>>
>> ᐧ
>>
>> On Wed, Oct 31, 2018 at 6:14 PM Joel Serrano  wrote:
>>
>>> Hi David,
>>>
>>> Sorry for the delay.. You are missing parameters:
>>>
>>> root@sbc02:~# kamctl rpc ul.add location 361119...@m.domain.com
>>> sip:361119997@4.3.2.1 3600 1 sip:4.3.2.1:5060
>>> {
>>>   "jsonrpc":  "2.0",
>>>   "error":  {
>>> "code": 500,
>>> "message":  "Not enough parameters or wrong format"
>>>   },
>>>   "id": 31201
>>> }
>>> root@sbc02:~#
>>>
>>> root@sbc02:~# kamctl rpc ul.add location 361119...@m.domain.com
>>> sip:361119997@4.3.2.1 3600 1 sip:4.3.2.1:5060 0 0 13279 . .
>>> {
>>>   "jsonrpc":  "2.0",
>>>   "result": {
>>>   },
>>>   "id": 31249
>>> }
>>> root@sbc02:~#
>>>
>>> root@sbc02:~# kamctl rpc ul.dump
>>> {
>>>   "jsonrpc":  "2.0",
>>>   "result": {
>>> "Domains":  [{
>>> "Domain": {
>>>   "Domain": "location",
>>>   "Size": 1024,
>>>   "AoRs": [{
>>>   "Info": {
>>> "AoR":  "361119997",
>>> "HashID": 1820329880,
>>> "Contacts": [{
>>> "Contact":  {
>>>   "Address":  "sip:361119997@4.3.2.1",
>>>   "Expires":  3592,
>>>   "Q":  1,
>>>   "Call-ID":  "dfjrewr12386fd6-...@kamailio.rpc",
>>>   "CSeq": 1,
>>>   "User-Agent": "kamailio SIP Router - RPC Server",
>>>   "Received": "[not set]",
>>>   "Path": "sip:4.3.2.1:5060",
>>>   "State":  "CS_SYNC",
>>>   "Flags":  0,
>>>   "CFlags": 0,
>>>   "Socket": "[not set]",
>>>   "Methods":  13279,
>>>   "Ruid": "ulcx-5bd875a3-712-1",
>>>   "Instance": "[not set]",
>>>   "Reg-Id": 0,
>>>   "Server-Id":  0,
>>>   "Tcpconn-Id": 0,
>>>   "Keepalive":  0,
>>>   "Last-Keepalive": 0,
>>>   "Last-Modified":  0
>>> }
>>>   }]
>>>   }
>>> }
>>>   ],
>>>   "Stats":  {
>>> "Records":  1,
>>> "Max-Slots":  1
>>>   }
>>> }
>>>   }]
>>>   },
>>>   "id": 31347
>>> }
>>> root@sbc02:~#
>>>
>>>
>>> More info:
>>> https://kamailio.org/docs/modules/5.1.x/modules/usrloc.html#usrloc.r.add
>>>
>>>
>>>

[SR-Users] Determine destination address family

2018-10-31 Thread Isaac

Hello,

How can I determine the address family (IPv6 or IPv4) of a destination? 
The destination in this case is a hostname. I'd like to set a flag if 
the destination is IPv6 but not sure how to go about it.


Thanks,

Isaac

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Determine destination address family

2018-10-31 Thread Isaac

That's exactly what I need.

Thanks!

On 10/31/2018 10:15 AM, Alex Balashov wrote:

On Wed, Oct 31, 2018 at 10:16:40AM -0700, Isaac wrote:


How can I determine the address family (IPv6 or IPv4) of a destination? The
destination in this case is a hostname. I'd like to set a flag if the
destination is IPv6 but not sure how to go about it.


Hi,

You can look up the underlying IP address with dns_query() from the
ipops module:

https://kamailio.org/docs/modules/5.1.x/modules/ipops.html#ipops.f.dns_query

Which also provides these testing functions:

https://kamailio.org/docs/modules/5.1.x/modules/ipops.html#ipops.f.is_ipv4
https://kamailio.org/docs/modules/5.1.x/modules/ipops.html#ipops.f.is_ipv6

-- Alex



___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Can't add permanent location

2018-10-31 Thread Joel Serrano
Hi David,

Sorry for the delay.. You are missing parameters:

root@sbc02:~# kamctl rpc ul.add location 361119...@m.domain.com
sip:361119997@4.3.2.1 3600 1 sip:4.3.2.1:5060
{
  "jsonrpc":  "2.0",
  "error":  {
"code": 500,
"message":  "Not enough parameters or wrong format"
  },
  "id": 31201
}
root@sbc02:~#

root@sbc02:~# kamctl rpc ul.add location 361119...@m.domain.com
sip:361119997@4.3.2.1 3600 1 sip:4.3.2.1:5060 0 0 13279 . .
{
  "jsonrpc":  "2.0",
  "result": {
  },
  "id": 31249
}
root@sbc02:~#

root@sbc02:~# kamctl rpc ul.dump
{
  "jsonrpc":  "2.0",
  "result": {
"Domains":  [{
"Domain": {
  "Domain": "location",
  "Size": 1024,
  "AoRs": [{
  "Info": {
"AoR":  "361119997",
"HashID": 1820329880,
"Contacts": [{
"Contact":  {
  "Address":  "sip:361119997@4.3.2.1",
  "Expires":  3592,
  "Q":  1,
  "Call-ID":  "dfjrewr12386fd6-...@kamailio.rpc",
  "CSeq": 1,
  "User-Agent": "kamailio SIP Router - RPC Server",
  "Received": "[not set]",
  "Path": "sip:4.3.2.1:5060",
  "State":  "CS_SYNC",
  "Flags":  0,
  "CFlags": 0,
  "Socket": "[not set]",
  "Methods":  13279,
  "Ruid": "ulcx-5bd875a3-712-1",
  "Instance": "[not set]",
  "Reg-Id": 0,
  "Server-Id":  0,
  "Tcpconn-Id": 0,
  "Keepalive":  0,
  "Last-Keepalive": 0,
  "Last-Modified":  0
}
  }]
  }
}
  ],
  "Stats":  {
"Records":  1,
"Max-Slots":  1
  }
}
  }]
  },
  "id": 31347
}
root@sbc02:~#


More info:
https://kamailio.org/docs/modules/5.1.x/modules/usrloc.html#usrloc.r.add






On Wed, Oct 31, 2018 at 10:05 AM David Villasmil <
david.villasmil.w...@gmail.com> wrote:

> Ok, I checked my config and i had
>
> save("location","0x01")
>
> which disables saving the location in db, now when i register i see the
> location in the table...
> But i still can't add a location:
>
> Some help would be appreciated!
>
> David
>
>
> Regards,
>
> David Villasmil
> email: david.villasmil.w...@gmail.com
> phone: +34669448337
>
> ᐧ
>
> On Wed, Oct 31, 2018 at 3:22 PM David Villasmil <
> david.villasmil.w...@gmail.com> wrote:
>
>> Hello all,
>>
>> I'm trying to add a permanent location.
>>
>> i’m using db_mode 1, use_domain = 1, i tried that command
>>
>> kamctl rpc ul.add location 361119...@m.domain.com sip:361119997@4.3.2.1
>> 3600 0 sip:4.3.2.1:5060
>>
>>
>> Response is:
>>
>> {
>> "jsonrpc": "2.0",
>> "error": {
>> "code": -32000,
>> "message": "Execution Error"
>> },
>> "id": 25950
>> }
>>
>>
>> Anyone knows what this might be?
>>
>> David
>>
> ___
> Kamailio (SER) - Users Mailing List
> sr-users@lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Crash ims_diameter_server

2018-10-31 Thread Mojtaba
Hi.
There are some reason for this issue.
The three nested json is not reason for crash ims_diameter.
Let try this senario.
Chenge type of the last indoor level of json from List to other type(like
int or ...).
Then check the lamailio is crashed or not?
With Regards.Mojtaba


On Wed, 31 Oct 2018 21:56 Iman Mohammadi, 
wrote:

> When the below format is sent from rest , kamailio crashes
>
> List[{
> List[{
> List[{
>  ]}
>  ]}
>  ]}
> (Json with 3 nested lists),
> With 2 lists it works properly,
> When diameter is translated to json with 3 lists by this module it also
> works properly,
> Json format is correct too.
>
> gdb:
>
> gdb) bt full
> #0  0x7f5e23c4a11e in diameterserver_add_avp (m=0x0, d=0x7f5e1b5c2240 "", 
> len=12, avp_code=431, flags=64, vendorid=0, data_do=2,
> func=0x7f5e23c51d6c <__FUNCTION__.20148> "parselist") at avp_helper.c:208
> avp = 0x7f5e1b5c3bd0
> __FUNCTION__ = "diameterserver_add_avp"
> #1  0x7f5e23c4d0c8 in parselist (response=0x0, list=0x7fff9f21a8d0, 
> item=0x11b67d0, level=2) at avp_helper.c:309
> i = 1
> flags = 64
> x = "p\250!\237"
> avp_list = {head = 0x0, tail = 0x0}
> avp_list_s = {s = 0x7f5e1b5c2240 "", len = 12}
> __FUNCTION__ = "parselist"
> #2  0x7f5e23c4cffc in parselist (response=0x7f5e1b5c3ab8, list=0x0, 
> item=0x11b6550, level=1) at avp_helper.c:304
> subitem = 0x11b67d0
> i = 0
> flags = 64
> x = "\000\000\000"
> avp_list = {head = 0x0, tail = 0x0}
> avp_list_s = {s = 0x7fff9f21a8f0 "@\251!\237\377\177", len = 
> 600070897}
> __FUNCTION__ = "parselist"
> #3  0x7f5e23c4db3a in addAVPsfromJSON (response=0x7f5e1b5c3ab8, 
> json=0x7f5e23e53950 ) at avp_helper.c:349
> subitem = 0x11b6550
> i = 4
> __FUNCTION__ = "addAVPsfromJSON"
> root = 0x11b4210
> #4  0x7f5e23c3fbdb in callback_cdp_request (request_in=0x7f5e1b5c19b0, 
> param=0x0) at ims_diameter_server.c:193
> fmsg = 0xab7840 <_faked_msg>
> backup_rt = 1
> ctx = {rec_lev = 0, run_flags = 0, last_retcode = 1, jmp_env = 
> {{__jmpbuf = {1, -5713032302318786866, 7971288, 7971288,
> 140042162528420, 0, -5713032302339758386, 
> 5712822384154044110}, __mask_was_saved = 0, __saved_mask = {__val = {
>   140735863172072, 127, 0, 140042162532340, 140042389578761, 
> 4222451713, 140042162532340, 140042162532340, 140042162532340,
>   140042162532340, 140042162532358, 140042162532467, 
> 140042162532340, 140042162532467, 0, 0}
> response = 0x7f5e1b5c3ab8
> __FUNCTION__ = "callback_cdp_request"
> #5  0x7f5e24a705c0 in api_callback (p=0x7f5e1b598f50, msg=0x7f5e1b5c19b0, 
> ptr=0x0) at api_process.c:83
> t = 0x7f5e1b598f50
> auto_drop = 32767
> h = 0x7f5e1b5b3358
> ---Type  to continue, or q  to quit---
> x = {type = (unknown: 2669784000), handler = {requestHandler = 
> 0x7f5e23c3eed1 ,
> responseHandler = 0x7f5e23c3eed1 }, param = 
> 0x3ee9f21ac10, next = 0x7f5e1b5988b8, prev = 0x19f210069}
> type = REQUEST_HANDLER
> rsp = 0x7f5e1b5c19b0
> __FUNCTION__ = "api_callback"
> #6  0x7f5e24a857d7 in worker_process (id=5) at worker.c:346
> t = {p = 0x7f5e1b598f50, msg = 0x7f5e1b5c19b0}
> cb = 0x7f5e1b59df30
> r = 128
> __FUNCTION__ = "worker_process"
> #7  0x7f5e24a62a8e in diameter_peer_start (blocking=0) at 
> diameter_peer.c:242
> pid = 0
> k = 5
> p = 0x36
> __FUNCTION__ = "diameter_peer_start"
> #8  0x7f5e24a559bc in cdp_child_init (rank=0) at cdp_mod.c:243
> __FUNCTION__ = "cdp_child_init"
> #9  0x00547e54 in init_mod_child (m=0x7f5e28656fb8, rank=0) at 
> core/sr_module.c:943
> __FUNCTION__ = "init_mod_child"
> #10 0x00547b16 in init_mod_child (m=0x7f5e28657c38, rank=0) at 
> core/sr_module.c:939
> __FUNCTION__ = "init_mod_child"
> #11 0x00547b16 in init_mod_child (m=0x7f5e28658010, rank=0) at 
> core/sr_module.c:939
> __FUNCTION__ = "init_mod_child"
> #12 0x00547b16 in init_mod_child (m=0x7f5e28658790, rank=0) at 
> core/sr_module.c:939
> __FUNCTION__ = "init_mod_child"
> #13 0x00547b16 in init_mod_child (m=0x7f5e28658d68, rank=0) at 
> core/sr_module.c:939
> __FUNCTION__ = "init_mod_child"
> #14 0x005481e6 in init_child (rank=0) at core/sr_module.c:970
> No locals.
> #15 0x004250f5 in main_loop () at main.c:1701
> i = 8
> pid = 1964
> si = 0x0
> si_desc = "udp receiver child=7 
> sock=10.25.5.23:5060\000y\000\000\000\000\000x\333i(^\177\000\000@\264!\237\377\177",
>  '\000' , 
> "`\263!\237\377\177\000\000\347L\340(^\177\000\000\360\260!\237\377\177\000\000\060\000\000\000\060\000\000\000\260\261!\237\377\177\000\000\350\226i(^\177\000"
> 

Re: [SR-Users] Crash ims_diameter_server

2018-10-31 Thread Iman Mohammadi
Hi
I tried it before,it must be list for our purpose,int or string doesnt meet
our purpose

thanks

On Thu, Nov 1, 2018 at 9:00 AM Mojtaba  wrote:

> Hi.
> There are some reason for this issue.
> The three nested json is not reason for crash ims_diameter.
> Let try this senario.
> Chenge type of the last indoor level of json from List to other type(like
> int or ...).
> Then check the lamailio is crashed or not?
> With Regards.Mojtaba
>
>
> On Wed, 31 Oct 2018 21:56 Iman Mohammadi, <
> iman.mohammadi.tele...@gmail.com> wrote:
>
>> When the below format is sent from rest , kamailio crashes
>>
>> List[{
>> List[{
>> List[{
>>  ]}
>>  ]}
>>  ]}
>> (Json with 3 nested lists),
>> With 2 lists it works properly,
>> When diameter is translated to json with 3 lists by this module it also
>> works properly,
>> Json format is correct too.
>>
>> gdb:
>>
>> gdb) bt full
>> #0  0x7f5e23c4a11e in diameterserver_add_avp (m=0x0, d=0x7f5e1b5c2240 
>> "", len=12, avp_code=431, flags=64, vendorid=0, data_do=2,
>> func=0x7f5e23c51d6c <__FUNCTION__.20148> "parselist") at avp_helper.c:208
>> avp = 0x7f5e1b5c3bd0
>> __FUNCTION__ = "diameterserver_add_avp"
>> #1  0x7f5e23c4d0c8 in parselist (response=0x0, list=0x7fff9f21a8d0, 
>> item=0x11b67d0, level=2) at avp_helper.c:309
>> i = 1
>> flags = 64
>> x = "p\250!\237"
>> avp_list = {head = 0x0, tail = 0x0}
>> avp_list_s = {s = 0x7f5e1b5c2240 "", len = 12}
>> __FUNCTION__ = "parselist"
>> #2  0x7f5e23c4cffc in parselist (response=0x7f5e1b5c3ab8, list=0x0, 
>> item=0x11b6550, level=1) at avp_helper.c:304
>> subitem = 0x11b67d0
>> i = 0
>> flags = 64
>> x = "\000\000\000"
>> avp_list = {head = 0x0, tail = 0x0}
>> avp_list_s = {s = 0x7fff9f21a8f0 "@\251!\237\377\177", len = 
>> 600070897}
>> __FUNCTION__ = "parselist"
>> #3  0x7f5e23c4db3a in addAVPsfromJSON (response=0x7f5e1b5c3ab8, 
>> json=0x7f5e23e53950 ) at avp_helper.c:349
>> subitem = 0x11b6550
>> i = 4
>> __FUNCTION__ = "addAVPsfromJSON"
>> root = 0x11b4210
>> #4  0x7f5e23c3fbdb in callback_cdp_request (request_in=0x7f5e1b5c19b0, 
>> param=0x0) at ims_diameter_server.c:193
>> fmsg = 0xab7840 <_faked_msg>
>> backup_rt = 1
>> ctx = {rec_lev = 0, run_flags = 0, last_retcode = 1, jmp_env = 
>> {{__jmpbuf = {1, -5713032302318786866, 7971288, 7971288,
>> 140042162528420, 0, -5713032302339758386, 
>> 5712822384154044110}, __mask_was_saved = 0, __saved_mask = {__val = {
>>   140735863172072, 127, 0, 140042162532340, 140042389578761, 
>> 4222451713, 140042162532340, 140042162532340, 140042162532340,
>>   140042162532340, 140042162532358, 140042162532467, 
>> 140042162532340, 140042162532467, 0, 0}
>> response = 0x7f5e1b5c3ab8
>> __FUNCTION__ = "callback_cdp_request"
>> #5  0x7f5e24a705c0 in api_callback (p=0x7f5e1b598f50, 
>> msg=0x7f5e1b5c19b0, ptr=0x0) at api_process.c:83
>> t = 0x7f5e1b598f50
>> auto_drop = 32767
>> h = 0x7f5e1b5b3358
>> ---Type  to continue, or q  to quit---
>> x = {type = (unknown: 2669784000), handler = {requestHandler = 
>> 0x7f5e23c3eed1 ,
>> responseHandler = 0x7f5e23c3eed1 }, param 
>> = 0x3ee9f21ac10, next = 0x7f5e1b5988b8, prev = 0x19f210069}
>> type = REQUEST_HANDLER
>> rsp = 0x7f5e1b5c19b0
>> __FUNCTION__ = "api_callback"
>> #6  0x7f5e24a857d7 in worker_process (id=5) at worker.c:346
>> t = {p = 0x7f5e1b598f50, msg = 0x7f5e1b5c19b0}
>> cb = 0x7f5e1b59df30
>> r = 128
>> __FUNCTION__ = "worker_process"
>> #7  0x7f5e24a62a8e in diameter_peer_start (blocking=0) at 
>> diameter_peer.c:242
>> pid = 0
>> k = 5
>> p = 0x36
>> __FUNCTION__ = "diameter_peer_start"
>> #8  0x7f5e24a559bc in cdp_child_init (rank=0) at cdp_mod.c:243
>> __FUNCTION__ = "cdp_child_init"
>> #9  0x00547e54 in init_mod_child (m=0x7f5e28656fb8, rank=0) at 
>> core/sr_module.c:943
>> __FUNCTION__ = "init_mod_child"
>> #10 0x00547b16 in init_mod_child (m=0x7f5e28657c38, rank=0) at 
>> core/sr_module.c:939
>> __FUNCTION__ = "init_mod_child"
>> #11 0x00547b16 in init_mod_child (m=0x7f5e28658010, rank=0) at 
>> core/sr_module.c:939
>> __FUNCTION__ = "init_mod_child"
>> #12 0x00547b16 in init_mod_child (m=0x7f5e28658790, rank=0) at 
>> core/sr_module.c:939
>> __FUNCTION__ = "init_mod_child"
>> #13 0x00547b16 in init_mod_child (m=0x7f5e28658d68, rank=0) at 
>> core/sr_module.c:939
>> __FUNCTION__ = "init_mod_child"
>> #14 0x005481e6 in init_child (rank=0) at core/sr_module.c:970
>> No locals.
>> #15 0x004250f5 in main_loop () at main.c:1701
>> i = 8
>> pid = 1964
>> si = 0x0
>>

Re: [SR-Users] help with regex extracting from $rb

2018-10-31 Thread Henning Westerholt
Am Mittwoch, 31. Oktober 2018, 02:05:09 CET schrieb Sergiu Pojoga:
> May be for a start someone can clarify the general rules of engagement in
> this battle with regex transformations.
> https://www.kamailio.org/wiki/cookbooks/5.1.x/transformations#resubst_expres
> sion
> 
> What kind of regex library does this function expect: PCRE, Perl, Java,
> POSIX BRE/ERE?
> I've used all kinds of regex validators, regex101.com, rexv.org. Some
> expressions pass those but do not work in Kamailio. The result is a dump of
> the entire $rb.
> 
> Much obliged.

Hello Sergiu,

from your quoted wiki page:

"Perform POSIX regex substitutions on string value pseudo-variables."

The textops module uses this implementation basically:

http://man7.org/linux/man-pages/man3/regexec.3.html

Best regards,

Henning

-- 
Henning Westerholt - https://skalatan.de/blog/
Kamailio security assessment - https://skalatan.de/de/assessment

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users