[Kamailio-Users] correct usage of t_reply

mayamatakeshi mayamatakeshi at gmail.com
Sat Apr 11 06:06:09 CEST 2009


On Sat, Apr 11, 2009 at 12:53 PM, David Aldworth <daldworth at teliax.com> wrote:
> I'm am attempting to return a 503 "Service Unavailable" after my
> kamailio server sends the provisional response to customer UA if we
> cannot find a route for the call. I am using:
>
> t_reply("503", "Service Unavailable");
>
> However this results in:
>
> ERROR:tm:w_t_reply: failed to send a t_reply to a message for which no
> transaction-state has been established
>
> Reading up on t_reply, it clearly states: "Sends a stateful reply
> after a transaction has been established." So, I guess thats means
> even though we have received the invite, and send 100 Trying back, a
> transaction does not actually exist.
>
> So, my question is, how do I tell the sending UAC that we are 5XX so
> that it can stop sitting there waiting for session progress?

Hello,
you can send the reply statelessly:
sl_send_reply("503", "Service Unavailable" );

or statefully:
t_newtran();
t_reply("503", "Service Unavailable");

Before you can use t_reply, a transaction must be established. This
can be done explicitly calling t_newtran() or it will be do internally
by other functions like t_relay.

regards,
takeshi.




More information about the sr-users mailing list