I am using AVPs for distinctive ring preferences. I allows users to
store up to 5 phone numbers that can be assigned a custom ring. The
method below works fine but as you can see it requires 5 db queries.
There must be a better way to do this. Any ideas?
- Daryl
if (avp_db_load("$ruri/username", "s:ringone")) {
if (avp_check("s:ringone", "eq/$from/i")) {
append_hf("Alert-Info: Bellcore-r1\r\n");
};
};
if (avp_db_load("$ruri/username", "s:ringtwo")) {
if (avp_check("s:ringtwo", "eq/$from/i")) {
append_hf("Alert-Info: Bellcore-r2\r\n");
};
};
if (avp_db_load("$ruri/username", "s:ringthree")) {
if (avp_check("s:ringthree", "eq/$from/i")) {
append_hf("Alert-Info: Bellcore-r3\r\n");
};
};
if (avp_db_load("$ruri/username", "s:ringfour")) {
if (avp_check("s:ringfour", "eq/$from/i")) {
append_hf("Alert-Info: Bellcore-r4\r\n");
};
};
if (avp_db_load("$ruri/username", "s:ringfive")) {
if (avp_check("s:ringfive", "eq/$from/i")) {
append_hf("Alert-Info: Bellcore-r5\r\n");
};
};
Hi,
I'd like to use OpenSER for routing calls to NATed gateways. I also want
to support the LCR feature. Unfortunately, the current LCR module
doesn't support NAT. I mean that the gateway IP addresses must be
defined explicitly in the "gtw" table. Now I'm looking for a way to
force OpenSer to use information from the "location" table.
I want to write a module that will have the similar functionality like
the current LCR module has but resolving procedure will be more
complicated (not based on prefix and From only). The module should build
avp list where each gateway will have symbolic user name. For example,
g1, g2 etc. The gateways will also be registered on the proxy with those
names. Then I think it will be possible to call lookup("location") after
successful call the next_gtw() from the script.
Is it feasible? Is there another way to solve my problem?
Thank you in advance,
Leonid Fainshtein
hi,
is there some way, to prefix a given uri (=~[1-9]\d*, for example)
based on the From-header field? suppose i want to extract a specific
part (the area-code) from the From-header (like in bla(a)04711.sip...),
i want to add
prefix(echo $SIP_HF_FROM | sed 's/.*\@\([^.]*\)\..*/\1/')
or something like that in my SER config, but (even with the exec-
module, which isn't at all that flexible in my opinion) there seems
to be no way to accomplish this. background is my previous mail
regarding aliases based on SIP_DOMAIN. if i could just extract that
area-code from the From-header, then i could easily prefix it to the
To-header, so i would have no problems with aliases at all.
any clues?
brgds,
g. feiner
Hi Lenir,
Hexa values are not supported, so set "#102#8".
regards,
bogdan
Lenir wrote:
>Hello list,
>
>I'm using openser 1.0 and I'm using auth_radius and avp_radius to retrieve
>all my user's preferences via AVPs. Everything works very well except, that
>I cannot retrieve AVPs with value of i:0xhex. I'm trying to implement the
>ACL example in http://www.voice-system.ro/docs/avpops/ar01s08.html
>
>In my radius config I have the following:
>
>UserName Attribute op Value
>Sipuser SIP-AVP = #102#0x08
>
>In my openser.cfg I have the following:
>...
>if (uri=~"^sip:[0-9]{10}@") {
> # Send to PSTN Gateway
> xlog("L_N", " DOMESTIC CALL: from $fU to $rU\n");
> if (avp_check("i:102", "and/i:0x01")) {
> route(4); #NAT Test
> route(5); #PSTN Route
>
> } else {
> xlog("L_N", " CALL NOT ALLOWED: from $fU to $rU, please
>check $fU's ACL\n");
> sl_send_reply("503", "Service Unavailable");
> };
> return;
>};
>...
>
>This is the debug message that I get from openser:
>0(25052) ERROR:auth_radius:extract_avp: invalid AVP numrical value '0x08'
>
># ------------------------------------------------------------------------
>
>So I tried to cheat, by copying i:102 to a temporary AVP i:302 with the N
>flag to convert the string to numerical value, like so:
>UserName Attribute op Value
>Sipuser SIP-AVP = #102:0x08
>
>Openser.cfg:
>if (uri=~"^sip:[0-9]{10}@") {
> # Send to PSTN Gateway
> if (avp_copy("i:102","i:302/n") && avp_check("i:302", "and/i:0x01"))
>{
> route(4); #NAT Test
> route(5); #PSTN Route
>
> } else {
> xlog("L_N", " CALL NOT ALLOWED: from $fU to $rU, please
>check $fU's ACL\n");
> sl_send_reply("503", "Service Unavailable");
> };
> return;
>};
>
>This is the debug message that I get from openser:
>0(25135) ERROR:avpops:copy_avp: cannot convert str to int
># ------------------------------------------------------------------------
>
>And finally, I tried to force it by having the value as string, but try to
>use the ANDing op, like so:
>UserName Attribute op Value
>Sipuser SIP-AVP = #102:0x08
>
>Openser.cfg:
>...
>if (uri=~"^sip:[0-9]{10}@") {
> # Send to PSTN Gateway
> if (avp_check("i:102", "and/i:0x01")) {
> route(4); #NAT Test
> route(5); #PSTN Route
>
> } else {
> xlog("L_N", " CALL NOT ALLOWED: from $fU to $rU, please
>check $fU's ACL\n");
> sl_send_reply("503", "Service Unavailable");
> };
> return;
>};
>...
>
>This is the debug message that I get from openser:
>0(25140) ERROR:avpops:check_avp: value types don't match
># ------------------------------------------------------------------------
>
>It seems to me that the problem lies in auth_radius by not allowing
>extraction of AVPs with numerical values in hex. If we can get that work
>work, I think the rest should work fine without any alterations.
>
>Thanks for your help in advance!
>
>
>Lenir
>
>
>
>_______________________________________________
>Users mailing list
>Users(a)openser.org
>http://openser.org/cgi-bin/mailman/listinfo/users
>
>
>
I have a sip server running purely as a proxy, all it does is forward
requests onto a remote sip box.
I want to log all the requests that go through it, and use this to
create billing records, but I can't get anything out of the server.
I have setup the logging level to 8, but only get a few messages at
startup. I enabled the acc.so module, in hope of creating accounting
information that way, and also nothing.
I know this must be because all my requests are forwarded, but I
should get something surely...
Any ideas what I'm doing wrong?
debug=8 # debug level (cmd line: -dddddddddd)
fork=yes
log_stderror=no # (cmd line: -E)
check_via=no # (cmd. line: -v)
dns=no # (cmd. line: -r)
rev_dns=no # (cmd. line: -R)
fifo="/tmp/ser_fifo"
...
loadmodule "/usr/local/lib/ser/modules/acc.so"
...
# -- acc params --
modparam("acc", "log_level", 8)
modparam("acc", "log_flag", 1)
modparam("acc", "log_fmt", "mfctios")
alias="acme.co.uk"
route[0]{
# initial sanity checks -- messages with
# max_forwards==0, or excessively long requests
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
break;
};
if ( msg:len > max_len ) {
sl_send_reply("513", "Message too big");
break;
};
# record transaction using accounting module
setflag(1);
# Record route all messages to make sure that subsequent
messages
# go through sip proxy server.
record_route();
# forward all requsts to ---
forward (192.168.1.2, 5060 );
}
Hello,
OpenSER port has been committed in FreeBSD ports tree. The port will
also appear as a package in the next packages build.
There are two ways to install a port in FreeBSD. Both methods require to
update the ports tree (with cvsup or tarball). Once the port tree is
updated:
If portupgrade tool is installed just do:
portupgrade -N openser
If portupgrade is not used or you prefer the usual/old method:
cd /usr/ports/net/openser
make install clean
The port allows to select some compile options like TLS support and
database support for MySQL and/or Postgres.
Some OpenSER packages have been generated for different FreeBSD versions
(4.x, 5.x and 6.0). To install the package version just do:
pkg_add http://openser.org/pub/openser/latest/packages/FreeBSD/xxxx
where xxx is the package version you want to install. Use that URL to
know the existing packages.
When the package appears in the next official build, you will only need
to do:
pkg_add -r openser
to install the package... easy, right? ;)
Saludos
JesusR.
-------------------------------
Jesus Rodriguez
VozTelecom Sistemas, S.L.
jesusr(a)voztele.com
http://www.voztele.com
Tel. 902360305
-------------------------------
Dear All,
I have just followed the ser radius instructions to configure and install ser-0.9.4 from source in my redhat 9 machine. Whenever I enable the auth_radius module by inserting the following lines in my ser.cfg
loadmodule "/usr/local/lib/ser/modules/auth_radius.so"
modparam("auth_db", "password_column", "password")
modparam("auth_radius", "radius_config", "/usr/local/etc/radiusclient-ng/radiusclient.conf")
I got the error "bad config file (3 errors)" in the process of starting ser.
But ser will start smoothly when I commented these lines.
It takes me a lot of time. Pls help me to resolve this problem.
Here is my full ser.cfg
#
# $Id: ser.cfg,v 1.25.2.1 2005/02/18 14:30:44 andrei Exp $
#
# simple quick-start config script
#
# ----------- global configuration parameters ------------------------
#debug=3 # debug level (cmd line: -dddddddddd)
#fork=yes
#log_stderror=no # (cmd line: -E)
/* Uncomment these lines to enter debugging mode
debug=9
fork=no
log_stderror=yes
*/
check_via=no # (cmd. line: -v)
dns=no # (cmd. line: -r)
rev_dns=no # (cmd. line: -R)
#port=5060
#children=4
fifo="/tmp/ser_fifo"
# ------------------ module loading ----------------------------------
# Uncomment this if you want to use SQL database
#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/textops.so"
# Uncomment this if you want digest authentication
# mysql.so must be loaded !
loadmodule "/usr/local/lib/ser/modules/auth.so"
#loadmodule "/usr/local/lib/ser/modules/auth_radius.so"
# ----------------- setting module-specific parameters ---------------
# -- usrloc params --
modparam("usrloc", "db_mode", 0)
# Uncomment this if you want to use SQL database
# for persistent storage and comment the previous line
#modparam("usrloc", "db_mode", 2)
# -- auth params --
# Uncomment if you are using auth module
#
#modparam("auth_db", "calculate_ha1", yes)
#
# If you set "calculate_ha1" parameter to yes (which true in this config),
# uncomment also the following parameter)
#
#modparam("auth_db", "password_column", "password")
modparam("auth_radius", "radius_config", "/usr/local/etc/radiusclient-ng/radiusclient.conf")
modparam("auth_radius", "service_type", 15)
# -- rr params --
# add value to ;lr param to make some broken UAs happy
modparam("rr", "enable_full_lr", 1)
# ------------------------- request routing logic -------------------
# main routing logic
route{
# initial sanity checks -- messages with
# max_forwards==0, or excessively long requests
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
break;
};
if (msg:len >= 2048 ) {
sl_send_reply("513", "Message too big");
break;
};
# 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=="REGISTER") record_route();
# subsequent messages withing a dialog should take the
# path determined by record-routing
if (loose_route()) {
# mark routing logic in request
append_hf("P-hint: rr-enforced\r\n");
route(1);
break;
};
if (!uri==myself) {
# mark routing logic in request
append_hf("P-hint: outbound\r\n");
route(1);
break;
};
# if the request is for other domain use UsrLoc
# (in case, it does not work, use the following command
# with proper names and addresses in it)
if (uri==myself) {
if (method=="REGISTER") {
# Uncomment this if you want to use digest authentication
# if (!radius_www_authorize("iptel.org", "subscriber")) {
# www_challenge("iptel.org", "0");
# break;
# };
save("location");
break;
};
lookup("aliases");
if (!uri==myself) {
append_hf("P-hint: outbound alias\r\n");
route(1);
break;
};
# native SIP destinations are handled using our USRLOC DB
if (!lookup("location")) {
sl_send_reply("404", "Not Found");
break;
};
};
append_hf("P-hint: usrloc applied\r\n");
route(1);
}
route[1]
{
# send it out now; use stateful forwarding as it works reliably
# even for UDP2TCP
if (!t_relay()) {
sl_reply_error();
};
}
Thank you.
Best regards,
Pham Ngoc Khanh
Hi every one, i interested in making SER to send a "copy" of al the
trafic than comes to another SIP server.
I want SER to act like ever, but in adition send the messages to
another server without waitting for a response.
Sorry for my english :)
Hi,
I am trying to access
ftp://ftp.berlios.de/pub/ser/latest/
to download SER. After trying for many times also, I am not able to
reach this site
Has anybody faced this problem ? If yes, what is the solution ?
>From where to download latest SER ?
Please let me know at your earliest
Regards,
Rajesh
Confidentiality Notice
The information contained in this electronic message and any attachments to this message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged information. If
you are not the intended recipient, please notify the sender at Wipro or Mailadmin(a)wipro.com immediately
and destroy all copies of this message and any attachments.
I am having a problem with calls matching a certain pattern executing
more than one block of code. I have a block of code that looks like
if (method =~ "INVITE" && uri =~ "sip:\*12.*") { ...
do some stuff
};
and another like
if (method=="INVITE" && uri =~ "sip:1[0-9]{10}@.*"){ ...
do some stuff
};
see full block here . The problem is that whenever *12 is dialed it
executes both blocks, I thought the pattern matching is just wrong
but when a number matching the second pattern is dialed then it
doesn't execute the 1st block. Can someone please explain this
behavior to me.
--Sorry if this is a repost--