[Serusers] How to handle ACK after stateless replies?

Jiri Kuthan jiri at iptel.org
Mon Mar 15 21:47:33 CET 2004


At 06:14 PM 3/15/2004, Klaus Darilion wrote:
>Hi!
>
>If the proxy replies stateless, how should the proxy handle the incoming ACK request?
>
>e.g. an INVITE to an offline user:
>
>if (!lookup("location")) {
>   sl_send_reply("404", "Not Found");
>   break;
>}
>
>The SIP client will respond with ACK to the 404 response. How shall I handle this ACK - just ignoring it?

sl_send_reply generates a specific to-tag. ACKs with this totag will be consumed before
script processing occurs. This fails if there is already a to-tag -- then ACK
gets inside the script. To address that one would have to reply statefuly
and consume ACKs based on transaction state. I personaly prefer the stateless
operation for better scalability.


>BTW: Is it allowed to send stateless replies on existing transactions?
>e.g:
>t_newtran();
>...
>sl_send_reply(..);

It is not forbidden but it will break. If no reply is put in the transaction state,
the transaction state will expie someday and generate 408. Use t_reply if you created
transaction state. A typical sequence follows:

    # message store
    if (method == "MESSAGE") {
        if (!t_newtran()) {     # T-state not created, failure occured (lac of memory?)
            sl_reply_error();   # -> it is safe to reply statelessly
            break;
        };

        if (m_store("0")) {     # there is transaction state -> do reply statefuly now
            t_reply("202", "Accepted for Later Delivery");
            break;
        };

        # message store failed but T-state already exists -- again, reply
        # statefuly
        t_reply("503", "Service Unavailable");
        break;
    };


-jiri 




More information about the sr-users mailing list