Hello,

On 9/8/11 6:30 PM, Carlos Ruiz Diaz wrote:
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?
If the avp list is null inside C code, then the avp was not added. Do you see any error message in syslog related to avp_copy()?

After avp copy, do a xlog(..) line printing the avp, if it is printed in syslog and you don't get it in C, then would be very strange...

Cheers,
Daniel


Any help will be appreciated.

Thanks in advance!

Carlos.


_______________________________________________
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
Kamailio Advanced Training, Oct 10-13, Berlin: http://asipto.com/u/kat
http://linkedin.com/in/miconda -- http://twitter.com/miconda