Hello,

do not send emails to both sr-dev and sr-users mailing lists when you have questions about using Kamailio, sr-dev is only for discussing about code development for project or what is only in development branch (not part of a stable release). I removed sr-dev from recipients.

I think you haven't understood what prefix_route module does: it execute route blocks from configuration file, it does not set the destination address based on a prefix. For that look at pdt module for a simple solution. Other modules such as mtree or lcr could be alternatives, but from simplicity point of view, pdt is better fr this case imo.

Cheers,
Daniel


On 14.10.20 14:27, sai Sudheer wrote:
Hii,
I am trying to use pstn_route module for the first time, and i want to route the invite to specific pstn server based on its prefix.
I have loaded the module & setup the DB, and it's giving error saying route name (from DB) is not defined after adding the a prefix into DB table., and there were no errors when DB table is empty.
Not sure how to defined it, or i dont know what did i miss. Please help.

#### CONFIG ##########
loadmodule "prefix_route.so"
modparam("prefix_route", "db_url", "mysql://xxxxx:xxxxx@localhost/kamailioDB")
modparam("prefix_route", "db_table", "new_prefix_route")

#PSTN Routing table contains
         if (!prefix_route("+44")) {
              xlog("L_INFO", "+44 prefix didnt match with prefix_route DB\n");
         }

########## DB####
MariaDB [kamailio]> select * from new_prefix_route;
Empty set (0.00 sec)

MariaDB [kamailio]> exit;
##########


Kamailio looks good untill here, no errors.. 

# Now i have added a prefix into sql DB
INSERT INTO new_prefix_route VALUES ("+44", "10.10.1.1:5060", "route for this prefix");
###########
Error log after adding a prefix into new_prefix_route table & restart of kamailio

 0(5802) CRITICAL: prefix_route [prefix_route.c:72]: add_route(): route name '10.10.1.1:5060' is not defined
 0(5802) NOTICE: prefix_route [prefix_route.c:170]: pr_db_load(): Total prefix routes loaded: 1
 0(5802) ERROR: prefix_route [prefix_route.c:174]: pr_db_load(): error flushing tree
 0(5802) CRITICAL: prefix_route [prefix_route.c:212]: mod_init(): db load failed

I have tried a "name" instead of IP (though i dont know how to convert that "name" into a IP:Port), But i am still getting same error using "name" instead of IP:port @ route field in DB.


Please help.

_______________________________________________
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev


-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Funding: https://www.paypal.me/dcmierla