Forum Discussion
symtex_22198
Nimbostratus
Jul 23, 2009modify SIP contact header param
Hi,
we are using a location server which basically gets SIP invites from a SIP proxy then sends 302 redirect messages.
I have been trying to modify the IP address parameter in the Contact header which is in the 302 message. this IP address will vary, but I want to set it statically
the contact header will have a URI in the format of number xxxxxxxxxxxxx@172.24.103.10. since this is my first irule. I'm struggling.
here is what I've been trying with no success.
when SIP_RESPONSE {
set contact [ SIP::header Contact ]
set telephone 0
set bind 0
regexp {[0-9]{13}} $contact telephone
regexp {[0-9]{8}} $contact bind
SIP::header insert [format \"$bind\"
the header just returns a 0 or a 1... maybe I should try the -inline switch with regexp???
15 Replies
- symtex_22198
Nimbostratus
% scan {"16601003"} {%[^<]%[^@]@%[^:]:%s} a b c d
4
% puts "$a $b $c $d"
"16601003"
% puts "$b $c $d"
% - hoolio
Cirrostratus
Ha, you got it!
I was going to suggest something like this, but your version works fine too.
% scan {"16601003"} {"%[^"]"%[^@]@%[^:]:%s} ignore1 a ignore2 b
4
% puts "$ignore1 $a $ignore2 $b"
16601003
Aaron - symtex_22198
Nimbostratus
today I tried to modify my irule to insert the ip address of the client instead of the IP address being statically configured in the irule
I got the following error, this is strange I thought it would be supported:
Jan 7 14:05:17 tmm tmm[1995]: 01220001:3: TCL error: SIP_SG_Redirect - Error: No clientside connection established (line 20) invoked from within "IP::client_addr"
here is the irule as it is now:
when SIP_RESPONSE {
Check for 302 responses
if {[SIP::response code] == 302}{
Parse the Contact header value "16601003" using scan
% scan {"16601003"} {%[^<]%[^@]@%[^:]:%s} a b c d
4
% puts "$a $b $c $d"
"16601003"
if {[scan [SIP::header value "Contact"] {%[^<]%[^@]@%[^:]:%s} a b c d] == 4}{
parsed 4 strings into a b c d
log local0. "Parsed [SIP::header value "Contact"] into $a, $b, $c $d"
Remove existing Contact header
SIP::header remove "Contact"
Insert new Contact header with 172.24.106.70 set as a static IP address
On January 07 2010 I modified the script to enter the client source IP address instead
of statically setting the SIP server's IP address
SIP::header insert "Contact" "${b}@[IP::client_addr]>"
log local0. "Inserting new Contact header: ${b}@[IP::client_addr]>"
}
}
} - hoolio
Cirrostratus
I'm not sure what the request/response flow is for your scenario. But you could try saving the client IP in SIP_REQUEST and then use the variable instead of IP::client_addr in SIP_RESPONSE.
Aaron - symtex_22198
Nimbostratus
Aaron,
I was thinking about doing exactly that, but since the documentation states that IP::client_addr is supported under the SIP_RESPONSE. I wanted to ask to make sure I wasn't missing something.
the request, response flow is simple. We have a SIP proxy that forwards all INVITES it receives to a REDIRECT server. We are using LTM to load balance those redirect servers. We initially started with one SIP proxy as a client but there will be more, hence the necessity to use IP::client_addr instead of the IP addr of that one SIP proxy.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
