Hi
I am working on replacing the functionality of the load_gws LCR function call in our application.
I have found you can overwrite the contents of the gw_uri_avp (default: $avp(i:709)) substitute this function call. However I am a bit unclear about what goes in this avp. I was wondering if any one knew of a place I could find this information.
The contents of the avp is an list whose entries look something like this :"2|1|0|||258722358||5060||1|1". The values separated by the | are likely values from the database, and some of them are obvious (like the port and the prefix), but others are not. In particular the longer number baffles me, it's not the ip of the gateway from the lcr_gw table, unless it is but has been altered in some way.
Any advice any one has for me would be greatly appreciated.
All the best
Will Ferrer
Switchsoft LLC
Will Ferrer writes:
I have found you can overwrite the contents of the gw_uri_avp (default: $avp(i:709)) substitute this function call. However I am a bit unclear about what goes in this avp. I was wondering if any one knew of a place I could find this information.
gw_uri_avp is internal avp and is not intended for manipulation.
The contents of the avp is an list whose entries look something like this :"2|1|0|||258722358||5060||1|1". The values separated by the | are likely values from the database, and some of them are obvious (like the port and the prefix), but others are not. In particular the longer number baffles me, it's not the ip of the gateway from the lcr_gw table, unless it is but has been altered in some way.
if you want to play with it, you need to check from source code what the various fields mean. the relevant functions are encode_avp_value and decode_avp_value. there are comments about the fields.
be aware that contents gw_uri_avp may change from version to version without warning.
-- juha
Hi Juha
Thank you very much for pointing me in the right direction. I am looking the c code now and I will update the list if I figure it out sufficiently.
All the best.
Will Ferrer
On Sat, Apr 26, 2014 at 10:51 PM, Juha Heinanen jh@tutpro.com wrote:
Will Ferrer writes:
I have found you can overwrite the contents of the gw_uri_avp (default: $avp(i:709)) substitute this function call. However I am a bit unclear about what goes in this avp. I was wondering if any one knew of a place I could find this information.
gw_uri_avp is internal avp and is not intended for manipulation.
The contents of the avp is an list whose entries look something like this :"2|1|0|||258722358||5060||1|1". The values separated by the | are likely values from the database, and some of them are obvious (like the port and the prefix), but others are not. In particular the longer number baffles me, it's not the ip of the gateway from the lcr_gw table, unless it is
but
has been altered in some way.
if you want to play with it, you need to check from source code what the various fields mean. the relevant functions are encode_avp_value and decode_avp_value. there are comments about the fields.
be aware that contents gw_uri_avp may change from version to version without warning.
-- juha
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
Hi Juha
I just wanted to update every body on what I found looking at the c code. The values in between the pipes are as follows:
gw_index | scheme | strip | prefix | tag | ip_addr | hostname | port | params | transport | flags
Most of these things are clearly retrievable from the DB (just look at the lcr_gw table and you will see the values there) but I found 2 things worthy of note:
1) gw_index: this seems that it can be any number that is unique inside the avp, when I tried reconstructing this avp I used just 1 and 2 for my test entries and this worked. 2) ip_addr: There is some interesting munging that happens with in the c code to encode this value, however I found that when I over wrote the values of the avp manually I didn't need to do the munging -- just putting an ip address in this space worked fine.
From my basic testing here it looks like overwriting the contents of this
avp to substitute in ones own lcr destinations should be pretty straight forward.
All the best.
Will Ferrer
On Mon, Apr 28, 2014 at 6:22 PM, Will Ferrer will.ferrer@switchsoft.comwrote:
Hi Juha
Thank you very much for pointing me in the right direction. I am looking the c code now and I will update the list if I figure it out sufficiently.
All the best.
Will Ferrer
On Sat, Apr 26, 2014 at 10:51 PM, Juha Heinanen jh@tutpro.com wrote:
Will Ferrer writes:
I have found you can overwrite the contents of the gw_uri_avp (default: $avp(i:709)) substitute this function call. However I am a bit unclear about what goes in this avp. I was wondering if any one knew of a place
I
could find this information.
gw_uri_avp is internal avp and is not intended for manipulation.
The contents of the avp is an list whose entries look something like
this
:"2|1|0|||258722358||5060||1|1". The values separated by the | are
likely
values from the database, and some of them are obvious (like the port
and
the prefix), but others are not. In particular the longer number baffles me, it's not the ip of the gateway from the lcr_gw table, unless it is
but
has been altered in some way.
if you want to play with it, you need to check from source code what the various fields mean. the relevant functions are encode_avp_value and decode_avp_value. there are comments about the fields.
be aware that contents gw_uri_avp may change from version to version without warning.
-- juha
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
Will Ferrer writes:
gw_index | scheme | strip | prefix | tag | ip_addr | hostname | port | params | transport | flags
Most of these things are clearly retrievable from the DB (just look at the lcr_gw table and you will see the values there) but I found 2 things worthy of note:
- gw_index: this seems that it can be any number that is unique inside the
avp, when I tried reconstructing this avp I used just 1 and 2 for my test entries and this worked.
gw_index is index of the gateway in internal table that contains matched gws after load_gw() call.
- ip_addr: There is some interesting munging that happens with in the c
code to encode this value, however I found that when I over wrote the values of the avp manually I didn't need to do the munging -- just putting an ip address in this space worked fine.
ip_addr string is produced for ipv4 like this:
string = int2str(ip_addr->u.addr32[0], &len);
-- juha
Hi Juha
Thanks much for the assistance. I have refactored our LCR to work based on my own mysql query, where I am setting the gw_index as the id of the gateway, and the ip address I am putting in as a raw ip.
It is all working as far as I can tell but more testing will be in order for us. If I find any issues or gotcha I will post here just to let every one know.
I hope this message finds you well.
All the best.
Will Ferrer
On Tue, Apr 29, 2014 at 9:06 AM, Juha Heinanen jh@tutpro.com wrote:
Will Ferrer writes:
gw_index | scheme | strip | prefix | tag | ip_addr | hostname | port | params | transport | flags
Most of these things are clearly retrievable from the DB (just look at
the
lcr_gw table and you will see the values there) but I found 2 things
worthy
of note:
- gw_index: this seems that it can be any number that is unique inside
the
avp, when I tried reconstructing this avp I used just 1 and 2 for my test entries and this worked.
gw_index is index of the gateway in internal table that contains matched gws after load_gw() call.
- ip_addr: There is some interesting munging that happens with in the c
code to encode this value, however I found that when I over wrote the values of the avp manually I didn't need to do the munging -- just
putting
an ip address in this space worked fine.
ip_addr string is produced for ipv4 like this:
string = int2str(ip_addr->u.addr32[0], &len);
-- juha
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