Hello,
I build three kamailioes, one acts as a pass-through proxy as well as load-balancing, the two registrars. The kamailio_1 decides to which registrar the REGISTER should forward by a dispatcher based on db_text.
----->kamailio_2(IP2, registrar) SoftPhone--->kamailio_1(IP1, pass-through proxy)--| | ----->kamailio_3(IP3, registrar) | dispatcher(db_text)
I expect the kamailio_1 forward the REGISTERs to kamailio_2/kamailio_3, and kamailio_2/kamailio_3 respond with 200 OK. But in fact, the registrars send the REGISTER back to kamailio_1.
I think the reason is that the host part of Request-URI in REGISTER from SoftPhone is IP1, and kamailio_1 does not rewrite it as a pass-through proxy, so kamailio_2/kamailio_3 will find the host in Request-URI is not mine, thus route the REGISTER back to kamailio_1 according Request-URI.
The setting of SoftPhone cannot be changed, so is it possible to : 1) replace host part of Request-URI in the REGISTERs with the result of dispatcher in kamailio_1 , or 2) force kamailio_2/kamailio_3 to respond rather than forward?
Thanks!
On Wed, May 31, 2017 at 04:06:44PM +0800, 刘鲲 wrote:
I expect the kamailio_1 forward the REGISTERs to kamailio_2/kamailio_3, and kamailio_2/kamailio_3 respond with 200 OK. But in fact, the registrars send the REGISTER back to kamailio_1.
I think the reason is that the host part of Request-URI in REGISTER from SoftPhone is IP1, and kamailio_1 does not rewrite it as a pass-through proxy, so kamailio_2/kamailio_3 will find the host in Request-URI is not mine, thus route the REGISTER back to kamailio_1 according Request-URI.
The setting of SoftPhone cannot be changed, so is it possible to :
- replace host part of Request-URI in the REGISTERs with the result
of dispatcher in kamailio_1 , or 2) force kamailio_2/kamailio_3 to respond rather than forward?
Ofcourse the answer is yes to both questions, kamailio can do anything :)
For the first one: $du contains the full URI, use the {uri.host} transformation to extract is and set $rd to it.
The second one: accept those domains as local by either (but not limited to) rewriting $rd to a local domain if the requests come from a trusted host or are a certain domain, adding them to local aliases, changing myself restrictions (sounds like a solution Alex posted just the day before yesterday to someone else having the same kind of question).
BTW take a look at the Path module, you'll find out that without it the registrar will send messages to the contact of the REGISTER and thus will try to contact them directly bypassing the proxy. With stateful NAT on the enduser part this will not work.