Help with "t_relay"

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Help with "t_relay"

Spady#7
Hi list, i need some hints by you experts to get working my idea.

What I am trying to do is parallel forking toward 2 different IP PBXs whose have different carateristics. Let me explain:

IP PBX #1: accept UDP connections on port 5060
IP PBX #2: accept TCP connections on port 5068

What i tried to do is as follow:

if (src_ip == IP_MEDIANT || (method=="INVITE")) {
      rewritehostport("FQDN_IP_PBX_2:PORT_IP_PBX_2");
        route(10);
        exit;
                }

.........

route[10] {
        append_branch();
       
          t_relay("tcp:IP_PBX_2:PORT_IP_PBX_2");
              exit;
        }

So now I am stuck because i have some dubts that i can't answer:

1- How Can I forward the original request and the new BRANCH created to different "t_relays" ( which they have to have different features (UDP, TCp etc.. ) ) ?

I tried with

$(branch(uri)[0]) = "sip:???@IP_PBX_1:PORT_IP_PBX_1";

But seems not working. In this last snippet of code, Can I use pseudo variables like $rU??
$(branch(uri)[0]) = "sip:$rU@IP_PBX_1:PORT_IP_PBX_1"; ( ????? )

Hope someone can point me in a right way.

Regards

I did not found into documentation something about protocol for Branches sections. In my case i also need to change it to UDP.

Reply | Threaded
Open this post in threaded view
|

Re: Help with "t_relay"

Bogdan-Andrei Iancu-2
Hi Spandy,

What you have is one URI (A) that you want to send to 2 destinations (X
an Y). So you need to create a new branch with the same uri (A) but to
point to a different destination:

$ru = "sip:user@domain";  # set initial URI
append_branch();          # clone it as a new branch with the same URI

$du = "sip:ip_pbx1:5060";  # set destination for initial URI
$(branch(duri)[0]) = "sip:ip_pbx2:5068;transport=tcp"; # set destination
for new branch

Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com


On 11/23/2012 01:36 AM, spady wrote:

> Hi list, i need some hints by you experts to get working my idea.
>
> What I am trying to do is parallel forking toward 2 different IP PBXs whose
> have different carateristics. Let me explain:
>
> IP PBX #1: accept UDP connections on port 5060
> IP PBX #2: accept TCP connections on port 5068
>
> What i tried to do is as follow:
>
> if (src_ip == IP_MEDIANT || (method=="INVITE")) {
>         rewritehostport("FQDN_IP_PBX_2:PORT_IP_PBX_2");
>         route(10);
>         exit;
>                 }
>
> .........
>
> route[10] {
>          append_branch();
>
>            t_relay("tcp:IP_PBX_2:PORT_IP_PBX_2");
>      exit;
> }
>
> So now I am stuck because i have some dubts that i can't answer:
>
> 1- How Can I forward the original request and the new BRANCH created to
> different "t_relays" ( which they have to have different features (UDP, TCp
> etc.. ) ) ?
>
> I tried with
>
> $(branch(uri)[0]) = "sip:???@IP_PBX_1:PORT_IP_PBX_1";
>
> But seems not working. In this last snippet of code, Can I use pseudo
> variables like $rU??
> $(branch(uri)[0]) = "sip:$rU@IP_PBX_1:PORT_IP_PBX_1"; ( ????? )
>
> Hope someone can point me in a right way.
>
> Regards
>
> I did not found into documentation something about protocol for Branches
> sections. In my case i also need to change it to UDP.
>
>
>
>
>
> --
> View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/Help-with-t-relay-tp7583170.html
> Sent from the OpenSIPS - Users mailing list archive at Nabble.com.
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Help with "t_relay"

Spady#7
Hi Bogdan,
you said:

$ru = "sip:user@domain";  # set initial URI

But the initial URI, in my case, could be different, because is an incoming call from PSTN towards several DDI users. I can't define ($ru) as i unique URI. Can I set is as a variable? Am I wrong?

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Help with "t_relay"

Spady#7
Hi all, solved with following solution:

if (src_ip == IP_MEDIANT || (method=="INVITE")) {
      rewritehostport("FQDN_IPPBX1:PORT_IPPBX1");
        route(10);
        exit;
                }
               
               
  ......
  ......            
               
route[10] {
        append_branch();
        rewritehostport("IP_IPPBX2:PORT_IPPBX2");
        $du = "sip:IP_IPPBX2:PORT_IPPBX2";
        # display branches
                $(branch(duri)[0]) = "sip:IP_IPPBX1:PORT_IPPBX1;transport=tcp";  
                t_relay();
              exit;
        }

Hope could help someone else.
Regards