Hello;

    it is working but some braces are missing.

Thanks for support. Have a nice day.

[root@TestDispatcher ~]# kamcmd cr.reload_routes
[root@TestDispatcher ~]# kamcmd cr.dump_routes
{
        routes: {
                {
                        carrier: default
                        id: 1
                        domains: {
                                {
                                        domain: 185.88.7.201
                                        id: 1
                                        data: {
                                                         3: 100.000 %, '192.168.4.180:5060': ON, '0', '2', '1', '338'
                                        }
                                        data: {
                                        }
                                }
                                domains: {
                                }
                        }
                        routes: {
                        }

[root@TestDispatcher ~]# kamctl rpc cr.dump_routes
{"jsonrpc":"2.0","result":{"routes":[{"carrier":"default","id":1,"domains":[{"domain":"myip","id":1,"data":["         3: 100.000 %, '192.168.4.180:5060': ON, '0', '2', '1', '338'"]}]}]},"id":19726}
[root@TestDispatcher ~]# kamcmd cr.dump_routes
{
        routes: {
                {
                        carrier: default
                        id: 1
                        domains: {
                                {
                                        domain: 185.88.7.201
                                        id: 1
                                        data: {
                                                         3: 100.000 %, '192.168.4.180:5060': ON, '0', '2', '1', '338'
                                        }
                                        data: {
                                        }
                                }
                                domains: {
                                }
                        }
                        routes: {
                        }


6.01.2017 10:56 tarihinde Daniel-Constantin Mierla yazdı:

Hello,

I think I found the issue -- an improper pointer was passed to rpc struct_add. Fetch again master and try to see if this time all goes ok.

Cheers,
Daniel


On 05/01/2017 09:47, Yasin CANER wrote:

Hello;

    it gives error as below.

Cheers.

[root@Test  master]# 10(29238) ERROR: ctl [binrpc_run.c:1112]: rpc_struct_add(): failed to add attribute-value (S)
10(29238) ERROR: carrierroute [cr_fifo.c:1192]: cr_rpc_dump_routes(): add carrier structure failure at count 0


5.01.2017 11:17 tarihinde Daniel-Constantin Mierla yazdı:

Hello,

thanks, got some leads with the new log messages, so I pushed another commit to see which of the fields there is causing the problem. Can you fetch again master and give it another try?

Cheers,
Daniel


On 05/01/2017 09:09, Yasin CANER wrote:

Hello;

Results are here. Once i tried carrierroute config with kamailio V4.1.9 and it works. here version is kamailio 5.0.0-dev10 . it is started with "kamailio -dd -E"


[root@Test  master]# kamcmd cr.reload_routes
[root@Test  master]# kamcmd cr.dump_routes
error: 500 - Internal error - carrier structure
[root@Test  master]#
[root@Test  master]#
[root@Test  master]# kamctl rpc cr.dump_routes
{"jsonrpc":"2.0","result":{"routes":[{"carrier":,"id":1,"domains":[{"domain":,"id":1,"data":["      NULL: 100.000 %, 'ip:5060': ON, '0', '', '', '338'"]}]}]},"id":9684}


here is log


[root@TestDispatcher master]# 10(9666) INFO: carrierroute [cr_db.c:315]: load_route_data_db(): carrier 'default' (id 1) has 1 domains
10(9666) INFO: carrierroute [cr_data.c:456]: add_route(): adding prefix , prob 1.000000
10(9666) INFO: carrierroute [cr_carrier.c:98]: add_domain_data(): adding domain 1 'mydomainip' to carrier 1 'default'10(9666) INFO: carrierroute [cr_data.c:412]: get_domain_data_or_add(): added domain 1 'mydomainip' to carrier 1 'default'10(9666) INFO: carrierroute [cr_data.c:468]: add_route(): found carrier and domain, now adding route
10(9666) INFO: carrierroute [cr_rule.c:118]: add_route_rule(): no backed up rules
10(9666) INFO: carrierroute [cr_data.c:653]: rule_fixup(): fixing tree mydomainip
10(9666) INFO: carrierroute [cr_data.c:613]: rule_fixup_recursor(): hashless rule with host ip:5060 hash, hash_index 1
10(9666) ERROR: ctl [binrpc_run.c:1112]: rpc_struct_add(): failed to add attribute-value
10(9666) ERROR: carrierroute [cr_fifo.c:1192]: cr_rpc_dump_routes(): add carrier structure failure at count 0


In addition , I tried to modify code like this  and it didnt work either. it gives same error.


                    if(rpc->struct_add(dh, "Sd[", "carrier", "at",
                                                "id", "123",
                                                "domains",  &eh)<0) {
                                LM_ERR("add carrier structure failure at count %d\n", i);
                                rpc->fault(ctx, 500, "Internal error - carrier structure");
                                goto error;
                        }


5.01.2017 00:39 tarihinde Daniel-Constantin Mierla yazdı:
kamctl rpc cr.dump_routes

--

-- 
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com

--

-- 
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com

--