Further, if B's phone send out the new INVITE, if
$rd != $fd then do not
send the call to the gateway.
Humm, it can't be, because in case of a
forwarding (implemented in
OpenSer) I do allow calls from others domain to PSTN gateway.
Usually, if a client
wants to dial a phone number, the client will add
its own domain as RURI domain. E.g.
sip:client@mydomain.com calls PSTN 12345: RURI=sip:12345@mydomain.com ->
forward to PSTN gateway
sip:client@mydomain.com calls sip:12345@otherdomain.com --> forward
request to otherdomain. Regardless if
otherdomain.com is hosted in the
same openser or any others SIP proxy, at
otherdomain.com this is an
incoming SIP call from an external SIP client which MUST NOT be routed
to the PSTN.
Thus, I would add both checks.
But imagine this case:
- domain_A and domain_B are hosted in my OpenSer (but totally independents).
- sip:user_A@domain_A calls sip:user_B@domain_B
- In OpenSer there is forwarding: sip:user_B@domain_B -> sip:012345@domain_B
- In domain_B permissions table I allow forwardings to PSTN for calls made
from others domain (as domain_A), but not direct INVITE's (of course).