I try to fork a call to another user registered at the same proxy as the
caller. I figured out that the easiest method would be to use the
append_branch() function, something like
route[0] {
if (method=="REGISTER") { save("location"); exit; }
if (!lookup("location")) {
sl_send_reply("404", "Not Found");
exit;
}
# if someone calls test2@domain, fork call to test4@domain
# (test2 and test4 are both registered at domain)
if (avp_check("$rU", "eq/test2")) {
append_branch("sip:test4@127.0.0.1");
}
if (!t_relay()) {
sl_reply_error();
};
exit;
}
I know that this could also be achieved by adding permanent location
records, but I'd like to load the forking targets from a DB in the
future. So my first question would be if using
append_branch("sip:test4@127.0.0.1");
is the correct way to do parallel forking to a local user.
I'm asking because this method does not work for me as expected. It
seems that the two UAC state machines running on the same proxy host
that are involved in a forking call do somehow not work well together.
Forking the INVITE to both test2 and test4 works well, but when I pick
up test2 the call gets terminated after a few seconds. Further
investigations have revealed that canceling the second call leg does not
work correctly. There is a message flow diagram available at
http://www.unc.edu/~cschlatt/openser.html .
For some reason, the proxy process sending from 127.0.0.1 is
retransmitting the 487 "Request Terminated" although it receives ACKs
from the upstream proxy. And this causes the upstream proxy to send a
487 back to the caller (time 15.360), which then terminates the call
established between caller and test2.
And this only happens if I fork to the same proxy, if I use two proxy
hosts everything works fine (??).
Any advice is highly appreciated,
Christian