How can I avoid relay wiht this block
Harry
--- Zeus Ng <zeus.ng(a)isquare.com.au> a écrit :
> Harry,
>
> You are detecting nat only within this block.
>
> if (!is_uri_host_local() || !is_from_local() ) {
> nat detection ...
> }
>
> This means any request that is not originate from
> our domain or not for our
> domain, detect nat. Now, when someone outside send
> an INVITE to you, it will
> pass this block, no nat detection, as it is for your
> domain. Besides, you
> are setting up a open relay. Anyone can use your
> server to call someone
> else.
>
> We usually send a 404 response within that block.
>
> I suggest you move the nat detection to the very
> beginning, just after
> checking max forward and message size.
>
> Zeus
>
> -----Original Message-----
> From: harry gaillac [mailto:gaillacharry@yahoo.fr]
> Sent: Friday, 9 September 2005 6:47 PM
> To: Zeus Ng
> Subject: RE: [Serusers] RFC3621
>
>
> Hello,
>
> Thanks for reply.
> here are my ser.cfg and two ethereal files .
>
> You can see I use the latest mediaproxy (1.4.2)
>
> look at internal_sip_call file line 15-18 the
> callee
> send the public ip in SDP in reply.
>
> Look at incoming_call file line 9-10 the calle send
> its private ip in SDP in reply.
>
> This is my problem !!
>
> Regards
> Harry
>
> > Nothing is wrong with the reply. SER just forwards
> > what the UA report its
> > IP.
> >
> > I guest you are using a dual home server to run
> SER
> > and does not have
> > routing logic to handle internal/external RTP
> > communication. You need to
> > bridge the RTP with either rtpproxy or mediaproxy.
> I
> > know the theory but
> > haven't tried myself. The rtpproxy has some
> example
> > config for you to start.
> >
>
>
>
>
>
>
>
___________________________________________________________________________
>
> Appel audio GRATUIT partout dans le monde avec le
> nouveau Yahoo! Messenger
> Téléchargez cette version sur
> http://fr.messenger.yahoo.com
>
___________________________________________________________________________
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger
Téléchargez cette version sur http://fr.messenger.yahoo.com
Guys,
I was able to figure out why I was getting occasional sl_send_reply errors
with some ACK messages. I don't know if this is something that needs to
be corrected at a deeper level, but I'll give you the rundown:
1. UA Makes a call to a bad number
2. Bad number is actually valid so it gets routed to the GW
3. GW responds 404
4. ACK loop occurs.
When the ACK loop happens, SIP captures reveal the following (watch the
Max-Forwards):
#1
..
Max-Forwards: 9
Record-Route: <sip:ser;ftag=0014a934057d001145ed0fa2-6f6f2e8e;lr=on>
Via: SIP/2.0/UDP ser;branch=0
Via: SIP/2.0/UDP 192.168.249.83:5060;received=otherip;branch=z9hG4bK140d833e
..
#2
..
Record-Route: <sip:ser;ftag=0014a934057d001145ed0fa2-6f6f2e8e;lr=on>
Max-Forwards: 8
Record-Route: <sip:ser;ftag=0014a934057d001145ed0fa2-6f6f2e8e;lr=on>
Via: SIP/2.0/UDP ser;branch=0
Via: SIP/2.0/UDP ser;branch=0
Via: SIP/2.0/UDP
192.168.249.83:5060;received=otherip;branch=z9hG4bK140d833e
..
Etc. etc. until Max Forwards counts down to 0, at which point:
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483", "Too Many Hops");
break;
};
And naturally:
sl_send_reply: I won't send a reply for ACK!!
So, I've obviously been able to avoid this by changing to:
if (!mf_process_maxfwd_header("10")) {
if (method!="ACK") {
sl_send_reply("483", "Too Many Hops");
};
break;
};
Now, the greater question: is the ACK loop being generated by a defective
message. If so, is it anything to worry about? And in either case is
putting the method check in there a valid solution?
Can anyone advise?
Thanks,
-Corey
*********************************************
This message has been scanned for viruses and
dangerous content, and is believed to be clean.
Guys,
First, thanks again to those who have offered advice. I have re-started
building from the ONsip.org rtpproxy example config and have everything
working properly except one thing.
In the interest of being thorough, I kept a log of what I changed and why:
- Tested REGISTER, works OK.
- Calls between UAs initially failed when proxy_authorize in route[3] was
called. Disabled proxy_authorize checks. Works OK. (Need to revisit
this one for security. Can anyone point out the problem?)
- Implemented failure_route for voicemail on timeout. Timeout calls from
UAs work fine to VM via Asterisk.
- Implemented 7 digit dial perl script and added second lookup. No
problems. Added NPANXX route lookup script in route[3]. No problems.
- Implemented "Your call cannot be completed as dialed" via Asterisk
server by replacing sl_send_reply 404 in route[3] with route(7). No
problems.
- Initially was unable to dial voicemail access number from UA. It would
connect to Asterisk server but not have audio. Call would drop. Fixed
by adding this to route[1]:
# NAT Fix
if (method=="INVITE" && nat_uac_test("19")) {
force_rport();
fix_nated_contact();
force_rtp_proxy();
};
- Voicemail access is now OK.
- UA timeout calls to voicemail now fail. Debug on Asterisk looks like
the contact is being fixed twice. Added flag(9) to make sure NAT fix
only happens once. UA timeout calls now go to voicemail properly.
- I notice a lot of "Warning: sl_send_reply: I won't send a reply for
ACK!!" but don't know if this is significant or not. From what I've
read it sounds like ACKs are getting an sl_reply rather than being
t_relayed but I didn't really modify anything related ... ?
Now, the biggest problem seems to be calls coming from the inbound SIP
gateway aren't being handled properly on timeout. (Calls from the inbound
SIP gateway work fine to UAs.) This very well may be the fault of the
other equipment, but it's nothing we can debug directly so I want to make
sure there's nothing else wrong.
Keep in mind, the inbound SIP gateway CAN communicate with the Asterisk
server by dialing a DID that is directed to voicemail. I thought it might
be some kind of routing problem between those boxes, but this would seem
to disprove that.
I'm going to include the abbreviated ngrep dump from the SER machine and
then the ser.cfg file.
Thanks again for the help thus far and in advance for any assistance on
this.
-Corey
Here is an IP legend:
xxx.xxx.xxx.7 - Inbound SIP Gateway
xxx.xxx.xxx.36 - SER Server
xxx.xxx.xxx.80 - Asterisk Server
216.xxx.ua.207 - NATed UA public IP
** NGREP DUMP FROM SER SERVER
#
U xxx.xxx.xxx.7:5060 -> xxx.xxx.xxx.36:5060
INVITE sip:5414362504@xxx.xxx.xxx.36:5060 SIP/2.0..Via: SIP/2.0/UDP xxx.xxx.xxx.7:5060;branch=z9hG4bK-00101-Xvn755Ml3U1j41B
#
U xxx.xxx.xxx.36:5060 -> xxx.xxx.xxx.7:5060
SIP/2.0 100 trying -- your call is important to us..Via: SIP/2.0/UDP xxx.xxx.xxx.7:5060;branch=z9hG4bK-00101-Xvn755Ml3U1j41
#
U xxx.xxx.xxx.36:5060 -> 216.xxx.ua.207:7565
INVITE sip:5414362504@216.xxx.ua.207:5060 SIP/2.0..Record-Route: <sip:xxx.xxx.xxx.36;ftag=Xvn755Ml3U1j41B-IPTrunk-67-17-23at
#
U 216.xxx.ua.207:7565 -> xxx.xxx.xxx.36:5060
SIP/2.0 100 Trying..Via: SIP/2.0/UDP xxx.xxx.xxx.36;branch=z9hG4bKe432.bd7822d3.0,SIP/2.0/UDP xxx.xxx.xxx.7:5060;rport=5060
#
U 216.xxx.ua.207:7565 -> xxx.xxx.xxx.36:5060
SIP/2.0 180 Ringing..Via: SIP/2.0/UDP xxx.xxx.xxx.36;branch=z9hG4bKe432.bd7822d3.0,SIP/2.0/UDP xxx.xxx.xxx.7:5060;rport=506
#
U xxx.xxx.xxx.36:5060 -> xxx.xxx.xxx.7:5060
SIP/2.0 180 Ringing..Via: SIP/2.0/UDP xxx.xxx.xxx.7:5060;rport=5060;branch=z9hG4bK-00101-Xvn755Ml3U1j41B-0..From: sip:61087
#
# *** Call is diverted to Asterisk server here.
#
U xxx.xxx.xxx.36:5060 -> xxx.xxx.xxx.80:5060
INVITE sip:5414362504@xxx.xxx.xxx.80:5060 SIP/2.0..Record-Route: <sip:xxx.xxx.xxx.36;ftag=Xvn755Ml3U1j41B-IPTrunk-67-17-23a
#
U xxx.xxx.xxx.36:5060 -> 216.xxx.ua.207:7565
CANCEL sip:5414362504@216.xxx.ua.207:5060 SIP/2.0..Via: SIP/2.0/UDP xxx.xxx.xxx.36;branch=z9hG4bKe432.bd7822d3.0..From: sip:
#
U xxx.xxx.xxx.80:5060 -> xxx.xxx.xxx.36:5060
SIP/2.0 100 Trying..Via: SIP/2.0/UDP xxx.xxx.xxx.36;branch=z9hG4bKe432.bd7822d3.1..Via: SIP/2.0/UDP xxx.xxx.xxx.7:5060;bran
#
U 216.xxx.ua.207:7565 -> xxx.xxx.xxx.36:5060
SIP/2.0 200 OK..Via: SIP/2.0/UDP xxx.xxx.xxx.36;branch=z9hG4bKe432.bd7822d3.0..From: sip:6108712381@xxx.xxx.xxx.7:5060;tag=
#
U 216.xxx.ua.207:7565 -> xxx.xxx.xxx.36:5060
SIP/2.0 487 Request Cancelled..Via: SIP/2.0/UDP xxx.xxx.xxx.36;branch=z9hG4bKe432.bd7822d3.0,SIP/2.0/UDP xxx.xxx.xxx.7:5060
#
U xxx.xxx.xxx.36:5060 -> 216.xxx.ua.207:7565
ACK sip:5414362504@216.xxx.ua.207:5060 SIP/2.0..Via: SIP/2.0/UDP xxx.xxx.xxx.36;branch=z9hG4bKe432.bd7822d3.0..From: sip:610
#
U xxx.xxx.xxx.36:5060 -> 216.xxx.ua.207:5060
....
#
U xxx.xxx.xxx.36:5060 -> 216.xxx.ua.207:7565
....
#
U xxx.xxx.xxx.80:5060 -> xxx.xxx.xxx.36:5060
SIP/2.0 200 OK..Via: SIP/2.0/UDP xxx.xxx.xxx.36;branch=z9hG4bKe432.bd7822d3.1..Via: SIP/2.0/UDP xxx.xxx.xxx.7:5060;branch=z
#
U xxx.xxx.xxx.36:5060 -> xxx.xxx.xxx.7:5060
SIP/2.0 200 OK..Via: SIP/2.0/UDP xxx.xxx.xxx.7:5060;branch=z9hG4bK-00101-Xvn755Ml3U1j41B-0..Record-Route: <sip:209.216.160.
#
U xxx.xxx.xxx.80:5060 -> xxx.xxx.xxx.36:5060
SIP/2.0 200 OK..Via: SIP/2.0/UDP xxx.xxx.xxx.36;branch=z9hG4bKe432.bd7822d3.1..Via: SIP/2.0/UDP xxx.xxx.xxx.7:5060;branch=z
#
U xxx.xxx.xxx.36:5060 -> xxx.xxx.xxx.7:5060
SIP/2.0 200 OK..Via: SIP/2.0/UDP xxx.xxx.xxx.7:5060;branch=z9hG4bK-00101-Xvn755Ml3U1j41B-0..Record-Route: <sip:209.216.160.
#
# Several OKs seem to be going through here...
U xxx.xxx.xxx.80:5060 -> xxx.xxx.xxx.36:5060
SIP/2.0 200 OK..Via: SIP/2.0/UDP xxx.xxx.xxx.36;branch=z9hG4bKe432.bd7822d3.1..Via: SIP/2.0/UDP xxx.xxx.xxx.7:5060;branch=z
#
U xxx.xxx.xxx.36:5060 -> xxx.xxx.xxx.7:5060
SIP/2.0 200 OK..Via: SIP/2.0/UDP xxx.xxx.xxx.7:5060;branch=z9hG4bK-00101-Xvn755Ml3U1j41B-0..Record-Route: <sip:209.216.160.
#
U xxx.xxx.xxx.80:5060 -> xxx.xxx.xxx.36:5060
SIP/2.0 200 OK..Via: SIP/2.0/UDP xxx.xxx.xxx.36;branch=z9hG4bKe432.bd7822d3.1..Via: SIP/2.0/UDP xxx.xxx.xxx.7:5060;branch=z
#
U xxx.xxx.xxx.36:5060 -> xxx.xxx.xxx.7:5060
SIP/2.0 200 OK..Via: SIP/2.0/UDP xxx.xxx.xxx.7:5060;branch=z9hG4bK-00101-Xvn755Ml3U1j41B-0..Record-Route: <sip:209.216.160.
#
# Call is dropped by now.
** Asterisk console sip debug
<-- SIP read from xxx.xxx.xxx.36:5060:
INVITE sip:5414362504@xxx.xxx.xxx.80:5060 SIP/2.0
Record-Route: <sip:xxx.xxx.xxx.36;ftag=AJn351hl3U1H58O-IPTrunk-70-17-23atxxx.xxx.xxx.7;lr=on>
Via: SIP/2.0/UDP xxx.xxx.xxx.36;branch=z9hG4bKef17.c97ef7d2.1
Via: SIP/2.0/UDP xxx.xxx.xxx.7:5060;rport=5060;branch=z9hG4bK-00101-AJn351hl3U1H58O-0
Max-Forwards: 5
From: sip:6108712381@xxx.xxx.xxx.7:5060;tag=AJn351hl3U1H58O-IPTrunk-70-17-23atxxx.xxx.xxx.7
To: sip:5414362504@xxx.xxx.xxx.36:5060
Call-ID: AJn351hl3U1H58O(a)xxx.xxx.xxx.7
CSeq: 101 INVITE
Remote-Party-Id: <sip:6108712381@xxx.xxx.xxx.7:5060>;party=calling;privacy=off;id-type=subscriber
Expires: 180
Allow: INVITE,CANCEL,BYE,ACK
Contact: sip:xxx.xxx.xxx.7:5060
User-Agent: Tekelec-7000/r4.0
Content-Type: application/sdp
Content-Length: 149
P-hint: OFFLINE VOICEMAIL
v=0
o=- 1 1 IN IP4 xxx.xxx.xxx.7
s=
c=IN IP4 xxx.xxx.xxx.36
t=0 0
m=audio 35842 RTP/AVP 0
a=ptime:20
a=rtpmap:0 PCMU/8000
a=nortpproxy:yes
--- (17 headers 9 lines)---
Using INVITE request as basis request - AJn351hl3U1H58O(a)xxx.xxx.xxx.7
Sending to xxx.xxx.xxx.36 : 5060 (non-NAT)
Found no matching peer or user for 'xxx.xxx.xxx.36:5060'
Found RTP audio format 0
Peer audio RTP is at port xxx.xxx.xxx.36:35842
Found description format PCMU
Capabilities: us - 0x40e (gsm|ulaw|alaw|ilbc), peer - audio=0x4 (ulaw)/video=0x0 (nothing), combined - 0x4 (ulaw)
Non-codec capabilities: us - 0x1 (telephone-event), peer - 0x0 (nothing), combined - 0x0 (nothing)
Looking for 5414362504 in sip
list_route: hop: <sip:xxx.xxx.xxx.36;ftag=AJn351hl3U1H58O-IPTrunk-70-17-23atxxx.xxx.xxx.7;lr=on>
list_route: hop: <sip:xxx.xxx.xxx.7:5060>
Transmitting (no NAT) to xxx.xxx.xxx.36:5060:
SIP/2.0 100 Trying
Via: SIP/2.0/UDP xxx.xxx.xxx.36;branch=z9hG4bKef17.c97ef7d2.1
Via: SIP/2.0/UDP xxx.xxx.xxx.7:5060;branch=z9hG4bK-00101-AJn351hl3U1H58O-0
From: sip:6108712381@xxx.xxx.xxx.7:5060;tag=AJn351hl3U1H58O-IPTrunk-70-17-23atxxx.xxx.xxx.7
To: sip:5414362504@xxx.xxx.xxx.36:5060
all-ID: AJn351hl3U1H58O(a)xxx.xxx.xxx.7
CSeq: 101 INVITE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY
Contact: <sip:5414362504@xxx.xxx.xxx.80>
Content-Length: 0
---
-- Executing Wait("SIP/5060-b7d05f68", "1") in new stack
-- Executing VoiceMail("SIP/5060-b7d05f68", "5414362504@sip") in new stack
We're at xxx.xxx.xxx.80 port 14018
Answering with preferred capability 0x4 (ulaw)
Answering with preferred capability 0x2 (gsm)
Answering with preferred capability 0x8 (alaw)
Answering with preferred capability 0x400 (ilbc)
Reliably Transmitting (no NAT) to xxx.xxx.xxx.36:5060:
SIP/2.0 200 OK
Via: SIP/2.0/UDP xxx.xxx.xxx.36;branch=z9hG4bKef17.c97ef7d2.1
Via: SIP/2.0/UDP xxx.xxx.xxx.7:5060;branch=z9hG4bK-00101-AJn351hl3U1H58O-0
Record-Route: <sip:xxx.xxx.xxx.36;ftag=AJn351hl3U1H58O-IPTrunk-70-17-23atxxx.xxx.xxx.7;lr=on>
From: sip:6108712381@xxx.xxx.xxx.7:5060;tag=AJn351hl3U1H58O-IPTrunk-70-17-23atxxx.xxx.xxx.7
To: sip:5414362504@xxx.xxx.xxx.36:5060;tag=as4c6bfaee
Call-ID: AJn351hl3U1H58O(a)xxx.xxx.xxx.7
CSeq: 101 INVITE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY
Contact: <sip:5414362504@xxx.xxx.xxx.80>
Content-Type: application/sdp
Content-Length: 237
v=0
o=root 29275 29275 IN IP4 xxx.xxx.xxx.80
s=session
c=IN IP4 xxx.xxx.xxx.80
t=0 0
m=audio 14018 RTP/AVP 0 3 8 97
a=rtpmap:0 PCMU/8000
a=rtpmap:3 GSM/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:97 iLBC/8000
a=silenceSupp:off - - - -
---
-- Playing 'vm-intro' (language 'en')
Retransmitting #1 (no NAT) to xxx.xxx.xxx.36:5060:
SIP/2.0 200 OK
Via: SIP/2.0/UDP xxx.xxx.xxx.36;branch=z9hG4bKef17.c97ef7d2.1
Via: SIP/2.0/UDP xxx.xxx.xxx.7:5060;branch=z9hG4bK-00101-AJn351hl3U1H58O-0
Record-Route: <sip:xxx.xxx.xxx.36;ftag=AJn351hl3U1H58O-IPTrunk-70-17-23atxxx.xxx.xxx.7;lr=on>
From: sip:6108712381@xxx.xxx.xxx.7:5060;tag=AJn351hl3U1H58O-IPTrunk-70-17-23atxxx.xxx.xxx.7
To: sip:5414362504@xxx.xxx.xxx.36:5060;tag=as4c6bfaee
Call-ID: AJn351hl3U1H58O(a)xxx.xxx.xxx.7
CSeq: 101 INVITE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY
Contact: <sip:5414362504@xxx.xxx.xxx.80>
Content-Type: application/sdp
Content-Length: 237
v=0
o=root 29275 29275 IN IP4 xxx.xxx.xxx.80
s=session
c=IN IP4 xxx.xxx.xxx.80
t=0 0
m=audio 14018 RTP/AVP 0 3 8 97
a=rtpmap:0 PCMU/8000
a=rtpmap:3 GSM/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:97 iLBC/8000
a=silenceSupp:off - - - -
---
** ser.cfg
# whatever.net - SER Configuration File
#
debug=3
fork=yes
log_stderror=yes
listen=xxx.xxx.xxx.36
port=5060
children=4
alias=whatever.netalias=hostname.whatever.net
dns=no
rev_dns=no
fifo="/tmp/ser_fifo"
fifo_db_url="mysql://ser:serpass@localhost/ser"
# Modules
loadmodule "/usr/local/lib/ser/modules/mysql.so"
loadmodule "/usr/local/lib/ser/modules/sl.so"
loadmodule "/usr/local/lib/ser/modules/tm.so"
loadmodule "/usr/local/lib/ser/modules/rr.so"
loadmodule "/usr/local/lib/ser/modules/maxfwd.so"
loadmodule "/usr/local/lib/ser/modules/usrloc.so"
loadmodule "/usr/local/lib/ser/modules/registrar.so"
loadmodule "/usr/local/lib/ser/modules/auth.so"
loadmodule "/usr/local/lib/ser/modules/auth_db.so"
loadmodule "/usr/local/lib/ser/modules/nathelper.so"
loadmodule "/usr/local/lib/ser/modules/textops.so"
loadmodule "/usr/local/lib/ser/modules/uri_db.so"
loadmodule "/usr/local/lib/ser/modules/uri.so"
loadmodule "/usr/local/lib/ser/modules/xlog.so"
loadmodule "/usr/local/lib/ser/modules/options.so"
loadmodule "/usr/local/lib/ser/modules/exec.so"
modparam("auth_db|uri_db|usrloc|permissions", "db_url", "mysql://ser:serpass@localhost/ser")
modparam("auth_db", "calculate_ha1", 1)
modparam("auth_db", "password_column", "password")
modparam("nathelper", "natping_interval", 30)
modparam("nathelper", "ping_nated_only", 1)
modparam("nathelper", "rtpproxy_sock", "unix:/var/run/rtpproxy.sock")
modparam("usrloc", "db_mode", 2)
modparam("registrar", "nat_flag", 6)
modparam("rr", "enable_full_lr", 1)
modparam("tm", "fr_inv_timer", 20)
modparam("tm", "fr_timer", 20)
#
# Route Section
#
route {
# Basic Checks
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483", "Too Many Hops");
break;
};
if (msg:len > max_len) {
sl_send_reply("513", "Message Overflow");
break;
};
##
# Record Route Section
##
if (method!="REGISTER") {
record_route();
};
if (method=="BYE" || method=="CANCEL") {
unforce_rtp_proxy();
}
##
# Loose Route Section
##
if (loose_route()) {
if (has_totag() && (method=="INVITE" || method=="ACK")) {
if (nat_uac_test("19")) {
setflag(6);
force_rport();
fix_nated_contact();
};
force_rtp_proxy("l");
};
route(1);
break;
};
##
# Message Processing Section
##
if (uri!=myself) {
route(1);
break;
};
if (uri==myself) {
if (method=="CANCEL") {
route(3);
break;
} else if (method=="INVITE") {
route(3);
break;
} else if (method=="REGISTER") {
route(2);
break;
} else if (method=="NOTIFY") {
sl_send_reply("200", "Shut up.");
break;
} else if (method=="OPTIONS" && (! uri=~"sip:.*[@]+.*")) {
options_reply();
break;
};
lookup("aliases");
if (uri!=myself) {
route(1);
break;
};
if (!lookup("location") && method!="ACK") {
sl_send_reply("404", "User Not Found");
break;
};
};
route(1);
}
route[1] {
# -----------------------------------------------------------------
# Default Message Handler
# -----------------------------------------------------------------
# NAT Fix
if (method=="INVITE" && nat_uac_test("19") && !isflagset(9)) {
xlog("L_ERR", "Fixing NAT on INVITE for %ct.\n");
force_rport();
fix_nated_contact();
force_rtp_proxy();
setflag(9);
};
t_on_reply("1");
if (!t_relay()) {
if (method=="INVITE" && isflagset(6)) {
unforce_rtp_proxy();
};
sl_reply_error();
};
}
route[2] {
# -----------------------------------------------------------------
# REGISTER Message Handler
# ----------------------------------------------------------------
if (!search("^Contact:\ +\*") && nat_uac_test("19")) {
setflag(6);
fix_nated_register();
force_rport();
};
sl_send_reply("100", "Trying");
if (!www_authorize("whatever.net","subscriber")) {
www_challenge("whatever.net","0");
break;
};
if (!check_to()) {
sl_send_reply("401", "Unauthorized");
break;
};
consume_credentials();
if (!save("location")) {
sl_reply_error();
};
}
route[3] {
# -----------------------------------------------------------------
# CANCEL and INVITE Message Handler
# -----------------------------------------------------------------
if (nat_uac_test("19")) {
setflag(6);
}
lookup("aliases");
if (uri!=myself) {
route(1);
break;
};
if (!lookup("location")) {
if (uri=~"^sip:911@") { # Pass 911 calls first
route(5);
break;
};
if (uri=~"^sip:[0-9]{7}@") { # EXPAND 7-DIGIT CALL
exec_dset("/root/7digit.pl");
};
# Try location lookup again
if (!lookup("location")) {
if (uri=~"^sip:[0-9]{10}@") {
# DB Lookup of NPANXX route
exec_dset("/root/npa_nxx.pl");
route(1);
break;
};
if (uri=~"^sip:[0-9]{11}@") {
# DB Lookup of NPANXX route
strip(1);
exec_dset("/root/npa_nxx.pl");
route(1);
break;
};
if (uri=~"^sip:555@") { # Voicemail Access
route(6);
break;
};
if (uri=~"^sip:556@") { # Voicemail Access
route(6);
break;
};
# Call error message
route(7);
# sl_send_reply("404", "User Not Found");
break;
};
};
# if (!proxy_authorize("whatever.net","subscriber")) {
# proxy_challenge("whatever.net","0");
# break;
# } else if (!check_from()) {
# sl_send_reply("403", "Use From=ID");
# break;
# };
# consume_credentials();
if (isflagset(6) && !isflagset(9)) {
force_rport();
fix_nated_contact();
force_rtp_proxy();
setflag(9);
};
t_on_reply("1");
t_on_failure("1");
if (!t_relay()) {
if(isflagset(6)) {
unforce_rtp_proxy();
};
sl_reply_error();
};
}
route[5] {
###
# Local PSTN Gateway
###
rewritehost("xxx.xxx.xxx.7");
route(1);
}
route[6] {
###
# Calls to VM
###
rewritehost("xxx.xxx.xxx.80");
route(1);
}
route[7] {
###
# Call Failure
###
rewriteuri("sip:7110000001@xxx.xxx.xxx.80");
route(1);
}
failure_route[1] {
###
# Voicemail
###
xlog("L_ERR", " Failure Route 1 hit.\n");
if (t_check_status("487")) {
xlog("L_ERR", " Failure Route 1 - 487 detected, breaking.\n");
break;
};
rewritehost("xxx.xxx.xxx.80");
append_hf("P-hint: OFFLINE VOICEMAIL\r\n");
append_branch();
route(1);
}
onreply_route[1] {
if (isflagset(6) && status=~"(180)|(183)|2[0-9][0-9]") {
if (!search("^Content-Length:\ +0")) {
force_rtp_proxy();
};
};
if (nat_uac_test("1")) {
fix_nated_contact();
};
}
*********************************************
This message has been scanned for viruses and
dangerous content, and is believed to be clean.
Hi,
I'm thinking of implementing authentication using exec
commands. For example, I have a script that checks if a user exists in a
database. For Register methods i will run this script, if the script
exit with 1 the use will be rejected and if the script exit 0 the user
is authenticated. Is this possible?
Thanks,
--
Ryan Pagquil
Infodyne Inc. - PhilOnline.com
3603 Antel Global Corporate Center
Doña Julia Vargas Ave.
Ortigas Center Pasig City
Tel: 687-0715
Web: www.philonline.com
Hello all,
I would like to understand the mediapath for various setup.
Please help me to understand how media (voice/video) travels between UAC1
and UAC2 for different setup.
These by assuming mediaproxy/rtpproxy running on SER. And will there be any
difference in the media path if record_route is used?
1) UAC1 (Public IP)----------SER(Public IP)-----------UAC2 (Public IP)
2) UAC1 (Private IP)----------SER(Public IP)-----------UAC2 (Public IP)
3) UAC1 (Private IP)----------SER(Public IP)-----------UAC2 (Private IP)
4) UAC1 (Private IP)----------SER(Private IP)-----------UAC2 (Public IP)
5) UAC1 (Private IP)----------SER(Private IP)-----------UAC2 (Private IP)
6) UAC1 (Public IP)----------SER(Private IP)-----------UAC2 (Public IP)
TIA
hi
i've heard it should be possible, but i can't find out how...
I want to configure a bunch of asterisk boxes to do SIP/PSTN
connectivity, and I need SER or something to do some balancing in
front of them. The requirements are listed below.
* SER MUST accept and load balance incoming calls over n asterisk
boxes (anything between 2 and 20 servers depending on installation)
* If SER forwards a call to a server being busy or down, SER SHOULD
retry on another server
* SER SHOULD balance the number of calls to each server based on
the codec used so single servers will not be overloaded by
transcoding costs.
* If possible, SER SHOULD be able to fail over to another SER box
if SER fails.
Does anyone know if this is possible? I'd gladly pay someone to help
me out here...
roy
Hi everyone,
We're working through various SER problems and my thinking is that we've
got something generally wrong with our SER config. I posted previously
about one of these problems but wanted to clarify the situation and see
if anyone could offer some advice.
Network: +-------------+
+--| Asterisk VM |
| +-------------+
+---------------+ +---+ | +----------------+
|Inbound PSTN GW|----|SER|--+--| Outbound LD GW |
+---------------+ +---+ | +----------------+
| | +------------------+
+-------+ | +--| Outbound PSTN GW |
| UAs |-----+ +------------------+
+-------+ |
|
+-----------+ +--+ |
| NATed UAs |--|FW|--+
+-----------+ +--+
Problems:
- All UAs can make outbound calls without a problem.
- UAs outside NAT can call each other.
- NATed UAs can call each other. Depending on the UA it will either get one
way audio or no audio. (Cisco 7960 seems to have more problems than
the Sipura 841)
- PSTN GW calls to NATed UAs ring but can't answer the call.
SER logs: Warning: sl_send_reply: I won't send a reply for ACK!!
- When PSTN calls a UA and it doesn't answer, failure route fails to
connect the call to Asterisk. The call is set up (Asterisk logs
attempts to send OKs back and will launch the voicemail app) but the
PSTN gateway never gets the OK. Call is lost.
- When NATed UAs call each other without answering fr_invite_timer hits
and failure route fails to send the call to Asterisk.
I've read a LOT of back postings on the list and have read a bunch of
threads that describe the one-way audio problem but never could find any
acutal answers or resolution. The threads just seem to end.
(i.e. http://lists.iptel.org/pipermail/serusers/2004-October/012305.html )
I'm going to attach the ser.cfg but will hold off on the ngrep and
related documentation as I think someone might be able to tell me what
we're doing wrong by just looking at this.
Anyhow, if anyone can offer some insight it would be greatly
appreciated. (If anyone who is reading this is interested in consulting
on this problem, contact me off-list and we can make payment
arrangements.)
Thanks in advance,
-Corey
SER Config:
############################################################
#
# whatever.net - SER Configuration File
# ser.conf
# Revised 7/31/2005
#
############################################################
debug=3
fork=yes
log_stderror=yes
listen=xxx.ser.ip.addr
port=5060
children=4
alias=whatever.netalias=hostname.whatever.net
dns=no
rev_dns=no
# Added 9/3
reply_to_via=no
check_via=no
fifo="/tmp/ser_fifo"
fifo_db_url="mysql://ser:passwd@localhost/ser"
###
# Modules
###
loadmodule "/usr/local/lib/ser/modules/mysql.so"
loadmodule "/usr/local/lib/ser/modules/sl.so"
loadmodule "/usr/local/lib/ser/modules/tm.so"
loadmodule "/usr/local/lib/ser/modules/acc.so"
loadmodule "/usr/local/lib/ser/modules/rr.so"
loadmodule "/usr/local/lib/ser/modules/exec.so"
loadmodule "/usr/local/lib/ser/modules/maxfwd.so"
loadmodule "/usr/local/lib/ser/modules/usrloc.so"
loadmodule "/usr/local/lib/ser/modules/registrar.so"
loadmodule "/usr/local/lib/ser/modules/auth.so"
loadmodule "/usr/local/lib/ser/modules/auth_db.so"
loadmodule "/usr/local/lib/ser/modules/nathelper.so"
loadmodule "/usr/local/lib/ser/modules/textops.so"
loadmodule "/usr/local/lib/ser/modules/uri_db.so"
loadmodule "/usr/local/lib/ser/modules/uri.so"
loadmodule "/usr/local/lib/ser/modules/permissions.so"
loadmodule "/usr/local/lib/ser/modules/xlog.so"
###
# Module Paramaters
###
modparam("auth_db|uri_db|usrloc|permissions", "db_url", "mysql://ser:passwd@localhost/ser")
modparam("auth_db", "calculate_ha1", 1)
modparam("auth_db", "password_column", "password")
modparam("nathelper", "natping_interval", 5)
modparam("nathelper", "ping_nated_only", 1)
modparam("nathelper", "rtpproxy_sock", "unix:/var/run/rtpproxy.sock")
# VM Timeout
#modparam("tm", "fr_inv_timer", 20)
modparam("tm", "fr_inv_timer", 10)
modparam("tm", "fr_timer", 10)
modparam("usrloc", "db_mode", 2)
modparam("permissions", "db_mode", 0)
modparam("permissions", "trusted_table", "trusted")
modparam("registrar", "nat_flag", 6)
modparam("rr", "enable_full_lr", 1)
modparam("exec", "setvars", 1)
modparam("acc", "log_level", 1)
modparam("acc", "log_flag", 1)
modparam("acc", "db_url", "mysql://ser:passwd@localhost/ser")
modparam("acc", "db_flag", 1)
###
# Routing Section
###
route {
# Basic Checks
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483", "Too Many Hops");
break;
};
if (msg:len > max_len) {
sl_send_reply("513", "Message Overflow");
break;
};
if (method=="INVITE" && nat_uac_test("19")) {
xlog("L_ERR", "INVITE detected with nat_uac_test 19. Adding record route preset.\n");
record_route_preset("xxx.ser.ip.addr:5060;nat=yes");
} else if (method!="REGISTER") {
record_route();
};
if (method=="BYE" || method=="CANCEL") {
unforce_rtp_proxy();
};
# Loose Routing
if (loose_route()) {
route(1);
break;
};
# Call Processing
if (uri!=myself) {
log (1, "*** Message URI is not myself. Probably should not happen.\n");
route(1);
break;
};
if (uri==myself) {
if (method=="ACK") {
xlog("L_ERR", "ACK received from %is for %tu.\n");
route(1);
break;
} else if (method=="CANCEL") {
xlog("L_ERR", "CANCEL received from %is for %tu.\n");
log(1, " Cancel\n");
route(3);
break;
} else if (method=="INVITE") {
xlog("L_ERR", "INVITE received from %is for %tu.\n");
route(3);
break;
} else if (method=="REGISTER") {
xlog("L_ERR", "REGISTER received from %is.\n");
route(2);
break;
} else if (method=="NOTIFY") {
sl_send_reply("200", "Shut up.");
break;
} else if (method=="OPTIONS") {
sl_send_reply("200", "Shut up.");
break;
};
};
route(1);
}
route[1] {
###
# Default Call Handling
###
# NAT Fix
if (method=="INVITE" && nat_uac_test("19") && !isflagset(9)) {
xlog("L_ERR", " - INVITE NAT detected (route 1).\n");
xlog("L_ERR", " -- Contact Header: %ct\n");
fix_nated_sdp("1");
force_rport();
fix_nated_contact();
force_rtp_proxy();
setflag(9);
xlog("L_ERR", " ++ Contact Header: %ct\n");
};
# On call timeout to voicemail
# t_on_failure("1");
# t_on_reply("1");
# Log
setflag(1);
if (!t_relay()) {
if (method=="INVITE" && isflagset(6)) {
unforce_rtp_proxy();
};
sl_reply_error();
};
}
route[2] {
###
# REGISTER method
###
log(1," Route 2 hit.\n");
if (!search("^Contact:\ +\*") && nat_uac_test("19")) {
setflag(6);
fix_nated_register();
force_rport();
};
sl_send_reply("100", "Trying");
if (!www_authorize("whatever.net","subscriber")) {
www_challenge("whatever.net","0");
break;
};
if (!check_to()) {
sl_send_reply("401", "Unauthorized");
break;
};
consume_credentials();
if (!save("location")) {
sl_reply_error();
};
}
route[3] {
###
# INVITE & CANCEL
# URI matching is here.
###
xlog("L_ERR", " Route 3 starting.\n");
t_on_failure("1");
t_on_reply("1");
if (nat_uac_test("19")) {
setflag(6);
};
if (method=="INVITE" && !allow_trusted()) {
# Proxy auth code goes here
consume_credentials();
log(1,"INVITE and not trusted.");
};
lookup("aliases");
if (!lookup("location")) {
if (uri=~"^sip:911@") { # Pass 911 calls first
route(5);
break;
};
if (uri=~"^sip:[0-9]{7}@") { # EXPAND 7-DIGIT CALL
exec_dset("/root/7digit.pl");
};
# Try location lookup again
if (!lookup("location")) {
if (uri=~"^sip:[0-9]{10}@") {
# DB Lookup of NPANXX route
exec_dset("/root/npa_nxx.pl");
route(1);
break;
};
if (uri=~"^sip:1[0-9]{10}@") {
# DB Lookup of NPANXX route
exec_dset("/root/npa_nxx.pl");
route(1);
break;
};
if (uri=~"^sip:555@") { # Voicemail Access
route(6);
break;
};
if (uri=~"^sip:556@") { # Voicemail Access
route(6);
break;
};
# Call error message
route(7);
break;
};
};
# NAT Fix
if (nat_uac_test("19") && !isflagset(9)) {
fix_nated_sdp("1");
force_rport();
fix_nated_contact();
force_rtp_proxy();
setflag(9);
};
if (!t_relay()) {
if(nat_uac_test("19") && isflagset(9)) {
unforce_rtp_proxy();
}
sl_reply_error();
};
}
route[4] {
###
# Primary LD Gateway
###
rewritehost("xxx.sip.gw.ip");
route(1);
}
route[5] {
###
# Local PSTN Gateway
###
rewritehost("xxx.pstn.gw.ip");
route(1);
}
route[6] {
###
# Calls to VM
###
rewritehost("xxx.ast.srv.ip");
route(1);
}
route[7] {
###
# Call Failure
###
rewriteuri("sip:7110000001@xxx.ast.srv.ip");
route(1);
}
failure_route[1] {
###
# Voicemail
###
xlog("L_ERR", " * Failure Route 1 ");
rewritehost("xxx.ast.srv.ip");
append_hf("P-hint: OFFLINE VOICEMAIL\r\n");
append_branch();
route(1);
}
onreply_route[1] {
if (nat_uac_test("19") && status=~"(180)|(183)|2[0-9][0-9]") {
if (!search("^Content-Length:\ +0")) {
force_rtp_proxy();
};
};
if (nat_uac_test("1") && !isflagset(9)) {
fix_nated_contact();
};
}
END
*********************************************
This message has been scanned for viruses and
dangerous content, and is believed to be clean.
Hi!
Is there any way to change the caller id in the PSTN route? If I make a call
to a PSTN phone, the display of this phone shows the internal username. It
would be nice to show a Virtual Number or something like that.
Thanks!
Sebastian
Hello list.
I was wondering if the module auth_radius can receive extra
parameters from the Radius Server and proccess them as AVP values (something
like the avp_radius can do) . I'm using :
version: ser 0.9.4-rc1 (i386/linux)
flags: STATS: Off, USE_IPV6, USE_TCP, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK,
SHM_MEM, SHM_MMAP, PKG_MALLOC, FAST_LOCK-ADAPTIVE_WAIT
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16,
MAX_URI_SIZE 1024, BUF_SIZE 65535
@(#) $Id: main.c,v 1.197 2004/12/03 19:09:31 andrei Exp $
main.c compiled on 04:26:34 Jul 21 2005 with gcc 3.2
I was browsing the CVS directory and i noticed that this revision :
Revision 1.18 / (view) - annotate - [select for diffs] , Thu Jun 30 20:29:31
2005 UTC (2 months ago) by andrei
Branch: MAIN
CVS Tags: last_merge_to_janakj, HEAD
Changes since 1.17: +6 -2 lines
Diff to previous 1.17
seems to do what i want.
Am i right?
Can the version that i'm actually using do the same?
I Hope that somone can help me.
Thanks!
Regards,
Ricardo Martinez.-