Hello,
On 6/8/13 8:55 AM, Juha Heinanen wrote:
daniel,
is_first_hop() readme has this on replies:
For incoming SIP replies, it means that top Record-Route URI is
'myself' and source address is not matching it (to avoid detecting in
case of local loops). Note that it does not detect spirals, which can
have the condition for replies true also in the case of additional SIP
reply receival.
in contact alias tutorial
https://sip-router.org/wiki/tutorials/alias-example?&#in-dialog_requests
i have implemented "is first hop" check by checking that reply does not
have any other r-r headers except the ones added by the proxy itself
when it relayed the request:
in request route i set
$avp("rr_count") = $rr_count;
and in reply route, i test
if ($rr_count == $avp(rr_count) + $rr_top_count) ...
i think that this method also works in case of spirals if i understand
correctly what spirals are.
do you have any comment about possible equivalence or non-equivalence of
the two methods? could i safely use is_first_hop test also for replies
in contact alias tutorial?
Using your approach is safer and good for spirals as
well, but requires
tm module to keep the avp. I need it for a stateless outbound proxy. I
considered storing the number of r-r as a parameter in the new r-r
header, but could become too big with ftag, nat, etc...
Detecting the spiral would require to iterate through r-r headers in
reply, see if there is another match to 'myself' and if yes, check if
source ip/port/proto matches the previous r-r header. That should make
it complete. Right now I know if there is a spiral inside my network, like:
UA1 ==== K ==== Media Server ==== K ==== UA2
but is easy to check that source ip is media server.
Cheers,
Daniel
--
Daniel-Constantin Mierla
http://www.asipto.com