[Kamailio-Users] correct usage of t_reply

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


On Sat, Apr 11, 2009 at 1:19 PM, David Aldworth <daldworth at teliax.com> wrote:
> Is there a way to tell if a transaction already exists before executing
> t_newtran(); ?

I suppose you could use  t_check_trans().
But I haven't tried it.

> If the route query scripts executes resulted in a route, but then we get a
> 5XX from upstream, a transactions then exists. When it tries to execute
> t_newtran(); I get the following:
>
> ERROR:tm:t_newtran: transaction already in process 0x2873dd08
>
> If the query did not get a route, and no transaction exists, then executing
> t_newtran(); before the t_reply works perfectly.
>
> Using sl_send_reply works, but if the transaction does exist then it sends
> *two* 5XX messages back to the UAC. This is actually not harmful as far as I
> can tell. But it's not clean either.

I think at any point in the cfg it should be clear to the
reader/writer where a transaction exists or not depending of which
functions were called. I mean, you should know it. If you must
recourse to some function to tell if a transaction exists or not, then
I think the cfg is not clear.

regards,
takeshi

P.S.: please, always CC to the list.

> On Apr 10, 2009, at 10:06 PM, mayamatakeshi wrote:
>
>> 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 Users mailing list