Hey Daniel,
Ok I worked it out. In the async callback before I call tmb.t_continue you need to restore the transaction avp lists before trying to add an AVP to be used in the "continue route" of the cfg file. do for example:
set_avp_list(AVP_TRACK_FROM | AVP_CLASS_URI, &t->uri_avps_from );
set_avp_list(AVP_TRACK_TO | AVP_CLASS_URI, &t->uri_avps_to );
set_avp_list(AVP_TRACK_FROM | AVP_CLASS_USER, &t->user_avps_from );
set_avp_list(AVP_TRACK_TO | AVP_CLASS_USER, &t->user_avps_to );
set_avp_list(AVP_TRACK_FROM | AVP_CLASS_DOMAIN, &t->domain_avps_from );
set_avp_list(AVP_TRACK_TO | AVP_CLASS_DOMAIN, &t->domain_avps_to );
...
code to add my AVP to be made available to cfg file
...
tmb.t_continue(data->tindex, data->tlabel, data->act);
Hopefully this make more sense?
Cheers
Jason
On Tue, Oct 2, 2012 at 2:45 PM, Daniel-Constantin Mierla <miconda@gmail.com> wrote:
Hello,
not clear now what you try to do, but have in mind that avps are attached to a sip message or transaction. You cannot access it if it is set in other process for a transaction you don't have access to it anymore. Use some other sort of shared memory structure.
Cheers,
Daniel
On 10/2/12 2:12 PM, Jason Penton wrote:
Hey Daniel,
plse see inline:
On Tue, Oct 2, 2012 at 2:02 PM, Daniel-Constantin Mierla <miconda@gmail.com> wrote:
Hello,indeed, this is the right way -- forgot to answer this email...
On 10/2/12 1:58 PM, Jason Penton wrote:
Okay I solved this by using the uas->request structure ;)
np, thanks!
IIRC, at that moment you have to add it to the list that is stored in transaction. Maybe you can use a $var() and then move it in avp list inside the continued route block.
One more question re. async "pattern" Daniel:
In the "continued" code, prior to executing the config file actions, can you add an avp (ie from within the code prior to calling t_continue, can we add an avp and have it available to the config file in the "continued" route block)?
Im not sure I understand you here? Just to make sure I am clear. I am effectively trying to do this:
longrunningfunction(); #this is where the async will happen, so the next line will be run by another process
if ($avp(s:return_val_from_longrunningfunction) > 0) {
blah;
}
So, I am asking how I can set the $avp(s:return_val_from_longrunningfunction). I can tell you from practice that it doesnt work using the default add_avp from within my async callback process. I have not researched yet how the avps are stored, architected, etc. But I am imagineing that right now the process I am in has no "access" to avp "storage". Either that or the avp "storage" is overwritten with the t_continue code? Would be great if you could shed some light?
Cheers,
Daniel
cheers
Jason
On Mon, Oct 1, 2012 at 3:46 PM, Jason Penton <jason.penton@gmail.com> wrote:
Hi (Daniel this may be for you re. async)
Is it possible to get the sip message from a transaction after using t_continue. The reason I ask is that using the async "pattern", how would one be able to use transactional replies in code using t_reply(code, message). Is the only way to store the sip_msg in shm for later use, because if I look at TM I see there is no storage for the original SIP request?
Cheers
Jason
_______________________________________________ sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
-- Daniel-Constantin Mierla - http://www.asipto.com http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda Kamailio Advanced Training, Berlin, Nov 5-8, 2012 - http://asipto.com/u/kat Kamailio Advanced Training, Miami, USA, Nov 12-14, 2012 - http://asipto.com/u/katu
-- Daniel-Constantin Mierla - http://www.asipto.com http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda Kamailio Advanced Training, Berlin, Nov 5-8, 2012 - http://asipto.com/u/kat Kamailio Advanced Training, Miami, USA, Nov 12-14, 2012 - http://asipto.com/u/katu