Hi Guys,
By receiving incoming traffic from some other sip server (configured
for different domain than mines) I will not be able to catch in the
routing, onreply section, the 200 OK for the INVITE , OK which my
client, behind my server, is sending to remote side, therefore not
beeing able to modify sdp to use mediaproxy. Bellow is a level8 of
debug of the OK.
Is there any other way of catching this message in the routing? Any
help will be appreciated.
Thxs in advance,
Dan
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]: SIP Reply (status):
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]: version: <SIP/2.0>
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]: status: <200>
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]: reason: <OK>
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]:
parse_headers: flags=2
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]: Found param
type 232, <branch> = <z9hG4bKeaa9.11b641a2.0>; state=16
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]: end of
header reached, state=5
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]:
parse_headers: Via found, flags=2
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]:
parse_headers: this is the first via
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]: After parse_msg...
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]:
forward_reply: found module nathelper, passing reply to it
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]:
parse_headers: flags=20
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]: Found param
type 232, <branch> = <z9hG4bKeaa9.2ffc88b3.0>; state=16
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]: end of
header reached, state=5
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]:
parse_headers: Via found, flags=20
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]:
parse_headers: this is the second via
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]: Found param
type 234, <received> = <87.139.12.167>; state=6
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]: Found param
type 235, <rport> = <5096>; state=6
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]: Found param
type 232, <branch> = <z9hG4bK521554023>; state=16
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]: end of
header reached, state=5
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]:
parse_headers: Via found, flags=20
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]: DEBUG:
add_param: tag=8b2d7e45
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]:
DEBUG:parse_to:end of header reached, state=29
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]:
DBUG:parse_to: display={}, ruri={sip:dan@de.babble.net}
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]: DEBUG:
get_hdr_field: <To> [38]; uri=[sip:dan@de.babble.net]
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]: DEBUG: to
body [<sip:dan@de.babble.net>]
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]:
get_hdr_field: cseq <CSeq>: <20> <INVITE>
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]:
forward_reply: found module tm, passing reply to it
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]: DEBUG:
t_check: msg id=1 global id=0 T start=0xffffffff
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]:
parse_headers: flags=22
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]:
parse_headers: flags=8
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]: DEBUG:
t_reply_matching: hash 39598 label 705981201 branch 0
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]:
DEBUG:tm:REF_UNSAFE: after is 1
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]: DEBUG:
t_reply_matching: reply matched (T=0x4081f430)!
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]: DEBUG:
t_check: msg id=1 global id=1 T end=0x4081f430
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]:
DEBUG:tm:reply_received: org. status uas=180, uac[0]=180 local=0
is_invite=1)
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]:
DEBUG:tm:t_should_relay_response: T_code=180, new_code=200
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]:
DEBUG:tm:relay_reply: branch=0, save=0, relay=0
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]: old size:
911, new size: 850
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]:
build_res_from_sip_res: copied size: orig:77, new: 16, rest: 834 msg=
SIP/2.0 200 OK^M Via: SIP/2.0/UDP
87.102.50.17;branch=z9hG4bKeaa9.2ffc88b3.0^M Via: SIP/2.0/UDP
10.10.10.132:5096;received=87.139.12.167;rport=5096;branch=z9hG4bK521554023^M
Record-Route: <sip:87.102.50.13;lr=on;ftag=2240571840>^M Record-Route:
<sip:87.102.50.17;lr;ftag=2240571840>^M Contact:
<sip:dan@87.139.12.167:7472;rinstance=37d0f83d79f3ede2>^M To:
<sip:dan@de.babble.net>;tag=8b2d7e45^M From:
<sip:dan@babble.net>;tag=2240571840^M Call-ID:
1174762859(a)10.10.10.132^M CSeq: 20 INVITE^M Allow: INVITE, ACK,
CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO^M
Content-Type: application/sdp^M User-Agent: X-Lite release 1006e stamp
34025^M Content-Length: 185^M ^M v=0^M o=- 5 2 IN IP4 87.139.12.167^M
s=CounterPath X-Lite 3.0^M c=IN IP4 87.139.12.167^M t=0 0^M m=audio
34556 RTP/AVP 0 101^M a=fmtp:101 0-15^M a=rtpmap:101
telephone-event/8000^M a=sendrecv^M
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]: DEBUG:
add_to_tail_of_timer[2]: 0x4081f478
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]:
DEBUG:tm:relay_reply: sent buf=0x814a048: SIP/2.0 2...,
shmem=0x40821528: SIP/2.0 2
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]: DEBUG:
cleanup_uac_timers: RETR/FR timers reset
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]:
DEBUG:tm:UNREF_UNSAFE: after is 0
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]:
DEBUG:destroy_avp_list: destroying list (nil)
Feb 1 13:33:48 localhost /usr/local/sbin/openser[17816]: receive_msg:
cleaning up
The section 3.2.1 (The WWW-Authenticate Response Header) from RFC 2617 says:
"algorithm
A string indicating a pair of algorithms used to produce the digest
and a checksum. If this is not present it is assumed to be "MD5".
"
I send a INVITE to Openser but it send back a 407 (Proxy Authentication).
The parameter response was OK. But, without the parameter 'algorithm', the proxy
didn't allow the authentication. It neither consult at Radius.
Looking at the RFC above, the SIP proxy must to use MD5 by default, but it
don't accept the message without the parameter. Who needs to assume the algorithm?
UAC or SIP Proxy?
Can it be a bug of OpenSER? Or my interpretation is wrong?
Best regards.
Bruno Machado
----- Mensagem original ----
De: Bogdan-Andrei Iancu <bogdan(a)voice-system.ro>
Para: Bruno Machado <bsmufu(a)yahoo.com.br>
Cc: users(a)openser.org
Enviadas: Segunda-feira, 29 de Janeiro de 2007 14:21:31
Assunto: Re: [Users] 407 and algorithm=MD5
Hi Bruno,
you cannot configure to have the algorithm param added. If I'm not
wrong, the digest RFC says this is an optional param and the default
value is MD5.
regards,
bogdan
Bruno Machado wrote:
> Hi.
>
> When I use the function proxy_challenge(), the 407 don't have the
> parameter 'algorithm=MD5'. Look below:
>
> ...
> Proxy-Authenticate: Digest realm="proxy.com.br",
> nonce="45be00f941f137ff037436c77f80a9531a02155f".
> ...
>
> How can I put this parameter in digest informations?
>
> ...
> Proxy-Authenticate: Digest realm="proxy.com.br",
> nonce="45be00f941f137ff037436c77f80a9531a02155f",
> algorithm="MD5".
> ...
>
>
> Thanks in advance.
>
> Bruno
>
> __________________________________________________
> Fale com seus amigos de graça com o novo Yahoo! Messenger
> http://br.messenger.yahoo.com/
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Users mailing list
>Users(a)openser.org
>http://openser.org/cgi-bin/mailman/listinfo/users
>
>
__________________________________________________
Fale com seus amigos de graça com o novo Yahoo! Messenger
http://br.messenger.yahoo.com/
Hello ,
Can someone describe me a real example how to write rules in
permission.allow, permission.deny. I use the example from file
permission.* and it doesn't work, permission is set ALL to ALL.
Or maybe exist other method to make call restrictions?
#openser.cfg
....
loadmodule "/usr/lib/openser/modules/permissions.so"
....
modparam("permissions", "default_deny_file", "/etc/openser/permissions.deny")
modparam("permissions", "default_allow_file", "/etc/openser/permissions.allow")
....
--
Best regards,
Ion Minzu,
mailto:ion.minzu@cts.md
Hi,
I do have OpenSER 1.1.0 with TLS support on Debian Sarge working nicely,
and my SNOM 360 registers against it nicely. When using OpenSER 1.2 (2
days old CVS build) with TLS on Debian Etch with SNOM 360 and own signed
certificates (with tls/tools & own machine names) I get debug info
(below) from OpenSER. Any ideas with that "peer did not send
sertificate" ?
Thank you so many times,
-Mika
--- clip ---
Feb 2 13:15:10 localhost openser[20855]: tcp_receive_timeout: 0xb59e1900
expired (296, 297) lt=0
Feb 2 13:15:10 localhost openser[20855]: DBG: io_watch_del (0x8122980,
18, -1, 0x10) fd_no=2 called
Feb 2 13:15:10 localhost openser[20855]: releasing con 0xb59e1900, state
0, fd=18, id=2
Feb 2 13:15:10 localhost openser[20855]: extra_data (nil)
Feb 2 13:15:10 localhost openser[20859]: handle_tcp_child: reader
response= b59e1900, 0 from 0
Feb 2 13:15:10 localhost openser[20859]: DBG: io_watch_add(0x8122820, 23,
2, 0xb59e1900), fd_no=15
Feb 2 13:15:10 localhost openser[20859]: handle_tcp_child: CONN_RELEASE
0xb59e1900 refcnt= 0
Feb 2 13:15:10 localhost openser[20859]: tcpconn_new: new tcp connection
to: 193.65.183.233
Feb 2 13:15:10 localhost openser[20859]: tcpconn_new: on port 2063, type 3
Feb 2 13:15:10 localhost openser[20859]: tls_tcpconn_init: Entered:
Creating a whole new ssl connection
Feb 2 13:15:10 localhost openser[20859]: tls_tcpconn_init: Looking up
socket based TLS server domain [193.65.183.13:5061]
Feb 2 13:15:10 localhost openser[20859]: tls_find_server_domain: virtual
TLS server domain not found, Using default TLS server domain settings
Feb 2 13:15:10 localhost openser[20859]: tls_tcpconn_init: Found socket
based TLS server domain [0.0.0.0:0]
Feb 2 13:15:10 localhost openser[20859]: tls_tcpconn_init: Setting in
ACCEPT mode (server)
Feb 2 13:15:10 localhost openser[20859]: tcpconn_add: hashes: 462, 9
Feb 2 13:15:10 localhost openser[20859]: handle_new_connect: new
connection: 0xb5a06c88 24 flags: 0002
Feb 2 13:15:10 localhost openser[20859]: send2child: to tcp child 0
6(20855), 0xb5a06c88
Feb 2 13:15:10 localhost openser[20855]: received n=4 con=0xb5a06c88, fd=18
Feb 2 13:15:10 localhost openser[20855]: DBG: io_watch_add(0x8122980, 18,
2, 0xb5a06c88), fd_no=1
Feb 2 13:15:11 localhost openser[20855]: tls_update_fd: New fd is 18
Feb 2 13:15:11 localhost openser[20855]: tls_update_fd: New fd is 18
Feb 2 13:15:11 localhost openser[20855]: tls_accept: Error in SSL:
Feb 2 13:15:11 localhost openser[20855]: tls_error: error:140890C7:SSL
routines:SSL3_GET_CLIENT_CERTIFICATE:peer did not return a certificate
Feb 2 13:15:11 localhost openser[20855]: DBG: io_watch_del (0x8122980,
18, -1, 0x10) fd_no=2 called
Feb 2 13:15:11 localhost openser[20855]: releasing con 0xb5a06c88, state
-2, fd=18, id=9
Feb 2 13:15:11 localhost openser[20855]: extra_data 0xb59f1a18
Feb 2 13:15:11 localhost openser[20859]: handle_tcp_child: reader
response= b5a06c88, -2 from 0
Feb 2 13:15:11 localhost openser[20859]: tcpconn_destroy: destroying
connection 0xb5a06c88, flags 0002
Feb 2 13:15:11 localhost openser[20859]: tls_close: Closing SSL connection
Feb 2 13:15:11 localhost openser[20859]: tls_update_fd: New fd is 24
Feb 2 13:15:11 localhost openser[20859]: tls_shutdown: Shutdown successful
Feb 2 13:15:11 localhost openser[20859]: tls_tcpconn_clean: Entered
-- clip ---
Hello all,
I've a small problem that causes a lot of problems and is in some way
specific:
I've a Openser 1.1.1 Server running on a public rootserver. User are
registered with FritzBox ( DSL-Router with Voip-Stack) or a
Soft/Hardphone being Nated. For the PSTN connectivity i've access to a
PSTN Gateway from the BT.
Everything works very nice with just one problem remaining. When one
User gets a call from PSTN and picks it up, no problems. But the problem
comes when a second call is made to the same User. His phone tells him
that somebody is knocking and he can pickup the phone without any problem.
The problem is on the callers side because he doesn't get any feedback
that he is ringing/knocking, so most of the time he will just cancel the
call.
I did some research about it and here are my conclusions:
The INVITE from the second call isn't answered with a "180 Ringing.."
but with a "182 Queued.." which doesn't trigger a Ringing for the PSTN
Call. When I talked to the BT support they did not really know about the
status code 182 and could not give me an answer how their mediagateway
will handle it ( They promised me to get the informtion :-) ).
On the other side I can't change the Firmware so there's no way of
persuading the DSL-Router to use 180 instead of 182.
So my questions are:
Can i change the status code at the proxy?
If so, in which part of the routing logic do I have to change it?
I tried a lot of different subst() and replace() commands but none had
any effect on the sip messages it always kept being 182.
Below you can see my configuration which is based on the template from
ixcall ( http://www.ixcall.net/?q=node/32 ) with a lot of changes and
support from the "getting started" guide from onsip.org, of course
adapted to the openser 1.1.1 version
I have attached my config. Keep in mind that this config will get
through a m4 parser before being ready to be used ( mechanism can be
seen at ixcall ).
I hope my english is good enough to have my problem explained in a
understandable manner
Have fun
Marc
/*
====================================================================
Schnuffle Openser Configuration V6.3
Based on IxCall template V2.4 (http://www.ixcall.net/?q=node/32)
And OnSip.org "Getting Started" Guid (http://siprouter.onsip.org/doc/gettingstarted/)
====================================================================
list of flags used
1 - Accounting
2 - Missed calls Accouting
3 - NAT SIP ping flag
4 - NAT invite detected
5 - registrar module nat_flag
6 - Enable NAT support
7 - Enable Trunk (pstn, asterisk or yate)
13 - Enable debugging
--------------------------------------------------------------------
Routes
1 - Relay with NAT helper and no proxy authentication
2 - Method Register handler
3 - Method Invite handler (call routing)
4 - Trunk and PSTN gateway routing
5 - TLS routing ( not really used but still in config to keep the given message flow intact )
6 - Relay with no NAT support and no proxy authentication
7 - User verify
10 - Relay with NAT helper and proxy authentication
Reply 1 - NAT helper
Fail 1 - Voicemail and message store ( stripped from all the voicemail and message storage stuff, so in fact just empty )
--------------------------------------------------------------------
*/
#Global settings
debug=3
log_facility=LOG_LOCAL7
fork=yes
log_stderror=no
mhomed=no # Multihomed - set this to no if you set a "listen" addres
listen=OPENSER_IP # only want to bind to this ip
port=OPENSER_PORT
children=4
tcp_children=4
tcp_accept_aliases=yes
alias=OPENSER_REALM # your realm
alias=OPENSER_HOST # alias domains of your SRV records
alias=OPENSER_IP # and for the die hard ip users.
# uncomment to override config values for debugging
/*
debug=7 # debug level (cmd line: -ddd)
fork=no
port=OPENSER_PORT
log_stderror=yes # (cmd line: -E)
fifo="OPENSER_FIFO"
*/
dns=no
rev_dns=no
fifo="OPENSER_FIFO"
fifo_mode=OPENSER_FIFO_MODE
#TLS specific settings
disable_tls = DISABLE_TLS
#listen = tls:OPENSER_TLS_IP:OPENSER_TLS_PORT
#tls_verify = 1
#tls_require_certificate = 0
#tls_method = SSLv23
#tls_certificate = "DEFAULT_TLS_CERTIFICATE"
#tls_private_key = "DEFAULT_TLS_PRIVATE_KEY"
#tls_ca_list = "DEFAULT_TLS_CA_LIST"
mpath="OPENSER_MODULE_PATH" #path to openser modules
loadmodule "mysql.so"
loadmodule "sl.so"
loadmodule "tm.so"
loadmodule "rr.so"
loadmodule "acc.so"
loadmodule "maxfwd.so"
loadmodule "usrloc.so"
loadmodule "registrar.so"
loadmodule "auth.so"
loadmodule "auth_db.so"
loadmodule "alias_db.so"
loadmodule "uri.so"
loadmodule "uri_db.so"
loadmodule "mediaproxy.so"
loadmodule "nathelper.so"
loadmodule "textops.so"
loadmodule "avpops.so"
loadmodule "domain.so"
loadmodule "permissions.so"
loadmodule "group.so"
loadmodule "xlog.so"
loadmodule "enum.so"
loadmodule "lcr.so"
fifo_db_url="mysql://OPENSER_DB_USER:OPENSER_DB_PW@OPENSER_DB_HOST/OPENSER_DB"
modparam("avpops|auth_db|alias_db|permissions|uri_db|usrloc|acc|msilo|group|domain|lcr|pdt","db_url", "mysql://OPENSER_DB_USER:OPENSER_DB_PW@OPENSER_DB_HOST/OPENSER_DB")
modparam("auth_db", "calculate_ha1", CALCULATE_HA1)
modparam("auth_db", "password_column", "PASSWORD_COLUMN")
modparam("auth_db", "password_column_2", "ha1b")
modparam("auth", "secret", "OPENSER_DIGEST_PW")
#nathelper, mediaproxy or both can be used
#we will only be using mediaproxy
modparam("nathelper", "rtpproxy_disable", 1)
modparam("nathelper", "natping_interval", 0)
modparam("mediaproxy","natping_interval", 30)
modparam("mediaproxy","mediaproxy_socket", "MEDIAPROXY_SOCKET")
#modparam("mediaproxy","sip_asymmetrics","MEDIAPROXY_SIP_ASYMMETRICS")
#modparam("mediaproxy","rtp_asymmetrics","MEDIAPROXY_RTP_ASYMMETRICS")
# -- lcr params --
modparam("lcr","gw_table","gw")
modparam("lcr","gw_name_column","gw_name")
modparam("lcr","ip_addr_column","ip_addr")
modparam("lcr","port_column","port")
modparam("lcr","uri_scheme_column","uri_scheme")
modparam("lcr","transport_column","transport")
modparam("lcr","grp_id_column","grp_id")
modparam("lcr","db_mode",0)
# -- group params --
modparam("group", "table", "grp")
modparam("group", "use_domain", 0) # might be usefull for future expansions
modparam("group", "user_column", "username")
modparam("group", "domain_column", "domain")
modparam("group", "group_column", "grp")
# -- usrloc params --
modparam("usrloc", "db_mode", 1)
modparam("usrloc", "desc_time_order", 1)
# -- registrar params --
modparam("registrar", "sip_natping_flag", 3)
modparam("registrar", "nat_flag", 5)
modparam("registrar", "desc_time_order", 1)
# -- rr params --
modparam("rr", "enable_full_lr", 1)
# -- tm params --
#modparam("tm", "fr_timer", 20 )
modparam("tm", "fr_inv_timer", 90 )
#modparam("tm", "wt_timer", 20 )
modparam("tm", "via1_matching", 1)
modparam("tm", "fr_inv_timer_avp", "s:inv_timeout")
# -- permission params --
modparam("permissions", "db_mode", 0)
modparam("permissions", "trusted_table", "trusted")
# -- acc params --
modparam("acc", "db_flag", 1 )
modparam("acc", "db_missed_flag", 2)
modparam("acc", "report_cancels", 1)
modparam("acc", "log_flag", 1)
# -- alias_db params --
modparam("alias_db", "user_column", "username")
modparam("alias_db", "domain_column", "domain")
modparam("alias_db", "alias_user_column", "alias_username")
modparam("alias_db", "alias_domain_column", "alias_domain")
#--enum params --
#modparam("enum", "domain_suffix", "e164.arpa.")
# -- domain params --
modparam("domain", "domain_table", "domain")
modparam("domain", "domain_col", "domain")
# -- avpops params --
# avpops is used to store the local prefix from each customer in subscriber table
# and append it as soon as a local call is done (meaning a call matching [^0][0-9]*)
modparam("avpops","db_scheme","prefix-scheme:username_col=username;domain_col=domain;value_col=prefix;value_type=string;table=subscriber")
modparam("avpops","avp_table","subscriber")
modparam("avpops","use_domain",0)
modparam("avpops","username_column","username")
modparam("avpops","domain_column","domain")
modparam("avpops","avp_aliases","prefix=s:800")
# ------------------------- request routing logic -------------------
# main routing logic
route {
# -----------------------------------------------------------------
# Configuration flags
# -----------------------------------------------------------------
NAT_SUPPORT_FLAG_6
TRUNK_ENABLED_FLAG_7
DEBUG_FLAG_13
# changing return code 182 to 180 so that the calling phone will ring
# does not work at all
#if (status=="182") {
# xlog("Changing Status Code from 182 to 180");
# subst('/182 Queued/180 Ringing/ig');
#}
#xlog("Replacing Status 1820 with 180");
#replace_all("182 Queued","180 Ringing");
if (isflagset(13) && !is_method("ACK") && !is_method("REGISTER")) {
#debug route
route(13);
};
# -----------------------------------------------------------------
# Sanity Check Section
# -----------------------------------------------------------------
if (!mf_process_maxfwd_header("10")) {
if (method!="ACK") {
sl_send_reply("483", "Too Many Hops");
};
return;
};
if (msg:len > max_len) {
if (method!="ACK") {
sl_send_reply("513", "Message Overflow");
};
return;
};
if (status=="482") {
#loop detection
xlog("L_ERR", "OPENSER_NAME: $mi $rm $fu -> $ru status 482 Loop Detected\n");
return;
};
# -----------------------------------------------------------------
# Record Route Section
# -----------------------------------------------------------------
if (method=="INVITE") {
record_route();
if (client_nat_test("3") && isflagset(6)) {
add_rr_param(";nat=yes");
};
};
# -----------------------------------------------------------------
# Loose Route Section
# -----------------------------------------------------------------
if (loose_route()) {
if (isflagset(6)) {
if (has_totag() && (method=="INVITE" || method=="ACK" || method=="BYE")) {
setflag(1); # not really clear which of the setflags triggered the "BYE" and "CANCEL" to be accounted
setflag(2);
if (client_nat_test("3")||search("^Route:.*;nat=yes")){
xlog("L_NOTICE","Loose Route: Using MediaProxy");
use_media_proxy();
};
};
};
route(6);
return;
};
# -----------------------------------------------------------------
# Call Tear Down Section
# -----------------------------------------------------------------
if (isflagset(6)) {
if (method=="BYE" || method=="CANCEL") {
setflag(1);
setflag(2);
end_media_session();
};
};
# -----------------------------------------------------------------
# Unauthorized relay
# -----------------------------------------------------------------
if (!is_uri_host_local()) {
xlog("L_NOTICE","Prevent unauthorized Access is_uri_host_local=false, URI: $u, From: $fu -> Request: $ru\n");
if (is_from_local() || allow_trusted()) { # We prevent unautherised relays
xlog("is_from_local or allow_trusted is true\n");
append_hf("P-hint: outbound\r\n");
route(10); # need auth
} else {
xlog("L_NOTICE","Uauthorized Relay: Reply a Forbidden\n");
sl_send_reply("403", "Forbidden");
};
return;
};
# -----------------------------------------------------------------
# Call Type Processing Section
# -----------------------------------------------------------------
if (uri=~"sip:daemon@" ) {
sl_send_reply("410", "daemon has gone for a beer");
return;
};
# Calls matching means it is a local call without prefix
# So prefix needs to be added expect for special numbers
if (uri=~"sip:[1-9][0-9]*@" ) {
# Check if uri contains special numbers ( 110,112 and some other 11[0-9]+ numbers )
# that should not be changed
if (!uri=~"sip:11.*") {
# add prefix to number
# load user prefix and store it in $avp(s:800)
# the prefix is stored in the subscriber table in an supplement attribute prefix
if(!avp_db_load("$fu","$avp(s:800)/$prefix-scheme")) {
xlog("Failed to load User Prefix");
} else {;
# prefix R-URI
xlog("Adding Prefix: $avp(s:800) to $ru");
subst_uri('/^sip:([0-9]+)@(.*)$/sip:$avp(s:800)\1@\2;orig_uri=\1-\2/i');
xlog("R-URI: $ru");
}
}
}
if (method=="INVITE") {
route(3);
return;
} else if (method=="ACK") {
route(1);
return;
} else if (method=="BYE" || method=="CANCEL") {
setflag(1);
setflag(2);
route(1);
return;
} else if (method=="REGISTER") {
route(2);
return;
};
lookup("aliases");
#alias_db_lookup("dbaliases");
if (uri!=myself) {
xlog("L_NOTICE", "Lookup Aliases failed");
route(10);
return;
};
if (!lookup("location")) {
xlog("L_NOTICE", "Lookup Location failed");
route(8);
return;
};
route(1); # Do not proxy authenticate - needed by system to send messages
return;
}
route[1] {
# -----------------------------------------------------------------
# Default Route relay Handler with NAT ENABLED
# -----------------------------------------------------------------
if (isflagset(6)) {
if (client_nat_test("3")) {
setflag(4);
force_rport();
fix_contact();
};
if (isflagset(4) || isflagset(5)) {
xlog("L_NOTICE","Route(1) using Mediaproxy");
use_media_proxy();
};
t_on_reply("1");
};
route(6); # Relay the call
return;
}
route[2] {
# -----------------------------------------------------------------
# REGISTER Message Handler
# -----------------------------------------------------------------
# This cool register script came from http://openser.org/docs/scripting.html
sl_send_reply("100", "Trying");
if (!route(7)) { # verify the user
return(0);
};
if (!search("^Contact:[ ]*\*") && client_nat_test("7") && isflagset(6)) {
setflag(3);
setflag(5);
force_rport();
fix_contact();
};
if (!is_user_in("From", "noauth")) { #no authentication required
if (!www_authorize("", "subscriber")) {
if (isflagset(13)) {
xlog("L_NOTICE", "OPENSER_NAME: $mi route[$rm][2] \
$fu Authorization for $fu ($si) requested\n");
};
www_challenge("", "0");
return(0);
} else {
if (isflagset(13)){
xlog("L_NOTICE","OPENSER_NAME: $mi route[$rm][2] \
$fu Authorization OK\n");
};
};
# Prohibit attempts to grab someone else's To address using valid credentials
if (!check_to()) {
if (isflagset(13)){
xlog("L_NOTICE", "OPENSER_NAME: $mi route[$rm][2] \
$fu -> $ru REPLY 401 - Unauthorized check_to() failed\n");
};
sl_send_reply("401", "Unauthorized - account and username must match");
return(0);
};
consume_credentials();
};
if (!save("location")) {
if (isflagset(13)) {
xlog("L_NOTICE", "OPENSER_NAME: $mi route[$rm][2] \
$fu save(location) Failed\n");
};
sl_reply_error();
return(0);
}else {
if (isflagset(13)) {
xlog("L_NOTICE", "OPENSER_NAME: $mi route[$rm][2] \
$fu save(location)OK\n");
};
};
return;
}
route[3] {
# -----------------------------------------------------------------
# INVITE Message Handler
# -----------------------------------------------------------------
setflag(1); #turn on accounting
setflag(2); #also missed calls
lookup("aliases"); #in the event that an alias resolves to another domain.
#alias_db_lookup("dbaliases");
if (uri!=myself) {
xlog("L_NOTICE","No Local Call Check Auth I: r-uri: <$ru> from-uri:<$fu>\n");
route(10); #check authentication
return;
};
if (!lookup("location")) {
xlog("L_NOTICE","Lookup Location Failed: r-uri: <$ru> from-uri:<$fu>\n");
if (src_ip==OPENSER_PBX_IP || !isflagset(7)) { # loopback prevention
route(8);
return;
} else { # if it's not here, go hassle asterisk.
xlog("L_NOTICE","Trunk Routing: r-uri: <$ru> from-uri:<$fu>\n");
route(4);
return;
};
};
t_on_failure("1"); #call waiting,busy,DND,voicemail
route(1); # local normal routing
return;
}
route[4] {
# -----------------------------------------------------------------
# PSTN Handler
# -----------------------------------------------------------------
avp_write("$avp(i:120)", "$avp(s:inv_timeout)");
xlog("L_NOTICE","Loading Gateways form Database");
if (!load_gws()){
xlog("L_ERR","****************************** LoadGateways Failed **********************");
sl_send_reply("500", "Internal server error, unable to load phone gateways");
return;
};
if (!next_gw()) {
xlog("L_NOTICE","******************** Didn'T found Any Gateways *************************");
sl_send_reply("503", "Service not available - No gateways");
return;
};
# check if we route through BT
# if so, change From Header domain to IP ( @callway-voip.de -> @212.65.6.4 )
# BT Gateway is in GatewayGroup 1
if (to_gw("2")) {
xlog("L_NOTICE","Relaying to External Gateway, so rewriting From-HEADER:$fu\n");
#subst('/182 Queued/180 Ringing/ig');
#replace_all("182 Queued","180 Ringing");
subst('/From:([^@]*)@callway-voip.de/From:\1@212.65.6.4/ig');
};
#if (isflagset(13)){
xlog("L_NOTICE", "OPENSER_NAME: $mi route[$rm][4] \
time [$Tf] Next Gateway $ruri_user_avp method <$rm> r-uri <$ru> 2nd via <$hdr(via[1])>\n");
#};
route(1);
return;
}
route[5] {
# -----------------------------------------------------------------
# TLS Handling
# -----------------------------------------------------------------
# if (!is_uri_host_local()) { # if you have some interdomain connections via TLS
# if(uri=~"@tls_domain1.net") {
# t_relay_to_tls("IP_domain1","port_domain1");
# exit;
# } else if(uri=~"@tls_domain2.net") {
# t_relay_to_tls("IP_domain2","port_domain2");
# exit;
# };
# };
if (!is_uri_host_local()) {
remove_hf("Alert-Info");
if (method=="INVITE" && proto==tls) {
append_hf("Alert-info: 1\r\n"); #cisco 7960
append_hf("Alert-info: Bellcore-dr4\r\n"); #cisco ATA
# append_hf("Alert-info: http://foo.bar/x.wav\r\n"); #snom
};
};
return;
}
route[6] {
# -----------------------------------------------------------------
# Route relay Handler
# -----------------------------------------------------------------
#subst('/182 Queued/180 Ringing/ig');
#replace_all("182 Queued","180 Ringing");
if (!t_relay()) {
if (isflagset(6)) {
if (method=="INVITE" || method=="ACK") {
end_media_session();
};
};
xlog("L_NOTICE","Route6: T_relay failed");
sl_reply_error();
};
return;
}
route[7] {
# -----------------------------------------------------------------
# User verify
# -----------------------------------------------------------------
# Check for known domain(s)
if (!is_from_local()) {
if (isflagset(13)){
xlog("L_NOTICE", "OPENSER_NAME: $mi route[$rm][2] \
$fu Unknown domain\n");
sl_send_reply("403", "Unknown domain");
};
return(0);
};
# Check to see that the user has not been disabled
if (is_user_in("From", "disabled")) {
if (isflagset(13)){
xlog("L_NOTICE", "OPENSER_NAME: $mi route[$rm][2] \
$fu Your account has been disabled\n");
};
sl_send_reply("403", "Your account has been disabled");
return(0);
};
if (is_user_in("To", "disabled")) {
if (isflagset(13)) {
xlog("L_NOTICE", "OPENSER_NAME: $mi route[$rm][2] \
$tu That account has been disabled\n");
};
sl_send_reply("403", "That account has been disabled");
return(0);
};
return(1);
}
route[8] {
# -----------------------------------------------------------------
# Handling of unavailable user
# -----------------------------------------------------------------
# non-Voip -- just send "off-line"
if (!(method=="INVITE" || method=="ACK" || method=="CANCEL")) {
sl_send_reply("404", "Not Found");
return;
};
t_newtran();
t_reply("404", "Not Found");
# we account missed incoming calls; previous statteful processing
# guarantees that retransmissions are not accounted
acc_db_request("404 missed call", "missed_calls");
return;
}
route[10] {
# -----------------------------------------------------------------
# Default Message Handler with Proxy Authentication
# -----------------------------------------------------------------
if(method=="ACK") { #these you never proxy authenticate
route(1);
return;
};
if(method=="BYE" || method=="CANCEL") { #these you never proxy authenticate
setflag(1);
route(1);
return;
};
xlog("L_INFO", "Proxy auth $fd $dP destination:$du $dd $ds");
if (!route(7)) { #verify the user
return(0);
};
if (!is_user_in("From", "noauth")) { #no authentication required
if (!proxy_authorize("","subscriber")) {
proxy_challenge("","0");
return;
} else if (!check_from()) {
sl_send_reply("403", "Use From=ID");
return;
};
consume_credentials();
};
# if (is_user_in("Credentials", "local")) { # Uncomment to use the group options
route(1);
# }else{
# sl_send_reply("403", "Denied, you are not allowed this route");
# };
return;
}
onreply_route[1] {
# -----------------------------------------------------------------
# Return Route
# -----------------------------------------------------------------
#replace_all("182 Queued","180 Ringing");
if ((isflagset(4) || isflagset(5)) && isflagset(6) && (status=~"(180)|(183)|2[0-9][0-9]")) {
if (!search("^Content-Length:[ ]*0")) {
xlog("L_NOTICE","OnReplyRoute(1) Using Mediaproxy");
use_media_proxy();
};
};
if (client_nat_test("1") && isflagset(6)) {
fix_contact();
};
return;
}
failure_route[1] {
# -----------------------------------------------------------------
# No answer, cancel, busy handling
# -----------------------------------------------------------------
return;
}
route[13] {
# -----------------------------------------------------------------
# Debuging info
# -----------------------------------------------------------------
if (status=="100") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 100 Trying\n");
} else if (status=="180") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 180 Ringing\n");
} else if (status=="181") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 181 Call Is Being Forwarded\n");
} else if (status=="182") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 182 Queued\n");
} else if (status=="183") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 183 Session Progress\n");
} else if (status=="200") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 200 OK\n");
} else if (status=="202") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 202 Accepted\n");
} else if (status=="300") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 300 Multiple Choices $ct\n");
} else if (status=="301") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 301 Moved Permanently $ct\n");
} else if (status=="302") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 302 Moved Temporarily $ct\n");
} else if (status=="305") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 305 Use Proxy\n");
} else if (status=="380") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 380 Alternative Service\n");
} else if (status=="400") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 400 Bad Request\n");
} else if (status=="401") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 401 Unauthorized\n");
} else if (status=="402") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 402 Payment Required\n");
} else if (status=="403") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 403 Forbidden\n");
} else if (status=="404") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 404 Not Found\n");
} else if (status=="405") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 405 Method Not Allowed\n");
} else if (status=="406") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 406 Not Acceptable\n");
} else if (status=="407") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 407 Proxy Authentication Required\n");
} else if (status=="408") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 408 Request Timeout\n");
} else if (status=="409") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 409 Conflict\n");
} else if (status=="410") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 410 Gone\n");
} else if (status=="411") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 411 Length Required\n");
} else if (status=="412") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 412 Conditional Request Failed\n");
} else if (status=="413") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 413 Request Entity Too Large\n");
} else if (status=="414") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 414 Request-URI Too Long\n");
} else if (status=="415") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 415 Unsupported Media Type\n");
} else if (status=="416") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 416 Unsupported URI Scheme\n");
} else if (status=="420") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 420 Bad Extension\n");
} else if (status=="421") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 421 Extension Required\n");
} else if (status=="422") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 422 Session Interval Too Small\n");
} else if (status=="423") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 423 Interval Too Brief\n");
} else if (status=="429") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 429 Provide Referrer Identity\n");
} else if (status=="480") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 480 Temporarily Unavailable\n");
} else if (status=="481") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 481 Call Leg/Transaction Does Not Exist\n");
} else if (status=="482") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 482 Loop Detected\n");
} else if (status=="483") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 483 Too Many Hops\n");
} else if (status=="484") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 484 Address Incomplete\n");
} else if (status=="485") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 485 Ambiguous\n");
} else if (status=="486") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 486 Busy Here\n");
} else if (status=="487") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 487 Busy Here; Request Terminated\n");
} else if (status=="488") {
xlog("L_NOTICE", "OPENSER_NAME: $mi $rm $fu -> $ru status 488 Not Acceptable Here\n");
} else if (status=="489") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 489 Bad Event\n");
} else if (status=="491") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 491 Request Pending\n");
} else if (status=="493") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 493 Undecipherable\n");
} else if (status=="494") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 494 Security Agreement Required\n");
} else if (status=="500") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 500 Server Internal Error\n");
} else if (status=="501") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 501 Not Implemented\n");
} else if (status=="502") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 502 Bad Gateway\n");
} else if (status=="503") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 503 Service Unavailable\n");
} else if (status=="504") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 504 Server Timeout\n");
} else if (status=="505") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 505 Version Not Supported\n");
} else if (status=="513") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 513 Message Too Large\n");
} else if (status=="580") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 580 Precondition Failure\n");
} else if (status=="600") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 600 Busy Everywhere\n");
} else if (status=="603") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 603 Decline\n");
} else if (status=="604") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 604 Does Not Exist Anywhere\n");
} else if (status=="606") {
xlog("L_NOTICE",
"OPENSER_NAME: $mi $rm $fu -> $ru status 606 Not Acceptable\n");
} else {
xlog("L_NOTICE", "OPENSER_NAME: $mi $rm $fu -> $ru status not listed\n");
};
xlog("L_NOTICE", "OPENSER_NAME: $mi $mb\n");
return;
}
Dear All:
I am a ser user, i want to use sip client that can commuicate with foreign IM client(msn), my flow is sip client -> ser(jabber module) (0.10 version) -> jabber server(has msn gateway) -> MSN network. but i did not see any function that can register to MSN server(just like jabber client browse transport in the jabber server and then register to MSN network) and there is no function or program using msn id and password. i doubt jabber module does not implement this part of program.Maybe there is another mathod can solve it. Does anyone can help me ? thanks.
allan
DISCLAIMER:
Sample Disclaimer added in a VBScript.
Hello!
I have just upgraded from 1.0.0 til 1.1.1, and I having problem with
exec_msg (the exec_msg working, but environment variabels is "not found".)
It was OK in 1.0.0 version.
The coding:
exec_msg("echo SIP_SRCIP $SIP_SRCIP >>/var/log/messages");
At startup (with debuggging) :
0(0) fixing exec_msg, line 160
0(0) xl_parse_format: parsing [echo SIP_SRCIP $SIP_SRCIP
>>/var/log/messages]
0(0) xl_lookup_spec_name: not found [SIP_SRCIP]
0(0) xl_parse_format: format parsed OK: [2] items
Error message when running the command (with debugging) :
0(28888) xl_get_spec_value: error - null sp->itf
0(28888) exec:w_exec_msg: executing [echo SIP_SRCIP >>/var/log/messages]
Error message when running in "normal" mode
Feb 4 21:51:24 test /usr/local/sbin/openser[28947]: xl_get_spec_value:
error - null sp->itf
SIP_SRCIP
As you see the text SIP_SRCIP is beeing displayd, but not the variabel.
Any ide what can bee wrong?
Best regards
K.A.Frigstad
Hello,
can anybody tell me how can i send extra attributes to radius in
authpacket, in acctpacket i can with radius_extra parameter, is there a
way to use it in auth too?
Thanks any help,
Tamas