That's what I'm looking for. Thank you very much. Here is my final script:
reg_fetch_contacts("location", "sip:gatewaynum...@mydomain.com", "pstn"); if($(ulc(pstn=>count))){ $ru = "sip:" + $rU + "@" + $(ulc(pstn=>addr){uri.host}) + ":" + $(ulc(pstn=>addr){uri.port}); } else { # fall back to old ddns style gateway address $ru = "sip:" + $rU + "@" + $sel(cfg_get.pstn.gw_ip); } route(RELAY); On Tue, Oct 19, 2010 at 3:41 PM, Daniel-Constantin Mierla <mico...@gmail.com> wrote: > Hello, > > the lookup("location") is the one that you look for. > > In this particular case, you have to make a backup of r-uri username, change > it with spa3102 username, do location lookup and then set back the r-uri > username with pstn number and relay. > > There is a function to fetch details of registered contacts for a user, see > readme of registrar module, but then you have to set manually the > destination address details. > > Cheers, > Daniel > > On 10/19/10 3:46 AM, Adieu wrote: >> >> Hello everybody, >> >> I just started to use kamailio. For the basic functions, I can get >> them working properly. >> >> But when I started to write my own script, I encountered some problem. >> >> The scenario is like this: >> >> I have a linksys spa3102 pstn-voip gateway at home which register >> itself at my server on the internet. I use adsl at home so the ip >> address change dynamically. When I want to route all my pstn calls to >> spa3102, I have to figure out the current ip address of my home >> connection. I tried to use dynamic dns, but my router does not update >> the ip address sometimes. So I was thinking about solving this problem >> in the kamailio configuration script. >> >> All I need is to get the registration information of spa3102 so that I >> can route my pstn call to it. >> >> I guess there might be a function doing this work. It expect a >> subscriber name as a variable and returns the registration information >> of the subscriber. I tried to dig the function out of kamailio >> documents but failed. And google doesn't seem to provide much help. I >> don't know if this function exist or not. Could someone confirm my >> guess or point out where I can find it? I will be much appreciated. >> >> //bow >> >> Adieu >> >> _______________________________________________ >> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list >> sr-users@lists.sip-router.org >> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users > > -- > Daniel-Constantin Mierla > http://www.asipto.com > > _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users