Re: [OpenSIPS-Users] Opensips 2.2 CRASH

2015-11-17 Thread Dragomir Haralambiev
This working in 2.1. But  2.2 crash.
When delete this line all is OK.

You can see in dump.
На 17.11.2015 г. 1:45 PM "Rodrigo Pimenta Carvalho" 
написа:

> Hi.
>
>
> In my case this problem does not happen and I´m using the version 2.2 too.
>
>
> In the OpenSIPS script file I have:
>
>
>
> ---
>
>
>  DIALOG module
> loadmodule "dialog.so"
> modparam("dialog", "dlg_match_mode", 1)
> modparam("dialog", "db_mode", 1)
> modparam("dialog", "db_url",
> "sqlite:///usr/local/opensips_proxy/sqlite") # CUSTOMIZE ME
>
> modparam("dialog", "default_timeout", 540)
>
>
> # About the db_mode parameter:
> # 0 - NO_DB - the memory content is not flushed into DB;
> #   1 - REALTIME - any dialog information changes will be reflected into
> the database immediately.
> #2 - DELAYED - the dialog information changes will be flushed into the
> DB periodically, based on a timer routine.
> #3 - SHUTDOWN - the dialog information will be flushed into DB only at
> shutdown - no runtime updates.
>
>
> # create dialog with timeout
> if ( !create_dialog("B")) {
> send_reply("500","Erro no terminal principal");
> exit;
>  }
>
> avp_db_query("select Value from GeneralConfigurations where Attribute
> = 'CALLMAXDURATION'", "$avp(CallMaxDuration)");
>
> $DLG_timeout = $avp(CallMaxDuration);
>
>
>
> --
>
>
> Hopefully, this example will serve
>
>
> Best regards.
>
>
>
> RODRIGO PIMENTA CARVALHO
> Inatel Competence Center
> Software
> Ph: +55 35 3471 9200 RAMAL 979
>
>
> --
> *De:* users-boun...@lists.opensips.org 
> em nome de Dragomir Haralambiev 
> *Enviado:* terça-feira, 17 de novembro de 2015 07:32
> *Para:* OpenSIPS users mailling list
> *Assunto:* [OpenSIPS-Users] Opensips 2.2 CRASH
>
> Hello developers,
>
> Opensips 2.2 crash when try to run:
>
> $DLG_timeout=$avp(maxtime);
>
> This in Opensips 2.1.1 working fine.
>
> Best regards,
>
>
> ___
> Users mailing list
> Users@lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


[OpenSIPS-Users] Strange multiple replicated registers

2015-11-17 Thread Julian Santer

Hi guys,

we have encountered the following problem.
Our UAC (Snom 760) sends 2 register for the same contact to our edge servers.
Our edge server sends the register to registrar (master). The registrar 
replicates the register to the registrar (slave).
The flow of first register seems ok 
(http://siptrace.rolbox.net/register_first.html).
The second register ends also in a 200 OK. But the register master replicates 
the register 9 times (http://siptrace.rolbox.net/register_second.html).

So my qeustions are:
- why the UAC send the register twice for the same contact? Also other clients 
like a AVM Fritzbox send the register twice.
- why the registrar master replicates the register multiple times?

IP's and domains are obfuscated.

On the edge server we do (5.6.7.8):

$rd = "5.6.7.9";
t_on_branch("BR_REGISTER");
if (! t_relay("0x05"))
{
send_reply("500", "Internal server error - failed to relay");
xlog("L_ERR", "Unable to relay REGISTER - LF_BASE");
}
xlog("L_INFO", "Routing register to registrar - LF_BASE");

On the registrars (5.6.7.9 and 5.6.7.10):

xlog("L_INFO", "REGISTER received from $si - LF_BASE");

if (src_ip == 5.6.7.9 || src_ip == 5.6.7.10)
{
if (! save("LOCATION_DB", "vmrp1"))
{
xlog("L_ERR", "Saving contact from master failed - LF_BASE");
exit;
}
xlog("L_INFO", "Saving contact received from master - LF_BASE");
t_on_branch("BR_DROP");
}
else
{
if(!save("LOCATION_DB", "vp1"))
{
xlog("L_ERR", "Saving contact from edge failed - LF_BASE");
t_replicate("sip:REGISTRAR_SLAVE", "0x04");
exit;
}
xlog("L_INFO", "Saving contact received from edge, replicate to 
REGISTRAR_SLAVE - LF_BASE");
t_replicate("sip:REGISTRAR_SLAVE", "0x04");
t_on_branch("BR_DROP");
}

if ($(hdr(Contact)) == null)
{
xlog("L_INFO", "Retrieving locations - LF_BASE");
} else {
xlog("L_INFO", "Registration successful - LF_BASE");
}
exit;

LOCATION_DB is the location table name for the registrars (2 registrars, 2 
tables)
REGISTRAR_SLAVE is the domain name of the respective registrar slave.
The servers are in the same network, connected over layer 2.

Let me know if you need further informations.

Best regards,
Julian Santer
Raiffeisen OnLine


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Opensips 2.2 CRASH

2015-11-17 Thread Dragomir Haralambiev
Hi,

Thanks for your quick replay.
Here is gdb opensips core.1226

http://pastebin.com/dyyJhizH

Regards,

2015-11-17 11:35 GMT+02:00 Răzvan Crainea :

> Hi, Dragomir!
>
> Can you post a backtrace on pastebin?
>
> Best regards,
>
> Răzvan Crainea
> OpenSIPS Solutionswww.opensips-solutions.com
>
> On 11/17/2015 11:32 AM, Dragomir Haralambiev wrote:
>
> Hello developers,
>
> Opensips 2.2 crash when try to run:
>
> $DLG_timeout=$avp(maxtime);
>
> This in Opensips 2.1.1 working fine.
>
> Best regards,
>
>
>
> ___
> Users mailing 
> listUsers@lists.opensips.orghttp://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
> ___
> Users mailing list
> Users@lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


[OpenSIPS-Users] Client is unauthorized to register, when I configure not to store plaintext passwords. Why?

2015-11-17 Thread Rodrigo Pimenta Carvalho
Dear OpenSIPS-Users,


My  telecom system based on OpenSIPS 2.2 is working very well.

All clients can register on the sip proxy, using login and password as usual.


However, If I configure 'STORE_PLAINTEXT_PW=0' in file opensipsctlrc, remove 
user X from table subscriber and finally add the same user with the same 
password back, I get a problem:


the user X cannot register and gets the unauthorized (401) response from the 
sip proxy.


As I can see, the password is no more written in the table subscriber. Good, it 
is correct for me. And the hash codes still are recorded in such table for such 
user. So, I can't see what is the problem.


Have I to use a specific module in this case? Or have I to change something in 
the client application? I have checked the documentation, but I didn't find the 
solution.


Any hint will be very helpful!


Best regards.


RODRIGO PIMENTA CARVALHO
Inatel Competence Center
Software
Ph: +55 35 3471 9200 RAMAL 979
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Opensips 1.11 permission module problem

2015-11-17 Thread Richard Revels
Are you using subnets in your address table?  How often do you reload the
address table?

There was a package memory leak that was fixed in the development tree that
might explain what you are seeing.

On Wed, Nov 11, 2015 at 4:26 AM, dpa  wrote:

> Hello!
>
>
>
> Is there any assumption about problem?
>
>
>
> *From:* users-boun...@lists.opensips.org [mailto:
> users-boun...@lists.opensips.org] *On Behalf Of *dpa
> *Sent:* Wednesday, October 28, 2015 4:12 PM
> *To:* 'OpenSIPS users mailling list'
> *Subject:* [OpenSIPS-Users] Opensips 1.11 permission module problem
>
>
>
> Hello!
>
>
>
> OpenSIPS (1.11.5-notls (x86_64/linux))
>
>
>
> I have a periodic problem with permissions module.
>
> I could not make opensipsctl address reload (“400 Trusted table reload
> failed” received). In the time I have no problem with dialplan or drouting
> modules.
>
> Opensips reload solve the problem.
>
>
>
>
>
> In attachment log from opensips and statistic.
>
>
>
> Thank you for any help
>
>
>
>
>
>
>
> ___
> Users mailing list
> Users@lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Client is unauthorized to register, when I configure not to store plaintext passwords. Why?

2015-11-17 Thread Rodrigo Pimenta Carvalho
Hi.


I found the solution reading the documentations again.

In the OpenSIPS configuration file, it is necessary to define:


modparam("auth_db", "calculate_ha1", no)

modparam("auth_db", "password_column", "ha1")


Thanks!


RODRIGO PIMENTA CARVALHO
Inatel Competence Center
Software
Ph: +55 35 3471 9200 RAMAL 979



De: users-boun...@lists.opensips.org  em nome 
de Rodrigo Pimenta Carvalho 
Enviado: terça-feira, 17 de novembro de 2015 16:28
Para: users@lists.opensips.org
Assunto: [OpenSIPS-Users] Client is unauthorized to register, when I configure 
not to store plaintext passwords. Why?


Dear OpenSIPS-Users,


My  telecom system based on OpenSIPS 2.2 is working very well.

All clients can register on the sip proxy, using login and password as usual.


However, If I configure 'STORE_PLAINTEXT_PW=0' in file opensipsctlrc, remove 
user X from table subscriber and finally add the same user with the same 
password back, I get a problem:


the user X cannot register and gets the unauthorized (401) response from the 
sip proxy.


As I can see, the password is no more written in the table subscriber. Good, it 
is correct for me. And the hash codes still are recorded in such table for such 
user. So, I can't see what is the problem.


Have I to use a specific module in this case? Or have I to change something in 
the client application? I have checked the documentation, but I didn't find the 
solution.


Any hint will be very helpful!


Best regards.


RODRIGO PIMENTA CARVALHO
Inatel Competence Center
Software
Ph: +55 35 3471 9200 RAMAL 979
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


[OpenSIPS-Users] How to make OpenSIPS despise (ignore) the domain of UAC during the registration?

2015-11-17 Thread Rodrigo Pimenta Carvalho

Dear OpenSIPS_Users,


In my OpenSIPS, I have created the following configurations:


In opensipsctlrc file



SIP_DOMAIN=localhost

STORE_PLAINTEXT_PW=0




In OpenSIPS config file

===

 AUTHentication modules
loadmodule "auth.so"
loadmodule "auth_db.so"
modparam("auth_db", "calculate_ha1", 0)

modparam("auth_db", "password_column", "ha1")



I intend to avoid password as plain text be recorded in the database.

I also intend to let OpenSIPS run and works, in different domains. That is, my 
configuration should works for different IP addresses. That is why I use 
'SIP_DOMAIN=localhost'. So, every time a new user is added to the Registrar, a 
wrong IP address will not appear in the database.


However, this configuration does not allow an UAC register and be online.  The 
UAC gets unauthorized (401) as response. I guess this is due to the fact that 
ha1 is calculated using 'localhost' and the UAC tries to register using an IP 
address. So, I suspect that OpenSIPs is comparing the domain gotten form ha1 
and gotten from the SIP Register message. How to solve this problem?


How to make OpenSIPS ignore the domain specified by the UAC, for SIP REGISTER?

What I need is to make OpenSIPS consider just login and password to accept a 
register. Is it possible?


Any hint will be very helpful!


Thanks a lot.



RODRIGO PIMENTA CARVALHO
Inatel Competence Center
Software
Ph: +55 35 3471 9200 RAMAL 979
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Opensips 1.11 permission module problem

2015-11-17 Thread dpa
Hello Richard

 

It is about 1 – 1,5 week.

No, I do not use subnets, only IP address. 

 

“There was a package memory leak that was fixed in the development tree”

Where can I read about it? Thank you.

 

From: users-boun...@lists.opensips.org 
[mailto:users-boun...@lists.opensips.org] On Behalf Of Richard Revels
Sent: Tuesday, November 17, 2015 8:55 PM
To: OpenSIPS users mailling list
Subject: Re: [OpenSIPS-Users] Opensips 1.11 permission module problem

 

Are you using subnets in your address table?  How often do you reload the 
address table?

 

There was a package memory leak that was fixed in the development tree that 
might explain what you are seeing.

 

On Wed, Nov 11, 2015 at 4:26 AM, dpa  wrote:



Hello!

 

Is there any assumption about problem?

 

From: users-boun...@lists.opensips.org 
[mailto:users-boun...@lists.opensips.org] On Behalf Of dpa
Sent: Wednesday, October 28, 2015 4:12 PM
To: 'OpenSIPS users mailling list'
Subject: [OpenSIPS-Users] Opensips 1.11 permission module problem

 

Hello!

 

OpenSIPS (1.11.5-notls (x86_64/linux))

 

I have a periodic problem with permissions module.

I could not make opensipsctl address reload (“400 Trusted table reload failed” 
received). In the time I have no problem with dialplan or drouting modules.

Opensips reload solve the problem.

 

 

In attachment log from opensips and statistic.

 

Thank you for any help

 

 

 


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

 

___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


[OpenSIPS-Users] Opensips 2.2 CRASH

2015-11-17 Thread Dragomir Haralambiev
Hello developers,

Opensips 2.2 crash when try to run:

$DLG_timeout=$avp(maxtime);

This in Opensips 2.1.1 working fine.

Best regards,
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] remove function not working for specific contact

2015-11-17 Thread Răzvan Crainea

Hi, Jayesh!

If I understood correctly, you only want to have a single contact in 
memory, right? If so, you can use the save[1] function, with flags c and 
f. Something like:


save("location", "fc1");

[1] http://www.opensips.org/html/docs/modules/2.1.x/registrar.html#id294034

Best regards,

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

On 11/17/2015 08:37 AM, Jayesh Nambiar wrote:

Hello All,
Just bumping in to check if there's a better way to remove an existing 
contact from the location. My idea was to remove from the location a 
record with particular callid or particular contact on specific 
scenarios. So I do the following:
On a successful registration I store the some id that my device has 
along with callid and contact.
On a subsequent registration, I compare the id and callid, if they are 
different from the current registration, I need to remove the existing 
contact with this callid

If the id and callid is same, I do nothing.

Thanks,

- Jayesh

On Tue, Nov 10, 2015 at 6:59 PM Jayesh Nambiar > wrote:


Forgot to mention. I'm using version 2.1.

Thanks,

- Jayesh

On Tue, Nov 10, 2015 at 6:01 PM Jayesh Nambiar
> wrote:

Hello,
I've been trying to delete specific contact for AOR using the
remove function in the registrar module, but somehow it
doesn't remove it from the location.
My db_mode is 0 as I only want to store it in opensips memory.
I hav the "use_domain" param as 1. On register, the contact
gets stored in the following format:


sip:579e08000@203.153.53.130:49612;rinstance=477b5477848ba584;transport=tcp

I tried multiple ways to remove this:

1) remove("location", "sip:579e08...@abc.com
",

"sip:579e08000@203.153.53.130:49612;rinstance=477b5477848ba584;transport=tcp")

2) remove("location", "sip:579e08...@abc.com
",
"sip:579e08000@203.153.53.130:49612
")

Also, I'd like to mention that I have an edge proxy in the
middle who proxies the REGISTER to this Registrar and I use
the PATH module to route back reliably. I'm essentially trying
to remove location entry for particular endpoints based on
some conditions.

Any help is appreciated. Thanks,

- Jayesh



___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Opensips 2.2 CRASH

2015-11-17 Thread Răzvan Crainea

Hi, Dragomir!

Can you post a backtrace on pastebin?

Best regards,

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

On 11/17/2015 11:32 AM, Dragomir Haralambiev wrote:

Hello developers,

Opensips 2.2 crash when try to run:

$DLG_timeout=$avp(maxtime);

This in Opensips 2.1.1 working fine.

Best regards,



___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] remove function not working for specific contact

2015-11-17 Thread Jayesh Nambiar
Hello Razvan,
My idea is to keep one registration per device and hence the fc1 option
wouldn't work for me here. Meaning the account can register from multiple
locations using multiple devices, but if the same device tries to initiate
a new register when there is an existing record in the location, I want to
remove the existing one and save the new one. Moreover, my clients do not
support GRUU and hence thats not the right path for me currently.
So here's the idea:
1) On a REGISTER request, my clients come with an id that is unique to a
device.
2) On successful registration, I store in local-cache the contact and
callid for this particular device-id.
3) For all REGISTER, I check if AOR with callid is registered using the
'registered("location", "AOR", "callid")' function.
4) If registered returns true for the current callid, I consider it to be a
Re-REGISTER.
5) If registered for current  callid returns false, I fetch the contact for
device_id from local-cache. If the contact exists, meaning the same device
is doing a new REGISTER. In this case, I need to remove the existing
contact for this AoR.
6) This mostly happens when a client is registered and loses connectivity.
The client when restarted creates a new registration with new callid
without un-registering the existing one on the server.
7) The server deletes the device-id from the location on Un-REGISTER. I
identify this when Expires header is 0.

Do let me know if this is do-able in a neater way. Thanks in advance.

- Jayesh

On Tue, Nov 17, 2015 at 2:48 PM Răzvan Crainea  wrote:

> Hi, Jayesh!
>
> If I understood correctly, you only want to have a single contact in
> memory, right? If so, you can use the save[1] function, with flags c and f.
> Something like:
>
> save("location", "fc1");
>
> [1]
> http://www.opensips.org/html/docs/modules/2.1.x/registrar.html#id294034
>
> Best regards,
>
> Răzvan Crainea
> OpenSIPS Solutionswww.opensips-solutions.com
>
> On 11/17/2015 08:37 AM, Jayesh Nambiar wrote:
>
> Hello All,
> Just bumping in to check if there's a better way to remove an existing
> contact from the location. My idea was to remove from the location a record
> with particular callid or particular contact on specific scenarios. So I do
> the following:
> On a successful registration I store the some id that my device has along
> with callid and contact.
> On a subsequent registration, I compare the id and callid, if they are
> different from the current registration, I need to remove the existing
> contact with this callid
> If the id and callid is same, I do nothing.
>
> Thanks,
>
> - Jayesh
>
> On Tue, Nov 10, 2015 at 6:59 PM Jayesh Nambiar 
> wrote:
>
>> Forgot to mention. I'm using version 2.1.
>>
>> Thanks,
>>
>> - Jayesh
>>
>> On Tue, Nov 10, 2015 at 6:01 PM Jayesh Nambiar 
>> wrote:
>>
>>> Hello,
>>> I've been trying to delete specific contact for AOR using the remove
>>> function in the registrar module, but somehow it doesn't remove it from the
>>> location.
>>> My db_mode is 0 as I only want to store it in opensips memory. I hav the
>>> "use_domain" param as 1. On register, the contact gets stored in the
>>> following format:
>>>
>>>
>>> sip:579e08000@203.153.53.130:49612;rinstance=477b5477848ba584;transport=tcp
>>>
>>> I tried multiple ways to remove this:
>>>
>>> 1) remove("location", "sip:579e08...@abc.com",
>>> "sip:579e08000@203.153.53.130:49612;rinstance=477b5477848ba584;transport=tcp"
>>> 
>>> )
>>>
>>> 2) remove("location", "sip:579e08...@abc.com", "
>>> sip:579e08000@203.153.53.130:49612")
>>>
>>> Also, I'd like to mention that I have an edge proxy in the middle who
>>> proxies the REGISTER to this Registrar and I use the PATH module to route
>>> back reliably. I'm essentially trying to remove location entry for
>>> particular endpoints based on some conditions.
>>>
>>> Any help is appreciated. Thanks,
>>>
>>> - Jayesh
>>>
>>
>
> ___
> Users mailing 
> listUsers@lists.opensips.orghttp://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
> ___
> Users mailing list
> Users@lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] remove_hf doesn't seem to work in route[b2b_reply]

2015-11-17 Thread Louis Rochon
Bogdan,

Thank you for the detailed reply. Your test with remove_hf()+append_hf() 
confirms my observations.

And yes, my goal is to preserve the username part in B2B Contact, while 
retaining the top hiding function by substituting the host part - which it does 
already.

Any idea how to accomplish this?

Louis


From: Bogdan-Andrei Iancu [mailto:bog...@opensips.org]
Sent: Wednesday, October 28, 2015 12:09 PM
To: OpenSIPS users mailling list; Louis Rochon
Subject: Re: [OpenSIPS-Users] remove_hf doesn't seem to work in route[b2b_reply]

Hi Louis,

The b2b_reply route is invoked for int incoming reply. This reply is internally 
consumed and another one is generated on the other side of the B2B (basically 
there are two back 2 back transactions).

The new reply (on A side) is built based on information from the incoming reply 
(on B side) - considering that the original INVITE went from A to B.

So, any change you do on incoming rely will be discards because a new reply is 
to be built on the other side. Headers (as a whole) may propagate via 
"custom_headers" parameters. Otherwise, whatever append_hf() you do in 
b2b_reply will be lost (not translated to the other side).

Even more, the Contact has a special treatment as it is completely rebuilt by 
the B2B - old Contact hdr is discarded and a new one (pointing to B2B) is added 
in the outbound reply. So your changes over the incoming contact do conflict 
with the changed the B2B module does over the contact.

In my test, having "contact" in the "custom_headers" and doing 
remove_hf()+append_hf() on a contact on b2b_reply, results in two Contact 
headers :
- the one removed, added and carried via custom header (from the incoming 
reply)
- the one built and added internally by the B2B, pointing to it self

So, remove_hf() actually works, but you end up with that conflict in having you 
and the B2B changing both the Contact hdr.

As I understand, your goal is to preserve the username part in B2B right ?

Best regards,


Bogdan-Andrei Iancu

OpenSIPS Founder and Developer

http://www.opensips-solutions.com
On 15.10.2015 21:40, Louis Rochon wrote:
remove_hf doesn't seem to work in route[b2b_reply]Running OpenSIPS 1.11.5 
on CentOS 6.

This problem started when I discovered that b2b_init_requests removes the user 
part of the URI in the Contact: field.

To correct that, did a bit of scripting to correct the outgoing invite:

First, handle contacts manually:
modparam("b2b_logic", "custom_headers", 
"Priority;Calluid;Geolocation;Geolocation-Routing;Contact")

Second, check out the incoming INVITE, and modify the host part to be the 
OpenSIPs server itself (192.168.130.105):
$var(ContactURI)=$ct.fields(uri);
$var(ContactURIHost)=$(var(ContactURI){uri.host});
$var(ContactURIUser)=$(var(ContactURI){uri.user});
$var(regedit)="/"+$(var(ContactURIHost))+"/192.168.130.105/g";
$var(URIwSub)=$(var(ContactURI){re.subst,$var(regedit)});

Third, in local_route, remove the incoming contact and replace with my own:
remove_hf("Contact");
append_hf("Contact: $var(URIwSub)\r\n");

Fourth, send off the invite downstream (to 192.168.131.203):
b2b_init_request("FailOver", 
"sip:$tU@192.168.131.203");

All this works! Great, but the reply route, not:
route[b2b_reply] {
  xlog("b2b_reply Route ($ci)\n");
###Debug Code
xlog(">B2BRR:Protocol of received message: $pr\n");
xlog(">B2BRR:Body of request/reply: $rb\n");
xlog(">B2BRR:Return Code: $rc\n");
xlog(">B2BRR:Request Method: $rm\n");
xlog(">B2BRR:Reply Reason: $rr\n");
xlog(">B2BRR:Reply Status: $rs\n");
xlog(">B2BRR:Transport protocol of original R-URI: $oP\n");
xlog(">B2BRR:Transport protocol of R-URI: $rP\n");
xlog(">B2BRR:Transport protocol of destination uri: $dP\n");
xlog(">B2BRR:Destination set: $ds\n");
xlog(">B2BRR:Destination uri: $du\n");
xlog(">B2BRR:URI of From header: $fu\n");
xlog(">B2BRR:Domain in request's original R-URI: $od\n");
xlog(">B2BRR:Request's original URI: $ou\n");
xlog(">B2BRR:Username in request's original URI: $oU\n");
xlog(">B2BRR:Domain in URI of 'To' header: $td\n");
xlog(">B2BRR:Complete Request URI: $ru\n");
xlog(">B2BRR:Username in Request URI: $rU\n");
xlog(">B2BRR:Username in URI of 'To' header: $tU\n");
xlog(">B2BRR:Surname in URI of 'From' header : $fU\n");
xlog(">B2BRR:Contact name:$ct.fields(name)\n");
xlog(">B2BRR:Contact uri:$ct.fields(uri)\n");
xlog(">B2BRR:Contact q param:$ct.fields(q)\n");
xlog(">B2BRR:Contact expires:$ct.fields(expires)\n");
xlog(">B2BRR:Contact methods:$ct.fields(methods)\n");
xlog(">B2BRR:Contact params:$ct.fields(params)\n");

$var(ContactURIRR)=$ct.fields(uri);
$var(ContactURIHostRR)=$(var(ContactURIRR){uri.host});
$var(regeditRR)="/"+$(var(ContactURIHostRR))+"/192.168.130.105/g";
$var(URIwSubRR)=$(var(ContactURIRR){re.subst,$var(regeditRR)});
if(remove_hf("Contact"))
{
xlog(">B2BRR:removed Contact\n");
}