Documentation |
Documentation -> Tutorials -> Topology Hiding with OpenSIPSThis page has been visited 28095 times. Table of Content (hide) 1. Tutorial OverviewThe purpose of this tutorial is to help you understand how the topology_hiding module works and also how it should be used. 2. Current FeaturesBy default, when engaged, the module will hide the VIA, Record-Route, Route and Contact headers. VIA, Record-Route and Route headers will be fully removed when routing message from one side to the other, while the Contact header will be mangled to point to the outgoing interface IP. 3. How It WorksThe module can work on top of the dialog and TM modules, or just on top of the TM module. When running strictly on top of the TM module, the topology hiding SIP messages will be bigger when compared to the initial requests ( since OpenSIPS will encode all the needed information in a parameter of the Contact header ), but all type of SIP requests and dialogs will be supported ( INVITE dialogs, Presence dialogs, SIP MESSAGE, etc ). When running on top of the DIALOG module, you will get shorter messages ( all the removed headers will be kept internally in the dialog module ) , but you will only be able to hide INVITE based dialogs. 4. Example Scriptloadmodule "topology_hiding.so" route { .... .... .... if (has_totag()) { if (topology_hiding_match()) { xlog("Succesfully matched this request to a topology hiding dialog. \n"); xlog("Calller side callid is $ci \n"); xlog("Callee side callid is $TH_callee_callid \n"); t_relay(); exit; } else { if ( is_method("ACK") ) { if ( t_check_trans() ) { t_relay(); exit; } else exit; } sl_send_reply("404","Not here"); exit; } } .... .... .... # if it's an INVITE dialog, we can create the dialog now, will lead to cleaner SIP messages if (is_method("INVITE")) create_dialog(); # we do topology hiding, preserving the Contact Username and also hiding the Call-ID topology_hiding("UC"); t_relay(); exit; } |