[reSIProcate] Implementing proxy server
Hello,
I have a working SIMPLE gateway (based on resip) that exchanges
SUBSCRIBE/NOTIFY with any compliant SIMPLE gateway. My SIMPLE gateways
connects directly to the foreign SIMPLE gateway and it works great.
Now I want to implement a "proxy" in between that will do load balancing
of incoming SIMPLE messages. I am currently working on the
SUBSCRIBE/NOTIFY.
My idea of how this can be done is that the proxy application will
receive the SUBSCRIBE from the remote gateway, coming up through the
resip stack. It will change the request URI to the IP address:port
number of one of the actual SIMPLE gateway instances (using round robin
or whatever method), and call send() on the SipMessage so that it will
be routed directly to that instance. This is not working. My experience
so far:
1) First resip was trying to find the tls transport corresponding to the
tls domain on the SipMessage object and did not find it (even tho it was
the domain associated with the tls transport on the proxy)
2) I tried calling setTlsDomain(Data("")) on the SipMessage so that
resip would use the default tls transport but that core dumps at
setTlsDomain (assignment operator of Data - memmove)
3) I tried setting transport=TCP on the request URI to make it use TCP
but that did not go through either.
Particularly: the proxy receives SUBSCRIBE bubba@xxxxxxxxxx and it
changed it to SUBSCRIBE bubba@xxxxxxxxxxx:8061;transport=TLS since one
of the actual gateway instances is listening on xx.yy.zz.qq port 8061
TLS.
This is the ONLY change I have done in the proxy application so far.
Here are my questions:
1) Is the proxy application code supposed to add/remove/modify any
headers (like Via, Record Route) for this use case to work?
2) Once I get past this hurdle, does the proxy need to send back 202 to
the SUBSCRIBE and then eat the 202 from the actual gateway instance, or
it just forwards the SUBSCRIBE to the gateway instance and then forwards
the 202 from the gateway instance in the other direction?
Any help/guidance/suggestions are welcome. What section of SIP RFC(s) do
I need to look up?
Thanks in advance
Sandeep