Hello.

I'm currently developing an OpenSER module which does some business logic for the company I work for. For compatibility reasons we are working with openser-1.2.2-tls and we haven't been able to upgrade to newer version yet.

In one block of the code I have to read an avp which is written inside the openser.cfg script using:

OPENSER:
avp_copy("sip:123@123.123.123:5060", "$avp(s:selectedroute)/g"); 

C CODE:
if (is_response && is_invite_seq)
{
struct usr_avp* destavp = NULL;
int_str destval;
const str selected_route = { "selectedroute", 13 };
int attempts = 1, max_attempts = 3;

for ( destavp = search_first_avp(AVP_NAME_STR | AVP_VAL_STR, (int_str) selected_route, NULL, 0); destavp != NULL; destavp = search_next_avp(destavp, NULL) ) { get_avp_val(destavp, &destval); }
}

The problem is that "selectedroute" avp cannot be found so I can't read its value. This happens sporadically and most of the time the code works just fine. 

I also checked for the list of available AVPs using get_avp_list() but it reports an empty list. 

Is there another way to read AVPs or is there something I'm missing which is causing this problem? 

Any help will be appreciated.

Thanks in advance!

Carlos.