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 paramet...
hoolio
Cirrostratus
Jul 23, 2009Here is what I was thinking might work. I tested the scan command, but not the iRule.
when SIP_RESPONSE {
Check for 302 responses
if {[SIP::response code] == 302}{
Parse the Contact header value "16601003" using scan
http://www.tcl.tk/man/tcl8.4/TclCmd/scan.htm
start reading everything not a @ into 'a'
then read everything not a : into 'b'
finally read the rest into 'c'
Example using tclsh:
% scan {"16601003"} {%[^@]@%[^:]:%s} a b c
3
% puts "$a $b $c"
"16601003"
if {[scan [SIP::header value "Contact"] {%[^@]@%[^:]:%s} a b c] == 3}{
We parsed three strings into a b c
log local0. "Parsed [SIP::header value "Contact"] into $a, $b, $c"
Remove existing Contact header
SIP::header remove "Contact"
Insert new Contact header with 1.1.1.1 set as a static IP address
SIP::header insert "Contact" "${a}@1.1.1.1:${c}"
log local0. "Inserting new Contact header: ${a}@1.1.1.1:${c}"
}
}
}
Aaron
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
