[reSIProcate] Specifying actual sip server - different from resolved "To" URI
I have a question about the RFC3261
The RFC States:
>18.1.1 Sending Requests (7th paragraph states...)
>Before a request is sent, the client transport MUST insert a value of
>the "sent-by" field into the Via header field. This field contains
>an IP address or host name, and port.
If I were to set it to the host IP address (of the actual SIP server I'm
actually sending to), is this supposed to "override" the IP address
resolved from DNS lookup in the "To" field? I actually need
to override the DNS lookup of the URI in the To field, because
this would resolve to a different server.
IE: sip:john@xxxxxxxxxxxx would resolve to a web server at that
domain, and the SIP server is on a different machine.
If I were to set this "sent-by" field in the "Via" header, what
is the syntax... I think its....
regMessage.header(h_Via).sentHost() = "213.34.56.78"; <--- this is the
real SIP server.
regMessage.header(h_Via).sentPort() = 5060;
I would do this before sending the regMessage to register.
Or....
I also heard about the "maddr" parameter. Like when used like this....
sip:alice@xxxxxxxxxxx;maddr=239.255.255.1;ttl=15
IntegerParameter
================
RFC name:
Description:
Integer
Example:
sip:alice@xxxxxxxxxxx;maddr=239.255.255.1;ttl=15
Parts:
accessor reSIP type settable
------------------------------------------------
value() int yes
RFC parameters:
duration
expiration
expires
retry-after
ttl
How do I set the "maddr" in my "To" field? Assuming I have
a regMessage.header(h_To)....
Do I do it like this?
regMessage.header(h_To).Value = "maddr=239.255.255.1;ttl=15"
And will this be "added" to the To field or appended to
sip:alice@xxxxxxxxxxx?
Or do I have to include the full field value like this?
regMessage.header(h_To).Value =
"sip:alice@xxxxxxxxxxx;maddr=239.255.255.1;ttl=15"
Or do I do this?
Via& myVia(regMessage.header(h_Vias).front());
myVia.senthost() = "213.45.67.8";
I suppose I should test to see of the "Vias" exist first, right?
So I would do....
if (regMessage.header(h_Vias).Size()) > 0) {
Via& myVia(regMessage.header(h_Vias).front());
myVia.senthost() = "213.45.67.8"
}
Is this the proper use of syntax on this?
John