[OpenSIPS-Users] how to forward SIP messages?

Alex Ionescu alex at opensips.org
Thu Nov 22 18:11:14 CET 2012


Hi,

You can use this, basically taken from the default OpenSIPS script  - at 
the end of the route check the "rewritehostport" :

####### Routing Logic ########

# main request routing logic

route{
         if (!mf_process_maxfwd_header("10")) {
                 sl_send_reply("483","Too Many Hops");
                 exit;
         }

         if (has_totag()) {
                 # sequential request withing a dialog should
                 # take the path determined by record-routing
                 if (loose_route()) {
                         if (is_method("INVITE")) {
                                 # even if in most of the cases is 
useless, do RR for
                                 # re-INVITEs alos, as some buggy 
clients do change route set
                                 # during the dialog.
                                 record_route();
                         }

                         # route it out to whatever destination was set 
by loose_route()
                         # in $du (destination URI).
                         t_relay();
                         exit;
                 } else {
                         if ( is_method("ACK") ) {
                                 if ( t_check_trans() ) {
                                         # non loose-route, but stateful 
ACK; must be an ACK after
                                         # a 487 or e.g. 404 from 
upstream server
                                         t_relay();
                                         exit;
                                 } else {
                                         # ACK without matching 
transaction ->
                                         # ignore and discard
                                         exit;
                                 }
                         }
                         sl_send_reply("404","Not here");
                 }
                 exit;
         }

         # CANCEL processing
         if (is_method("CANCEL"))
         {
                 if (t_check_trans())
                         t_relay();
                 exit;
         }

         t_check_trans();


         if (!is_method("INVITE")) {
                 sl_send_reply("500","Method not allowed");
                 exit;
         }

         record_route();
         rewritehostport("10.0.2.16:5060");
         t_relay();
         exit;
}

On 11/22/2012 06:04 PM, Christian Cambier wrote:
>
> Hi.
>
> I'd like to use openSIPS proxy (10.0.4.34) for tracing but leave all 
> SIP-handling to a PBX that is on the same network (10.0.2.16)
>
> I tried just forwarding the sip-messages on the proxy using
>         forward("10.0.2.16:5060 <http://10.0.2.16:5060/>");
> but the UAC receives a "Moved permanently"
>
> How can this be achieved?
>
> thx
> Chris
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20121122/757032a8/attachment.htm>


More information about the Users mailing list