[OpenSIPS-Users] $ai transformation

Răzvan Crainea razvan at opensips.org
Mon Nov 21 11:31:40 CET 2016


Hi, Ehrny!

You need the IP address of whom? Caller? Callee?
$rd is null because a reply does not have a R-URI. Perhaps the reply 
doesn't have a received parameter in the reply either, that's why it is 
empty.

Best regards,

Răzvan Crainea
OpenSIPS Solutions
www.opensips-solutions.com

On 11/21/2016 12:13 PM, Ehrny wrote:
>
> Hello Răzvan,
>
> I need to do some routing in onreply_route[] based on destination IP.
>
> Tried  $rd with no avail , it returns null
>
> If I get you right regarding context, the var        $var(upstream0) = 
> $(hdr(Via)[0]{via.received});   Is empty also.
>
> What is the right way to get an IP address in replies and do further 
> routing?
>
> Kind regards,
>
> Ehrny
>
> *From:*users-bounces at lists.opensips.org 
> [mailto:users-bounces at lists.opensips.org] *On Behalf Of *Razvan Crainea
> *Sent:* Monday, November 21, 2016 11:50 AM
> *To:* users at lists.opensips.org
> *Subject:* Re: [OpenSIPS-Users] $ai transformation
>
> Hi, Ehrny!
>
> You don't need to use contexts in the onreply_route[], because that 
> route is already ran in the context of the reply message.
>
> Best regards,
>
>
> Răzvan Crainea
> OpenSIPS Solutions
> www.opensips-solutions.com <http://www.opensips-solutions.com>
>
> On 11/19/2016 10:40 PM, Ehrny wrote:
>
>     Dear Răzvan,
>
>     … I’ve tried to add variable to onreply_route[1]
>
>     $var(upstream0) = $(<reply>hdr(Via)[0]{via.param,received});
>
>     xlog("upstream0  =  $var(upstream0) \n");
>
>     and in the log I get critical alert:
>
>     CRITICAL:tm:tm_pv_context_reply: no picked branch (-1) for a final
>     response
>
>     *From:*users-bounces at lists.opensips.org
>     <mailto:users-bounces at lists.opensips.org>
>     [mailto:users-bounces at lists.opensips.org] *On Behalf Of *Ehrny
>     *Sent:* Saturday, November 19, 2016 2:06 PM
>     *To:* OpenSIPS users mailling list
>     *Subject:* Re: [OpenSIPS-Users] $ai transformation
>
>     Hi Răzvan,
>
>     I gues so.
>
>     I’ve got      t_on_reply("1");       in the route
>
>     and at the end of the script there is:
>
>     onreply_route[1] {
>
>     force_send_socket(udp:10.197.26.170:5060);
>
>     }
>
>     But it doesn’t seem to change send_socket back to priv IP addr ((
>
>     Kind regards,
>
>     Ehrny
>
>     *From:*users-bounces at lists.opensips.org
>     <mailto:users-bounces at lists.opensips.org>
>     [mailto:users-bounces at lists.opensips.org] *On Behalf Of *Razvan
>     Crainea
>     *Sent:* Friday, November 18, 2016 12:22 PM
>     *To:* users at lists.opensips.org <mailto:users at lists.opensips.org>
>     *Subject:* Re: [OpenSIPS-Users] $ai transformation
>
>     Hi, Ehrny!
>
>     Did you try setting the private socket on the reply?
>
>     Best regards,
>
>
>     Răzvan Crainea
>
>     OpenSIPS Solutions
>
>     www.opensips-solutions.com <http://www.opensips-solutions.com>
>
>     On 11/17/2016 01:00 AM, Ehrny wrote:
>
>         Dear Răzvan,
>
>         Thanks again for the prompt help. I was able to change the
>         headers as needed but I’m stuck with another problem(
>
>         I’ve got opensips with two Ethernet adapters, eth1 as a
>         private and another one eth0 as public.  Opensips works fine
>         when the call is coming on the public eth0 and leaves opensips
>         through the same public adapter. (All the GWs are behind that
>         public eth0 instead of one ). The problem happens when the
>         call comes in through the private eth1, please see the drawing
>         in attachment.
>
>         -sip1.  After I’ve got invite from provider on the private
>         eth1 , I send it through the public eth0.
>
>         -sip2.  I use force_send_socket(udp:PUBLIC_IP:PORT) for the
>         call to be able to pass through the opensips and come back
>         from external GW (x.x.82.139). I also change SIP Request's URI
>         and use uac_replace_to () to change these fields as needed.
>
>         -sip4.  Opensips has got 180 Ringing from external GW
>         (x.x.82.139)
>
>         -sip5.  Opensips tries to send it back to originator
>         (10.250.242.74) which is behind private NIC eth0 (10.197.26.170)
>
>         the call can not be set up because I send reply from my public
>         eth1
>
>         2016-11-16 18:56:14      : x.x.80.43:5060 -> 10.250.242.74:5060
>
>         SIP/2.0 *180* Ringing Via: SIP/2.0/UDP
>         10.250.242.74:5060;branch=*z9hG4bKqci5ec *Record-Route:
>         <sip:x.x.80.43;r2=on;lr;ftag=*2F81324631*;did=3a2.4667b68
>         <sip:x.x.80.43;r2=on;lr;ftag=2F81324631353641A405EA00;did=3a2.4667b68>>
>         Record-Route:
>         <sip:10.197.26.170;r2=on;lr;ftag=*2F81324631*;did=3a2.4667b68
>         <sip:10.197.26.170;r2=on;lr;ftag=2F81324631353641A405EA00;did=3a2.4667b68>>
>         From: sip:300940 at domain.com;tag=*2F81324631*
>         <sip:300940 at domain.com;tag=2F81324631353641A405EA00> To:
>         sip:300905 at domain.com:5060;tag=231469dIr894
>         <sip:300905 at domain.com:5060;tag=231469dIr894p0D461D0t66>
>         Call-ID: *020A3EA03A8 at SFESIP4-id1-ext* CSeq: 1 INVITE Contact:
>         <sip:54321 at x.x.82.139:5060>
>
>         I’m not sure if I do it right way because the packet (sip5)
>         goes to 10.250.242.74 with the source ip of public eth0 and
>         not the one it should pass through to be able to come back.
>
>         What is the right way in my case to get the call through?
>
>         Thank you for all of your help,
>
>         Regards,
>
>         Ehrny
>
>
>
>
>         _______________________________________________
>
>         Users mailing list
>
>         Users at lists.opensips.org <mailto:Users at lists.opensips.org>
>
>         http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
>
>     _______________________________________________
>
>     Users mailing list
>
>     Users at lists.opensips.org <mailto:Users at lists.opensips.org>
>
>     http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
> _______________________________________________
> 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/20161121/2b968228/attachment-0001.htm>


More information about the Users mailing list