Thanks Daniel. I got it basically working with the following config. But there is one
last bug. If client B connected and registered, then disconnected without proper
unregister, it seems the location table didn't get prompt update. If client A sends
Invite right after that, the sip server will try to connect to B(which will surely fail
since B is behind the firewall), instead of sending 480 to A right away. Is there a way
to fix this?
Thanks.
JJ
if (is_method("REGISTER"))
{
# authenticate the REGISTER requests (uncomment to enable auth)
if (!www_authorize("", "subscriber"))
{
www_challenge("", "0");
exit;
}
if (!db_check_to())
{
sl_send_reply("403","Forbidden auth ID");
exit;
}
if (!save("location", "m"))
sl_reply_error();
exit;
}
if (!lookup("location")) {
#if (!registered("location")) {
sl_send_reply("480","Not Found");
exit;
}
if (!registered("location")) {
sl_send_reply("480","Not Found");
exit;
}
if(!t_relay()) {
sl_send_reply("500", "relaying failed");
}
exit;
From: Daniel-Constantin Mierla [mailto:miconda@gmail.com]
Sent: Wednesday, September 28, 2011 2:49 AM
To: SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) - Users Mailing List
Cc: JJ Zeng
Subject: Re: [SR-Users] simple question but can't find the answer
Hello,
On 9/28/11 2:43 AM, JJ Zeng wrote:
Hi,
I am really new to ser(just installed it today). My situation is here:
Both A and B make tcp connection to ser proxy server. If A sends "Invite" to B,
ser would look up the tcp connection of B, and relay the sip request. If B is not
connected, then 480 is returned to A. When B sends back the response, ser would relay it
to A.
It looks really simple, but I just can't figure out how to do it.
what default config file you started with?
Apart of that when the user is not online, the default config replies with 404 Not Found,
the relaying between phones when they are online is done there, being a combination of
calling function from registrar and tm modules. So, if you start with the default config,
no matter is Kamailio or SER flavour, routing of the calls between online users is
provided there, just go through it in order to understand better.
Cheers,
Daniel
--
Daniel-Constantin Mierla --
http://www.asipto.com
Kamailio Advanced Training, Oct 10-13, Berlin:
http://asipto.com/u/kat
http://linkedin.com/in/miconda --
http://twitter.com/miconda