[SR-Users] Accessing received after lookup()
DanB
danb.lists at gmail.com
Fri Aug 17 11:41:45 CEST 2012
Hey Daniel,
Yeah, got the header out of received from path. Actually I have
de-coupled registrations which work and store just fine the received
parameter out of INVITEs which are querying the registrar using lookup.
In the end I have ended up using received parameter if present in $du
after lookup and appending it to contact (removing it after in the proxy
which sits in front of registrar). Here is the code snippet for anyone
needing it in the future:
"""
if (!lookup("location")) {
$var(rc) = $rc;
t_newtran();
switch ($var(rc)) {
case -1:
case -3:
send_reply("404", "Not Found");
exit;
case -2:
send_reply("405", "Method Not Allowed");
exit;
}
}
# Populate received contact parameter if found in db
$var(received) = $(du{uri.param,received});
if !strempty( $var(received) ) {
$ru = $ru + ";rcv="+ $var(received);
}
sl_send_reply("302", "Locator Redirect");
exit;
"""
Thanks,
DanB
On 08/17/2012 11:37 AM, Daniel-Constantin Mierla wrote:
> Hello,
>
> On 8/17/12 10:47 AM, DanB wrote:
>> Hey All,
>>
>> I was wondering if anyone could point me to the right direction on the
>> following issue:
>>
>> I use registrar with path to store contacts after main proxy. There I
>> have properly stored received db field (original address of the NAT
>> router).
>
> did you take the received parameter from the Path header? Otherwise
> received (ie. the received column value) is usually the source ip/port.
> The received parameter of Path is stored along with it in the
> appropriate column.
>
> Cheers,
> Daniel
>
>> When I query the registrar, I get the user contact details (natted
>> ones) in 302 redirect. However at this point I cannot access received
>> avp (or I did not find a way yet, except calling reg_fetch_contacts
>> which I would prefer not to since it doubles the work lookup does).
>>
>> Is there any catch which could save me in this scenario? After
>> loopkup() is there any pseudovariable which I can inspect to find out
>> user's contact data? Any other way to extract received contact data
>> out of contact info?
>>
>> Thanks in advance for any kind of tip!
>>
>> DanB
>>
>> _______________________________________________
>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>> sr-users at lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
More information about the sr-users
mailing list