[OpenSIPS-Users] opensips+asterisk: signalling not working?
Stefano Sasso
stesasso at gmail.com
Wed Oct 6 11:11:54 CEST 2010
Hello folks,
here I am again :)
I have a setup where I use opensips as registration+proxy and
asterisk as media gateway.
When I place a call I can correctly hear the call audio (so RTP flow
is ok), and the callee can hear my voice too, but after 20 seconds the
call hangs up.
In the asterisk logs I found the following lines:
[Oct 6 10:29:54] WARNING[25602]: chan_sip.c:3778 retrans_pkt: Maximum
retries exceeded on transmission
NjZjMmI2MWRlYmY0YWYwMGVhYTAyNmE0NzU4OWU5YTk. for seqno 2 (Critical
Response) -- See doc/sip-retransmit.txt.
[Oct 6 10:29:54] WARNING[25602]: chan_sip.c:3805 retrans_pkt: Hanging
up call NjZjMmI2MWRlYmY0YWYwMGVhYTAyNmE0NzU4OWU5YTk. - no reply to our
critical packet (see doc/sip-retransmit.txt).
it seems that the signalling that pass through opensips does not work
correctly...
this is a part of my asterisk configuration:
rtpstart=10001
rtpend=15000
externip = 77.238.xx.yy
localnet=192.168.6.131/255.255.255.255
localnet=192.168.6.132/255.255.255.255
[ser_phones]
type=friend
context=from_inbound_ser
host=192.168.6.130
insecure=very
disallow=all
allow=gsm
opensips.cfg (relevant parts, not modules config.)
route{
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
exit;
}
if (has_totag()) {
# sequential request withing a dialog should
# take the path determined by record-routing
if (loose_route()) {
if (is_method("BYE")) {
setflag(1); # do accounting ...
setflag(3); # ... even if the transaction fails
} else if (is_method("INVITE")) {
# even if in most of the cases is useless, do RR for
# re-INVITEs alos, as some buggy clients do change route set
# during the dialog.
record_route();
}
# route it out to whatever destination was set by loose_route()
# in $du (destination URI).
route(1);
} else {
if ( is_method("ACK") ) {
if ( t_check_trans() ) {
# non loose-route, but stateful ACK; must be an ACK after
# a 487 or e.g. 404 from upstream server
t_relay();
exit;
} else {
# ACK without matching transaction ->
# ignore and discard
exit;
}
}
sl_send_reply("404","Not here");
}
exit;
}
#initial requests
# CANCEL processing
if (is_method("CANCEL"))
{
if (t_check_trans())
t_relay();
exit;
}
t_check_trans();
# authenticate if from local subscriber
if (!(method=="REGISTER") && is_from_local()) /*multidomain version*/
{
if (!proxy_authorize("", "subscriber")) {
proxy_challenge("", "0");
exit;
}
if (!db_check_from()) {
sl_send_reply("403","Forbidden auth ID");
exit;
}
consume_credentials();
# caller authenticated
xlog("[AUTH] PROXY for $fu ($si:$sp) OK");
}
# preloaded route checking
if (loose_route()) {
xlog("L_ERR",
"Attempt to route with preloaded Route's [$fu/$tu/$ru/$ci]");
if (!is_method("ACK"))
sl_send_reply("403","Preload Route denied");
exit;
}
# record routing
if (!is_method("REGISTER|MESSAGE"))
record_route();
# account only INVITEs
if (is_method("INVITE")) {
setflag(1); # do accounting
setflag(2); # for success or missed call
xlog("[SIP_INVITE] sip_from=$fu sip_to=$ru c_from=$fU c_to=$rU
client=$si:$sp call_id=$ci c_seq=$cs");
}
if (!is_uri_host_local())
{
append_hf("P-hint: outbound\r\n");
xlog("[OUTBOUND_NL] Routing message from $si");
route(1);
}
# requests for my domain
if (is_method("REGISTER"))
{
xlog("Enter REGISTER from $si:$sp");
# authenticate the REGISTER requests (uncomment to enable auth)
$var(auth_code) = www_authorize("", "subscriber");
if ( $var(auth_code) == -1 || $var(auth_code) == -2) {
xlog("[AUTH] ERROR for $fU@$fd from $si cause $var(auth_code)");
}
else
{
xlog("[AUTH] OK for $fU@$fd from $si port $sp auth_code=$var(auth_code)");
}
if ( $var(auth_code) < 0 )
{
www_challenge("", "0");
exit;
}
if (!db_check_to())
{
sl_send_reply("403","Forbidden auth ID");
exit;
}
if (!save("location"))
sl_reply_error();
exit;
}
if ($rU==NULL) {
# request with no Username in RURI
sl_send_reply("484","Address Incomplete");
exit;
}
xlog("Checking for ASTERISK HOOKS, rU=$rU");
### ASTERISK HOOK for demo 101 (echo test)
if ($rU=~"^101$") {
xlog("Entered Asterisk HOOK for 101");
if (!is_from_local()) {
send_reply("403", "Forbidden access to media service");
exit;
}
#rewritehostport("192.168.6.131:5060");
if (!load_balance("1", "vc")) {
xlog("LOAD_BALANCE Service is FULL");
sl_send_reply("500", "Service FULL");
exit;
}
else {
xlog("LOAD_BALANCE Sending CALL to $du\n");
}
t_relay();
exit;
}
### ASTERISK HOOK for external calling
if ($rU=~"^0[0-9]+") {
xlog("Entered Asterisk HOOK for 0*");
if (!is_from_local()) {
send_reply("403", "Forbidden access to media service");
exit;
}
#rewritehostport("192.168.6.131:5060");
if (!load_balance("1", "vc")) {
xlog("LOAD_BALANCE Service is FULL");
sl_send_reply("500", "Service FULL");
exit;
}
else {
xlog("LOAD_BALANCE Sending CALL to $du\n");
}
t_relay();
exit;
}
### ASTERISK HOOK end
# do lookup with method filtering
if (!lookup("location","m")) {
switch ($retcode) {
case -1:
case -3:
t_newtran();
t_reply("404", "Not Found");
exit;
case -2:
sl_send_reply("405", "Method Not Allowed");
exit;
}
}
# when routing via usrloc, log the missed calls also
setflag(2);
route(1);
}
route[1] {
if (!t_relay()) {
sl_reply_error();
};
exit;
}
the network configuration is the following (yes, there is a lot of nat
here, but I don't have other chances...)
opensips ip: 192.168.6.130
asterisk ip (2 boxes): 192.168.6.131, 192.168.6.132
77.238.xx.yy port 5060 DNAT to 192.168.6.130 port 5060
77.238.xx.yy port 10000-15000 DNAT to 192.168.6.131 port 10000-15000
77.238.xx.yy port 15001-20000 DNAT to 192.168.6.132 port 15001-20000
where am I wrong? :(
sorry for stupid questions, but it's the first time I have to create a
multi-box scenario...
could I resolve inserting in asterisk config.
externip = 77.238.xx.yy:5071
and having DNAT 77.238.xx.yy:5071 to 192.168.6.131:5060?
(different ports for box #1 and #2, obviously :) )
thanks!
PS sorry for my english
--
Stefano Sasso
http://stefano.dscnet.org/
More information about the Users
mailing list