Peter,
t_suspend() and t_continue() should work multiple times as long as they are executed sequentially after each other, i.e. there cannot be two branches suspended at the same time.
The error you get means to me that t_continue() executed the specified route block, but in that route, the request was neither replied nor a new branch was added. Hence, the transaction is hanging in memory and the module sees no pending branch that could return a reply later.
Make sure that in the route block executed by t_continue() there is either a t_reply() or you append a new branch and forward it with t_relay() (or append a new branch and call t_suspend() again). I think you also need to handle the failure of t_relay() and explicitly call t_reply() when t_relay() fails in this route.
Regards, Miklos
On 03/28/2012 02:21 PM, Daniel-Constantin Mierla wrote:
Hello,
I have been using it only once and didn't looked much deeper into the code.
Maybe Miklos (cc-ed) can give faster more details, afaik he is the developer of that piece.
Cheers, Daniel
On 3/28/12 1:13 PM, Peter Dunkley wrote:
Hi,
I am trying to use t_suspend()/t_continue() multiple times on the same transaction. Calling t_suspend() more than once works, but the second time I call t_continue() the transaction is killed and a 500 response is sent. It is the "if (branch == t->nr_of_outgoings)" check from the code fragment below (from t_suspend.c:t_continue()) that results in the transaction being killed - you can see the debug/error line I added to determine this in the fragment.
Is using t_suspend()/t_continue() multiple times something that should work?
Thanks,
Peter
if (t->uas.status < 200) { /* No final reply has been sent yet.
- Check whether or not there is any pending branch.
*/ for ( branch = 0; branch < t->nr_of_outgoings; branch++ ) { if ((t->uac[branch].request.buffer != NULL) && (t->uac[branch].last_received < 200) ) break; }
if (branch == t->nr_of_outgoings) { /* There is not any open branch so there is
- no chance that a final response will be received. */
ret = 0; LM_ERR("branch == t->nr_of_outgoings\n"); goto kill_trans; } }
-- Peter Dunkley Technical Director Crocodile RCS Ltd
sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
-- Daniel-Constantin Mierla Kamailio Advanced Training, April 23-26, 2012, Berlin, Germany http://www.asipto.com/index.php/kamailio-advanced-training/