Hi
all,
I have been
experimenting with Ser and b2bua, and a Grandstream Budge Tone 100 SIP
phone, although the same problem occurs for Cisco ATAs &
softphones.
When I try to make a
call, the call will succeed, but there are a number of issues at the
moment
- it takes a long
amount of time to connect, usually over 10 seconds. In some cases, it will
connect even when the caller has disconnected
- with b2bua in
between the Ser and the SIP gateway, the return code is 484 - Address
Incomplete
- without b2bua, the
return code is 408 - Request Timeout
- the Ser gets into a
loop when receiving an ACK.
I have a feeling
that these are all related, and could be down to the ser.cfg
file.
Below is the ser.cfg
file.
Any and all help
would be appreciated.
Regards,
Derek
#
------------------------- request routing logic
-------------------
# main routing
logic
route{
# Standard
max_forward_header checks...
# A REGISTER is when
a client attempts to register with a SIP
Server
if(method=="REGISTER")
{
if (!performRegistration("4ecalls.com"))
{
sl_send_reply("404", "Not
Found");
break;
};
save("location");
sl_send_reply("200", "OK");
};
# It is an attmept
to make a call
if(method=="INVITE")
{
sl_send_reply("100",
"Trying..");
log("Attempting to re-route call ...\n");
# native SIP destinations are handled using our USRLOC
DB
if
(!lookup("location"))
{
# If we get to here, we intend to re-route throgh a
PSTN
network
log("Lookup failed
...\n");
sl_send_reply("100",
"Trying..");
if
(performInvite("4ecalls.com"))
{
log("Am checking to see if it is in our domain...\n");
if(uri=~"^sip:0[0-9]*")
{
log("Am really attempting to re-route call \n");
rewritehostport("<SIP GATEWAY
IP>:5060");
forward(<SIP GATEWAY IP>, 5060);
# This should
forward to the B2BUA
server
#
rewritehostport("<b2bua
IP>:5065");
#
forward(<b2bua IP>,
5065);
#
log("Am done with that call ...\n");
# We may want to send a reply back here
to prevent the client from
# sending too many INVITE
requests
sl_send_reply("181", "Forwarding
call");
};
}
else
{
log("The call was not logged
...\n");
};
log("The call was redirected - hopefully
...\n");
}
# Set the accounting
flag - XXX do we actually need
this?
#
setflag(1);
};
# An ACK is when a
call is acknowlowdged to have
occured
if(method=="ACK")
{
setStartTimeActiveCall("");
sl_send_reply("200", "OK");
};
# A CANCEL is when a
call is cancelled in the middle of an
attempt
if(method=="CANCEL")
{
# Remove
the active
details...
removeActiveCall("");
};
# A BYE is for when
a call finishes, so what we would want to do here is to track these
#
messages, as these contain the info for the
billing
if(method=="BYE")
{
log("Found BYE message ...\n");
# This call here should slow down the
dispatching of
messages
t_reply("100", "Trying to bill...");
# This will process the message and do
all necessary work on it...
# In this case, we just want to perform the BYE
actions...
log("Checking to see if the destination is a SIP phone or not
...\n");
# This lookup is
here so we can determine if the call was to a SIP softphone or ATA
# If it
was a SIP Softphone or an ATA, then we won't need to bil, as this is over
IP
if
(!lookup("location"))
{
log("Destination is a PSTN number ...\n");
# This call will bill both the
provider and
customer
performBillingOperation("4ecalls.com");
}
};
# we
record-route all messages -- to make sure
that
# subsequent messages will go
through our proxy; that's
#
particularly good if upstream and downstream
entities
# use different transport
protocol
if(method=="INVITE")
{
record_route();
};
#
loose-route processing
if
(loose_route())
{
t_relay();
break;
};
# forward to
current uri now; use stateful forwarding;
that
# works reliably even if we
forward from TCP to UDP
if
(!t_relay())
{
sl_reply_error();
};
}