Hello,
the avps are not available when the callbacks used by topos are executed.
An option would be to store in a hash table using from-tag/call-id as a key (requiring to bind to htable, ...).
The alternative, if you will develop a solution that requires to mark only the initial request, could be to add a custom header in request_route, then match it in the topos callback when the request is sent out and remove the header.
Cheers, Daniel
March 23, 2017 2:50 PM, "Paul Claudiu Boriga" paul.boriga@1and1.ro wrote:
Hello all,
My name is Claudiu and I am a new developer in the 1&1 team, also new to SIP and Kamailio.
I am having some issues trying to change the way topoh module works, could you help me with some avp and topoh related issues?
The idea is to modify how the topoh module works by introducing a per message/transaction parameter to mark which messages/transactions should be hidden. I am using an avp parameter, which I define in the config like this: "modparam("topoh","hide_avp", "$avp(hide)")" and later use as this "$avp(hide)=1;". I intend to modify the th_msg_sent and th_msg_received, to read the value of the avp, using "search_first_avp" function, and only mask the headears if the avp is set. These functions are registered as callbacks for the SREV_NET_DATA_IN and SREV_NET_DATA_OUT events: sr_event_register_cb(SREV_NET_DATA_IN, th_msg_received); sr_event_register_cb(SREV_NET_DATA_OUT, th_msg_sent); I encountered the following issues:
- apparently the avp is never seen as being set in the th_msg_received
function, even though if I print in from the config with xlog, it appears to be set.
- for some messages (180 ringing, and 200 ok), the avp is not seen as
set in the th_msg_sent, but is seen on other requests (invite,bye) and replies (100 trying) messages. If I print it with xlog form config, on the onreply_route is appears set.
Is the function th_msg_received always called before avps are seen in the code? Any idea why for the 180 and 200 messages the avp is not seen in the code inside th_msg_sent function?
Thanks and regards, Claudiu Boriga
sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
-- Daniel-Constantin Mierla www.kamailio.org -- www.asipto.com