[OpenSIPS-Users] Outbound gateway selection

Bogdan-Andrei Iancu bogdan at voice-system.ro
Thu May 6 11:00:41 CEST 2010


Hi Alejandro,

Alejandro Recarey wrote:
> I am using OpenSIPS to load balance incoming calls between my asterisk
> boxes, with great results! The LB module is perfect for this.
>
> I am currently configuring OpenSIPS to also act as an outbound proxy
> to my asterisk boxes. This is because some VoIP providers want you to
> send them all calls from a single IP address.
>
> However, I have a problem with the setup. The authentification of the
> incoming calls is done with the "permission.so" module and works
> perfectly. However, because the destination URI always has the IP
> address of my OpenSIPS box, I have no way to distinguish what carrier
> (IP address) I should actually be sending the call to.
>
> The only solution I have found so far is to add an internal prefix
> (for example 1# for carrier 1 with IP X, 2# for carrier 2 with IP Y
> etc), this way I can match the uri like
>
> if(uri=~"^sip:1#[0-9]*+@"){
>   rewritehostport("x.x.x.x");
>   route(1)
> }
>
> if(uri=~"^sip:2#[0-9]*+@"){
>   rewritehostport("y.y.y.y");
>   route(1)
> }
>
>
> However, I have to strip this prefix when forwarding the invite to my
> carrier, because my carrier will not accept the prefix. This is easily
> done with the dialplan module,
I assume you do the change over RURI only (removing this prefix).

>  but I also have to _add it back_ when
> forwarding RE-INVITES, TRYING, ACK or other messages that come from my
> carrier, so that asterisk does not get confused when to: or uri tags
> do not match.
asterisk should not be confused at all - according to SIP, proxies on 
the way may change the RURI without breaking anything. The idea is to 
change only the RURI (for original INVITE), so that the SIP dialog will 
be consistent for its whole duration.

Regards,
Bogdan

>  This seems like an ugly solution, or maybe I don't know
> how to set it up?
>
> What is the best way to setup this scenario?
>
> Thank you for your help!
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>   


-- 
Bogdan-Andrei Iancu
www.voice-system.ro




More information about the Users mailing list