[OpenSIPS-Users] [nat_traversal] Replacement of bflag(NAT_CALLED) ?

Dan Pascu dan at ag-projects.com
Wed Nov 12 11:12:25 CET 2008

On Wednesday 12 November 2008, Iñaki Baz Castillo wrote:
> 2008/11/12 Dan Pascu <dan at ag-projects.com>:
> > As a side note, nat_traversal itself doesn't need that mechanism
> > because it can figure out itself if a destination device is behind
> > NAT and it needs to keep it alive during a call. So you only call
> > nat_traversal() when you have a caller behind NAT that you want to
> > keep reachable (for either REGISTER, SUBSCRIBE or INVITE sessions).
> Could you explain it more? "nat_keepalive()" can be called just from

Because nat_keepalive() is for keeping alive the source of the call. The 
destination (for INVITE sessions) is automatically kept alive if behind 
NAT without you doing anything.

> If alice calls bob (who is registered behind NAT) the nat_traversal
> was alreading mantaining the keepalive to bob after the REGISTER, but
> anyway I need to fix the CONTACT in the 200 OK from bob (this can be
> detected in ON_REPLY_ROUTE based on BFLAG_NAT_CALLED set or not during
> bob registration, by doing "nat_test", by adding a Record-Route
> paramenter in INVITE....).

You can use fix_contact wherever you want. This has nothing to do with 

> But as far as I understand, nat_keepalive() has nothing to do in the
> above, *except* mantaining the keepalive for bob since it is
> registered behind NAT, but no more, 

exactly. call keep_alive() for each REGISTER/SUBSCRIBE/INVITE without a 
to_tag and for which the caller is found to be behind NAT. It will figure 
out the rest automatically. For INVITE will keep all NATed destinations 
alive without you doing anything (will see if a destination is registered 
to be kept alive for a REGISTER and if so will also add the INVITE 
condition to it, in case it stops registering or moves the registration 
to a different proxy in the cluster, in mid-call).

> did you mean other something 
> different?

No, I didn't.


More information about the Users mailing list