[OpenSIPS-Users] Routing from PSTN A back to PSTN A

Liviu Chircu liviu at opensips.org
Wed Mar 16 12:18:21 CET 2016


Although the scripting variables [1] are very flexible, expect each of 
them to only modify a single header, URI or parameter/chunk of the 
current SIP message.

In your case:

* $ru and $rU only work with the Request-URI, nothing more
* $du denotes a "next hop" (outbound proxy) the request will be sent to 
while preserving current Request-URI
   (by not setting $du, you'll just route initial requests to $ru)
* if you want to also change the "To" header field, use uac_replace_to() 
[2] from the "uac" module

[1]: http://www.opensips.org/Documentation/Script-CoreVar-2-2
[2]: http://www.opensips.org/html/docs/modules/2.2.x/uac.html#id293640

Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com

On 15.03.2016 18:23, Nagorny, Dimitry wrote:
>
> Hi all,
>
> when I shoot the following routing rule:
>
>         if ($rU=~"^[1]$" && src_ip==192.168.1.30) {
>
>                 xlog("PBX to UA at PBX! $rU@$rd:$rp via $si");
>
>                 $rU="*185511*";
>
>                 $rd="192.168.1.30";
>
>                 $rp="5060";
>
>                 $du="sip:*185511*@192.168.1.30:5060";
>
>                 xlog("PBX to UA at PBX! $rU@$rd:$rp via $si");
>
> force_send_socket(udp:192.168.1.150:5060);
>
>                 t_relay();
>
>                 exit;
>
>         }
>
> I don’t get why OpenSIPS is reverting my changes somewhere internally 
> so this happens:
>
> U *192.168.1.30:5060* -> 192.168.1.150:5060   (*PSTN* to OpenSIPS)
>
>   INVITE sip:1 at 192.168.1.150;user=phone SIP/2.0
>   To: sip:1 at 192.168.1.150;user=phone
>   From: "bla" 
> <sip:2031 at 192.168.1.30;user=phone>;tag=7d6bed4b820d54e0c0ae4cb86f442b81
>
> #
>
> U 192.168.1.150:5060 -> 192.168.1.30:5060
>
>   SIP/2.0 100 Giving a try
>   To: sip:1 at 192.168.1.150;user=phone
>   From: "bla" <sip:2031 at 192.168.1.3 
> 0;user=phone>;tag=7d6bed4b820d54e0c0ae4cb86f442b81
>
> #
>
> U 192.168.1.150:5060 -> 192.168.1.30:5060
>
>   INVITE sip:*185511*@192.168.1.30:5060;user=phone SIP/2.0
>   To: sip:*1*@192.168.1.150;user=phone
>   From: "bla" <sip:2031 
> @192.168.1.30;user=phone>;tag=7d6bed4b820d54e0c0ae4cb86f442b81
>
> #
>
> U 192.168.1.30:5060 -> 192.168.1.150:5060
>
>   SIP/2.0 100 Trying
>   To: sip:*1*@192.168.1.150;user=phone
>   From: "bla" 
> <sip:2031 at 192.168.1.30;user=phone>;tag=7d6bed4b820d54e0c0ae4cb86f442b81
>
> I simply want if someone from inside or outside calls a known area of 
> numbers that they are getting relayed to a different number. Is the 
> above routing script part wrong for my purpose?
>
> Very Respectfully
>
> *Dimitry Nagorny*
>
> Trainee
>
> robot5GmbH
>
>
>
> _______________________________________________
> 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/20160316/8b1c2930/attachment.htm>


More information about the Users mailing list