Hello guys,

I'm recently new player in Kamailio SIP server and want to use it as SIP proxy server to Asterisk PBX server.

first of all, I've successfully registered my Asterisk to Kamailio as user "test" to get its "location" because my Asterisk is behind NAT.

Simply now I want to relay SIP messages to this user's location to receive them all in Asterisk. After I searched, I found this function rewritehost() but it needs to be a host or IP address, but in my case I want some way or function to relay to user "test" and then it well get the user location from Kamailio datebase automatically?


I hope it's clear XD

I tried to find a way to do MSQL query in kamalio.cfg to get the user contact from "location" table and then relay to the result but it did not work. I guess that I did it in wrong way but finally the Kamailio tutorials are so rare on google.

Thanks in advance,
Omar