Hi Ken,
If you change the variables to local (remove the :: in the var name), does the rule work? Or are you saying that the local variable value set in CLIENT_ACCEPTED isn't available in SIP_REQUEST_SEND?
Also, I think IP::client_addr and UDP::client_port should work in any context (client or serverside event). So I don't think you should have to save any variables in CLIENT_ACCEPTED if you're only tring to get the client IP address and port.
Finally, if you do want to retrieve other clientside values in SIP_REQUEST_SEND, you can do so using 'clientside {COMMAND}'.
Click here for more info on the SIP_REQUEST_SEND event and
Click here for the clientside command.
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
}
Aaron