2010/6/18 David <kamailio.org(a)spam.lublink.net>et>:
With regards to the thread "Re: [SR-Users] CANCEL
before INVITE". I added a
t_newtran(); call after t_checktrans() and before t_relay(), this prevented
t_relay() from sending a 100 Trying to the calling user. Why would the
functionality of t_relay() change like this ? Is t_relay() assuming that I
have already send the 100 Trying if the transaction exists?
Yes.
'Once the CANCEL is constructed, the client SHOULD
check whether it has
received any response (provisional or final) for the request being cancelled
(herein referred to as the "original request"). ' - RFC3261 Section 9.
So is this the check that tm 1.4.11 t_checktrans() is doing ? If not, how
should I be doing this check.
This text is about client side. An UAC shouldn't send a CANCEL if it
has received no provisional response from the proxy/UAS. This is to
avoid race conditions:
In UDP the UAC could send the INVITE, followed by a CANCEL, and the
CANCEL could arrive to the proxy before the INVITE (race condition),
so the UAC must wait until having a provisiona response in order to
send a CANCEL.
But from the server/proxy point of view it doesn't matter. This is, if
the proxy has received an INVITE it doesn't matter if it has replied a
provisional response or not, it already *can* handle a CANCEL from the
client. The only requeriment is having a transaction created for such
INVITE (which occurs when calling t_relay or t_newtran).
It looks like I should be be absorbing transactions
pretty much at the
beginning of my routing script after the sanity checks, is that right?
Should the transactions be checked before I call the loose_route() method?
Yes, but usually it's done after loose_route section because such
section consumes very few resources (just pure routing). But in my
case I check for retransmissions at the beginning of the script.
I read that loose_route() should be secured, would it
be correct to request
a proxy authentication before calling loose_route() ?
The dialog mechanism (call-id, from-tag and to-tag) should be secure
enough. Anyhow you can ask for auth in the proxy but take into account
that some UA's out there don't re-send an in-dialog request with
credentials.
Also, when asking for auth take into account that the From URI of the
sender could be different than the username of its credentials (i.e:
alice calls to 200 which is an alias to bob, bob later sends a BYE
with original From: "sip:200@domain", so it wouldn't match the
credentials username "bob").
Can a CANCEL request ever be routed using
loose_route().
No, CANCEL is a hop-by-hop request, an UAC sends a CANCEL to the
inmediate proxy, and the proxy inmediately replies 200 to the UAC.
Later the proxy generates its ***own*** outgoing CANCEL's in order to
terminate pending branches (if they exist).
Also, CANCEL is not an in-dialog request (no To-tag, no route-set).
But you would do better by reading the CANCEL section in RFC 3261 in
which this subjet is very well explained.
Regards.
--
Iñaki Baz Castillo
<ibc(a)aliax.net>