Forum Discussion
Ken_Wong_48678
Sep 04, 2008Historic F5 Account
SIP via header modification
Hi,
my customers have a requirement to modify SIP via header, they want to insert the SIP client ip and port into the via header.
when CLIENT_ACCEPTED {
set ::clientip [IP::client_addr]
set ::clientport [UDP::remote_port]
}
when SIP_REQUEST_SEND {
SIP::header insert "Via" "[lindex [split [SIP::via 1] ";"] 0];received=$::clientip;rport=$::clientport;[lindex [split [SIP::via 1] ";"] 2]" 1
SIP::header remove "Via" 2
}
The above irule seems work but finally I find out the variable cannot be updated even another client ip connect to the virtual. I think it may be related to the variable but it cannot be retrieved in SIP_REQUEST_SEND event if I don't use global variable.
Is there any idea that I can get the client ip and port but don’t need to use global variable? Thanks!
Regards,
Ken
18 Replies
- hoolio
Cirrostratus
Hi Ken,Test whether a local variable from CLIENT_ACCEPTED is accessible from SIP_REQUEST_SEND when CLIENT_ACCEPTED { Save the client IP and port to local variables (specific to this connection only) set clientip [IP::client_addr] set clientport [UDP::remote_port] } when SIP_REQUEST_SEND { Test whether the local variable set in CLIENT_ACCEPTED is available in this event log local0. "\$clientip: $clientip, \$clientport: $clientport" SIP::header insert "Via" "[lindex [split [SIP::via 1] ";"] 0]received=$clientip;rport=$clientport;[lindex [split [SIP::via 1] ";"] 2]" 1 SIP::header remove "Via" 2 }
when SIP_REQUEST_SEND { log local0. "\[IP::client_addr\]:\[UDP::client_port\]: [IP::client_addr]:[UDP::client_port]" SIP::header insert "Via" "[lindex [split [SIP::via 1] ";"] 0]received=[IP::client_addr];rport=[UDP::client_port];[lindex [split [SIP::via 1] ";"] 2]" 1 SIP::header remove "Via" 2 }
- Ken_Wong_48678Historic F5 AccountHi Aaron,
- Nicolas_Menant
Employee
You have this error message even if you use this part :when SIP_REQUEST_SEND { log local0. "[IP::client_addr]:[UDP::client_port]: [IP::client_addr]:[UDP::client_port]" SIP::header insert "Via" "[lindex [split [SIP::via 1] ";"] 0]received=[IP::client_addr]rport=[UDP::client_port][lindex [split [SIP::via 1] ";"] 2]" 1 SIP::header remove "Via" 2 }
- hoolio
Cirrostratus
The local variable should be available in any event on the same TCP connection. Can you try testing with the following and open a case with F5 Support if the CLIENT_ACCEPTED event is triggered and you still see a TCL error in a subsequent event when trying to access the local variable?when CLIENT_ACCEPTED { set local_var "test" log local0. "[IP::client_addr]: \$local_var: $local_var" } when SIP_REQUEST_SEND { log local0. "[IP::client_addr]: \$local_var: $local_var" }
- Ken_Wong_48678Historic F5 Accountwhen SIP_REQUEST_SEND {
- Ken_Wong_48678Historic F5 AccountHi hoolio,
- hoolio
Cirrostratus
Ken, - Ken_Wong_48678Historic F5 Accountthe info shown below, thanks!
- Nicolas_Menant
Employee
i'm wondering if it may not be due to MBLB, what is your BIGIP version ken ? - Ken_Wong_48678Historic F5 AccountI think it is not related to MBLB, do you think I need to reset the variable after inserted the modified header? my testing version is already 9.4.5. thanks!
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects