# SIP Record-route problem

**URL:** <https://community.f5.com/t/sip-record-route-problem/10160>\
**Category:** Technical Forums\
**Tags:** availability, performance, tmsh, tmos, irules, devops, application-delivery\
**Created:** [August 20, 2015, 9:45am UTC](https://community.f5.com/t/sip-record-route-problem/10160 "2015-08-20T09:45:56Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Evelin\_195902](https://avatars.discourse-cdn.com/v4/letter/e/258eb7/32.png) [@Evelin\_195902](https://community.f5.com/u/Evelin_195902)\
**Post date:** [August 20, 2015, 9:45am UTC](https://community.f5.com/t/sip-record-route-problem/10160/1 "2015-08-20T09:45:56Z")

</div>

Hi guys, I would need your help regarding inserting Record-route header information in SIP profile. The scenario is as follows:

SIP agent → Virtual Server+SIP+SNAT Automap profile applied on LTM → SIP server as a pool member

In order to avoid direct communication between SIP agent and SIP server I got Record-route header insertion applied in my SIP profile. The thing is that record route inserts my Virtual server IP so any new request coming from SIP agent hit VIP and then get translated using Automap (source address of the IP request is LTM’s private IP) and hit SIP server, same for the replies. So far so go good, but when SIP server needs to initiate a SIP request (like OPTIONS, BYE, INFO) it uses the Record-route information (pointing to Public Virtual server IP, instead of the private LTM IP) and construct a ROUTE header and sends its request to public Virtual server address instead of the private LTM IP. This is making a loop as SIP server sends SIP requests to its VIP, hense itself. My question is how can I make SIP server to sends its SIP requests to the Automap private IP instead of to public Virtual server ip.

Thank you!

---

<div class="post-metadata">

**Author:** ![Amit\_Grover\_171](https://avatars.discourse-cdn.com/v4/letter/a/73ab20/32.png) [@Amit\_Grover\_171](https://community.f5.com/u/Amit_Grover_171)\
**Post date:** [August 21, 2015, 6:13am UTC](https://community.f5.com/t/sip-record-route-problem/10160/2 "2015-08-21T06:13:09Z")

</div>

Hi Evelin,

If you trying to use SIP profile to insert RR then for sure F5 LTM will add its VS address. To avoid it you can use following I-rule

if { [SIP::to] contains “[xyz.com](http://xyz.com)” } {

SIP::header remove “Route” SIP::header insert “Record-Route” “” }

}

/Regards Amit Grover

---

<div class="post-metadata">

**Author:** ![SyedNazir\_20946](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@SyedNazir\_20946](https://community.f5.com/u/SyedNazir_20946)\
**Post date:** [August 21, 2015, 6:36am UTC](https://community.f5.com/t/sip-record-route-problem/10160/3 "2015-08-21T06:36:35Z")

</div>

Hi Evelin,

```tcl
It is little tricky here as F5 has to act as a ALG. F5 has to update/insert the Record-Record header based on where the request/response is coming from.

  If the request/response is coming from Client without Record-Route header then F5 has to insert the header with SNAT IP. But if the header is already present with VIP as value then F5 has to update the value with SNAT IP.

  If the request/response is coming from SIP server without Record-Route header then F5 has to insert the header with VIP. But if the header is already present with value as SNAT IP then F5 has to update the value with VIP.

  To know whether SIP message is coming from Client or SIP server you can use clientside command.

  if { [clientside] } { Message from Client
       SIP::header insert "Record-Route" SNATIP
  } else { Message from Server
       SIP::header insert "Record-Route" VIP
  }

```

- Syed Nazir

---

<div class="post-metadata">

**Author:** ![Evelin\_195902](https://avatars.discourse-cdn.com/v4/letter/e/258eb7/32.png) [@Evelin\_195902](https://community.f5.com/u/Evelin_195902)\
**Post date:** [August 21, 2015, 9:01am UTC](https://community.f5.com/t/sip-record-route-problem/10160/4 "2015-08-21T09:01:44Z")

</div>

Thanks for the replies, guys. For now I’ve implemented a simple irule which strips the RR header info for requests being forwarded to SIP server and add RR for any SIP responses being sent from the SIP server to SIP agent. It looks like this:

when SIP\_REQUEST\_SEND { SIP::header remove “Record-Route” } when SIP\_RESPONSE\_SEND { SIP::header insert “Record-Route” “” }

It seems to be working fine for now. Our QAs are testing it. If it doesn’t work for some reason I’ll try with your suggestions.

Thanks again!

---

<div class="post-metadata">

**Author:** ![Godfrey\_Tan\_149](https://avatars.discourse-cdn.com/v4/letter/g/bbe5ce/32.png) [@Godfrey\_Tan\_149](https://community.f5.com/u/Godfrey_Tan_149)\
**Post date:** [August 21, 2015, 9:42am UTC](https://community.f5.com/t/sip-record-route-problem/10160/5 "2015-08-21T09:42:23Z")

</div>

You can set the default route on the SIP server (on the private VLAN) to use the Bigip private VLAN Self IP.

---

<div class="post-metadata">

**Author:** ![Evelin\_195902](https://avatars.discourse-cdn.com/v4/letter/e/258eb7/32.png) [@Evelin\_195902](https://community.f5.com/u/Evelin_195902)\
**Post date:** [September 17, 2015, 1:57pm UTC](https://community.f5.com/t/sip-record-route-problem/10160/6 "2015-09-17T13:57:32Z")

</div>

Thanks, Godfrey but I cannot change the default GW for the SIP servers to point to the LTM private VLAN Self IP.

The irule I’ve posted before seems to be working partially…

All the requests coming from SIP clients get translated and forwarded to the SIP server. Replies from SIP servers are going over the LTM Automap NAT IP and then get translated and hit the SIP client.

So far so good.

BUT when SIP server has to terminate the call by sending BYE REQUEST that request is being sent to the SIP phone IP instead of to the Automap Private IP. As we are bloking any traffic coming from Internet on port 5060 on our SIP servers the OK reply message never hit the SIP server.

Do you have any idea how I can make SIP server to send REQUEST messages to F5 Automap private IP instead of to the SIP agent directly?

Thank you!

regards, Evelin

---

<div class="post-metadata">

**Author:** ![satish\_txt\_2254](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@satish\_txt\_2254](https://community.f5.com/u/satish_txt_2254)\
**Post date:** [August 23, 2017, 3:24am UTC](https://community.f5.com/t/sip-record-route-problem/10160/7 "2017-08-23T03:24:11Z")

</div>

Any solution here because i am having same issue when

```tcl
SIP Server

```

terminate call and generate

```tcl
BYE

```

they BYE bouncing between F5 and SIP Server and after 10 tries it send 403 timeout. Any solution?

---

<div class="post-metadata">

**Author:** ![jjairos](https://avatars.discourse-cdn.com/v4/letter/j/a87d85/32.png) [@jjairos](https://community.f5.com/u/jjairos)\
**Post date:** [August 23, 2017, 4:44pm UTC](https://community.f5.com/t/sip-record-route-problem/10160/8 "2017-08-23T16:44:41Z")

</div>

Are you inserting a VIA header on the BIGIP? Having the BIGIP insert a VIA header will ensure the server uses the details in the VIA to send the BYE via the BIGIP instead of the UAC/phone directly.

If you are already inserting a VIA header on the BIGIP then open a ticket with F5 Support and provide a packet and a qkview taken after the packet capture.

Syntax for taking a packet capture will be like below assuming same port is used for vip and pool:

tcpdump -ni 0.0:nnn -s0 “((host( or ) and port )” -w /var/tmp/SIP.cap

---

<div class="post-metadata">

**Author:** ![jjairos\_43955](https://avatars.discourse-cdn.com/v4/letter/j/b77776/32.png) [@jjairos\_43955](https://community.f5.com/u/jjairos_43955)\
**Post date:** [August 23, 2017, 4:44pm UTC](https://community.f5.com/t/sip-record-route-problem/10160/9 "2017-08-23T16:44:41Z")

</div>

Are you inserting a VIA header on the BIGIP? Having the BIGIP insert a VIA header will ensure the server uses the details in the VIA to send the BYE via the BIGIP instead of the UAC/phone directly.

If you are already inserting a VIA header on the BIGIP then open a ticket with F5 Support and provide a packet and a qkview taken after the packet capture.

Syntax for taking a packet capture will be like below assuming same port is used for vip and pool:

tcpdump -ni 0.0:nnn -s0 “((host( or ) and port )” -w /var/tmp/SIP.cap

---

<div class="post-metadata">

**Author:** ![satish\_txt\_2254](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@satish\_txt\_2254](https://community.f5.com/u/satish_txt_2254)\
**Post date:** [August 23, 2017, 8:59pm UTC](https://community.f5.com/t/sip-record-route-problem/10160/10 "2017-08-23T20:59:24Z")

</div>

We are not inserting VIA header, should i insert VIA? if yes then what would be the option and setting?

we are just inserting

```tcl
Record-Route

```

header.

also i have created this iRule, reason i created iRule because i have notice my packet was bouncing between F5 and SIP server and adding many many record-route over and over and finally it was dying.

```tcl
when SIP_REQUEST_SEND {
     SIP::header remove "Route"
}

```

---

<div class="post-metadata">

**Author:** ![satish\_txt\_2254](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@satish\_txt\_2254](https://community.f5.com/u/satish_txt_2254)\
**Post date:** [August 23, 2017, 8:59pm UTC](https://community.f5.com/t/sip-record-route-problem/10160/11 "2017-08-23T20:59:24Z")

</div>

We are not inserting VIA header, should i insert VIA? if yes then what would be the option and setting?

we are just inserting

```tcl
Record-Route

```

header.

also i have created this iRule, reason i created iRule because i have notice my packet was bouncing between F5 and SIP server and adding many many record-route over and over and finally it was dying.

```tcl
when SIP_REQUEST_SEND {
     SIP::header remove "Route"
}

```

---

<div class="post-metadata">

**Author:** ![satish\_txt\_2254](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@satish\_txt\_2254](https://community.f5.com/u/satish_txt_2254)\
**Post date:** [August 28, 2017, 6:05pm UTC](https://community.f5.com/t/sip-record-route-problem/10160/12 "2017-08-28T18:05:05Z")

</div>

any update here?

---

<div class="post-metadata">

**Author:** ![satish\_txt\_2254](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@satish\_txt\_2254](https://community.f5.com/u/satish_txt_2254)\
**Post date:** [August 28, 2017, 6:05pm UTC](https://community.f5.com/t/sip-record-route-problem/10160/13 "2017-08-28T18:05:05Z")

</div>

any update here?
