[SR-Users] Stateful vs. stateless replies from script

Alex Balashov abalashov at evaristesys.com
Thu Oct 7 10:42:12 CEST 2010


Now that K v3.1.0 provides send_reply(), what is the preferred 
ideology about whether to send stateful or stateless negative error 
replies?

I mean in general, not in specific cases like digest authentication in 
the new 'auth' module, where, according to the docs, a transaction and 
stateful replies are required in order for enhanced nonce replay 
protection.

The traditional wisdom in past bodies of scripts and knowledge in the 
public realm has been, in my interpretation, that stateless replies 
are acceptable for final negative responses from script[1].  After 
all, a reply like "404 Not Found" from the proxy is basically 
fire-and-forget;  why devote additional transactional memory to it 
while the transaction hold-down timer expires?  We do not care if we 
receive an ACK, nor want anything further to do with this branch.

On the other hand, there is a point of view out there that mixing 
stateless and stateful replies is not good, despite the somewhat 
increased overhead and resource usage associated with making all 
replies stateful.  This perspective emphasises that if the proxy is 
fundamentally operating in a stateful manner, it should do so with 
respect to all messages, rather than allowing a large category of 
replies to slip under the radar of TM and have possibly inconsistent 
results.

For now, I have changed my code to use send_reply() in all cases where 
sl_send_reply() was used in the past;  it seems easier to let 
Kamailio/SR make the decision.  However, in practice, most requests 
will result in the creation of a transaction, so it is like replacing 
sl_send_reply() with t_reply() in the majority of cases.

Am I missing anything?  Any salient considerations I missed?

I am curious as to the consensus about the best practice here from the 
vantage point of the developers.

Thanks,

-- Alex

[1]  Except in FAILURE-ROUTEs, from which only stateful replies may
      be issued.

-- 
Alex Balashov - Principal
Evariste Systems LLC
1170 Peachtree Street
12th Floor, Suite 1200
Atlanta, GA 30309
Tel: +1-678-954-0670
Fax: +1-404-961-1892
Web: http://www.evaristesys.com/



More information about the sr-users mailing list