Hello,
I am going to visit CeBIT 2010 in Hannover next week. Drop me an email
if you are around and want to meet and chat about Kamailio, SIP Router
projects, etc.
Cheers,
Daniel
--
Daniel-Constantin Mierla
Kamailio SIP Router Masterclass, Berlin, March 22-26, 2010
* http://www.asipto.com/index.php/sip-router-masterclass/
Are AVP arrays still the only way to create a list of scalars as of K
3.0.0? Or are there other, more graceful ways to accommodate this need now?
AVPs are a very useful feature, though the syntax is not documented in
'avpops' or the cookbook except rather incidentally:
$var(i) = 0;
while(is_avp_set("$(avp(s:somename)[$var(i)])")) {
xlog("L_INFO", "Value at index $var(i):
$(avp(s:somename)][$var(i)])\n");
$var(i) = $var(i) + 1;
}
Is there a better way to handle this now, perhaps via some features
imported from SER? Script variables ($var(...)) do not support
subscripts judging by the cookbook; do they? Are there other options I
am unaware of?
Thanks,
--
Alex Balashov - Principal
Evariste Systems LLC
Tel : +1 678-954-0670
Direct : +1 678-954-0671
Web : http://www.evaristesys.com/
Here is a problem I am sure is not new (1.5.x):
modparam("acc", "db_extra", "gateway_id=$avp(s:gateway_id)")
route {
...
$avp(s:gateway_id) = 13;
$ru = "some.gw1";
t_on_failure("1");
if(!t_relay())
sl_reply_error();
}
# Serial forking rollover route
failure_route[1] {
if(t_was_cancelled())
exit;
$avp(s:gateway_id) = 14;
$rd = "some.gw2";
append_branch();
t_relay();
}
The problem is, when serial forking happens, the CDR rows in 'acc' still
show a value of 13 for 'gateway_id'. This is obviously because the
value is sampled at the time of the initial stateful relay processing
and is not updated afterward.
Any easy/elegant fix? I can think of several fixes that don't involve
using 'acc', obviously, but I'd rather avoid that...
--
Alex Balashov - Principal
Evariste Systems LLC
Tel : +1 678-954-0670
Direct : +1 678-954-0671
Web : http://www.evaristesys.com/
Klaus, Alex,
you're right. I've seen Klaus's suggestion only after writing my email message. This is the best solution and solves my problem!
regards,
Klaus
>
>
> Am 24.02.2010 15:41, schrieb Klaus Feichtinger:
> > Hello SR-users and -developers,
> >
> > I have the question if parameters for a function in the config script
> > (e.g. "t_relay(host, port)") in general can be set with a variable
> > ($var(xy)). Because of having a set of SIP servers / gateways
> distributed
> > over a wide area and therefore keeping the configuration as simple as
> > possible, I would like to define a custom variable, assign it to a $var
> > and use this variable as attribute for a relay function. In this case
> the
> > variable would represent a string of an IP-address (e.g. "10.1.1.55").
> > When this would work I only have to adapt the custom variables on top of
> > each config script and could let the rest "as it is".
> >
> >
> > First practical tests have shown, that the functions are NOT happy with
> these "attributes". It can be used without any problems for if-else-
> > statements, but I fear not for functions....
> >
> > The practical scenario looks like:
> >
> > tc.ip11 = "10.16.65.101" desc "";
> > [...]
> > route {
> > $var(test) = $sel(cfg_get.tc.ip11);
> > [...]
> > if (!t_relay($var(test), "5061"))
>
> A workaround for t_relay:
>
> $du = "sip:"+$var(test)+":5061";
> t_relay();
>
>
> klaus
>
>
> > [...]
> > }
> >
> > This configuration resulted in following error messages:
> >
> > <core> [cfg.y:3326]: parse error in config file
> /usr/local/etc/kamailio/kamailio.cfg, line 413, column 18-35: syntax error
> > <core> [cfg.y:3326]: parse error in config file
> /usr/local/etc/kamailio/kamailio.cfg, line 413, column 18-35: call params error#012
> > <core> [cfg.y:3326]: parse error in config file
> /usr/local/etc/kamailio/kamailio.cfg, line 413, column 18-35: call params error#012
> > <core> [cfg.y:3326]: parse error in config file
> /usr/local/etc/kamailio/kamailio.cfg, line 413, column 38-41: Function parameter with integer
> value not allowed#012
> >
> >
> > Please, could anybody clarify if this should work or not? If not - is
> any
> > alternative possibility available for "automating" function attributes
> > instead of re-writing each function using the same string attribute?
> >
> > Thanks in advance,
> >
> > Klaus
> >
--
GMX DSL: Internet, Telefon und Entertainment für nur 19,99 EUR/mtl.!
http://portal.gmx.net/de/go/dsl02
Hello SR-users and -developers,
I have the question if parameters for a function in the config script
(e.g. "t_relay(host, port)") in general can be set with a variable
($var(xy)). Because of having a set of SIP servers / gateways distributed
over a wide area and therefore keeping the configuration as simple as
possible, I would like to define a custom variable, assign it to a $var
and use this variable as attribute for a relay function. In this case the
variable would represent a string of an IP-address (e.g. "10.1.1.55").
When this would work I only have to adapt the custom variables on top of
each config script and could let the rest "as it is".
First practical tests have shown, that the functions are NOT happy with these "attributes". It can be used without any problems for if-else-
statements, but I fear not for functions....
The practical scenario looks like:
tc.ip11 = "10.16.65.101" desc "";
[...]
route {
$var(test) = $sel(cfg_get.tc.ip11);
[...]
if (!t_relay($var(test), "5061"))
[...]
}
This configuration resulted in following error messages:
<core> [cfg.y:3326]: parse error in config file /usr/local/etc/kamailio/kamailio.cfg, line 413, column 18-35: syntax error
<core> [cfg.y:3326]: parse error in config file /usr/local/etc/kamailio/kamailio.cfg, line 413, column 18-35: call params error#012
<core> [cfg.y:3326]: parse error in config file /usr/local/etc/kamailio/kamailio.cfg, line 413, column 18-35: call params error#012
<core> [cfg.y:3326]: parse error in config file /usr/local/etc/kamailio/kamailio.cfg, line 413, column 38-41: Function parameter with integer value not allowed#012
Please, could anybody clarify if this should work or not? If not - is any
alternative possibility available for "automating" function attributes
instead of re-writing each function using the same string attribute?
Thanks in advance,
Klaus
--
Sicherer, schneller und einfacher. Die aktuellen Internet-Browser -
jetzt kostenlos herunterladen! http://portal.gmx.net/de/go/chbrowser
Hello Kamailio-3 users,
I have two questions regarding usage of variables within the config file (as published in the NEW FEATURES of Kamailio 3.0.0).
The reason why I want to use variables instead of standard configuration
lines is the maintainability of my SIP servers. I have a group of about 20
sip servers distributed over a wide area. Especially routing rules might
change during operation of the servers and must be adapted on all servers.
Therefore I want to use variables, defined at the beginning of each config
file. Within the config file / the different routing blocks I want to
reference to these variables. That would be much easier for automatic config script adaptation with a linux script (e.g.) than parsing the whole config file for special text phrases.
QUESTION 1:
==========
Is it impossible using a variable for requesting a SRC_IP address? With my
current configuration I always see an entry in the SYSLOG that looks as
follows: "<core> [route.c:1531]: BUG: comp_ip: invalid type for src_ip or dst_ip (20)"
The configuration lines look like:
$var(lst_gwIpRange) = "10.16.48.6[0-2]";
[...]
if (src_ip=~$var(lst_gwIpRange)) {
[...]
}
Is maybe a transformation missing/necessary to avoid the error message (which causes a malfunction)? Can anybody give me a hint?
QUESTION 2:
==========
The second problem I found is, that the config variables can be configured
within a route block only and not - as expected - e.g. at the top of the
config file (in the same way as the custom variables). I can't use the custom variables as they are, because I will use more complex variables, which are a mixture of up to three custom variables. These "complex" variables will be used in more than one routing block. Therefore I have to define these variables in every routing block...... Is an alternative (easier) solution with a single definition available, too?
An example of my problem is as follows:
# custom variables defined on top of the kamailio.cfg file
tst.loc_ipaddr = "10.10.1.1" desc "IP addr of the local SIP Server"
tst.loc_prefix = "11" desc "prefix of this SRV"
tst.distRu1 = "51[0-9].*" desc "variable representing ID1"
# the final variable should look like "sip:1151[0-9].*@10.10.1.1"
# and is used in 3 routing blocks
route[]
$var(test) = "sip:" + $sel(cfg_get.tst.loc_prefix) +
$sel(cfg_get.tst.distRu1) + "@" + $sel(cfg_get.tst.loc_ipaddr);
[...]
route[TEST1]
$var(test) = "sip:" + $sel(cfg_get.tst.loc_prefix) +
$sel(cfg_get.tst.distRu1) + "@" + $sel(cfg_get.tst.loc_ipaddr);
[...]
route[TEST2]
$var(test) = "sip:" + $sel(cfg_get.tst.loc_prefix) +
$sel(cfg_get.tst.distRu1) + "@" + $sel(cfg_get.tst.loc_ipaddr);
[...]
Thanks in advance for any hints!
Regards,
Klaus Feichtinger
--
Sicherer, schneller und einfacher. Die aktuellen Internet-Browser -
jetzt kostenlos herunterladen! http://portal.gmx.net/de/go/atbrowser
hi guys,
anybody here tried using snmpstats with 3.0.0?
i keep on getting "No such Object"
already verified that kamailio is talking to agentx master.
net-snmp version 5.3.3 compiled from source
also disabled openssl and md5 in net-snmp to prevent any undefined symbols
been reading the mailing lists and so far nothing helped. seems like only a
couple of guys
are using this module?
Kelvin Chua
Should sql_result_free() always be called, no matter what the
circumstance, in order to discharge memory allocated to query result
sets and/or metadata?
Or is it not necessary in certain situations, for example when script is
broken via 'exit', i.e.
sql_query("db", "SELECT ...", "res");
if(! $dbr(res=>rows)) {
# Is it necessary to call sql_result_free() here?
sl_send_reply("404", "Not Found");
exit;
}
Are results implicitly freed at the end of route script execution
anyway? Are they tied to transaction persistence in any way?
Thanks,
--
Alex Balashov - Principal
Evariste Systems LLC
Tel : +1 678-954-0670
Direct : +1 678-954-0671
Web : http://www.evaristesys.com/
Hello,
I am a Kamailio noob :). I am trying to get Asterisk to forward calls to
my SIP provider via Kamailio. The same machine is running Kamailio and
Asterisk. I do not want to consume credentials as they have to be passed
on all the way to my SIP provider. There is no NAT of any sorts. SIP
Phone/Users connect to Asterisk.I do not need to authenticate when forwarding call from Asterisk to Kamailio as they are
both running on the same server but I do need to make sure that Kamailio
dials and forwards 011+number to be sent from local host port
5062(Asterisk listener) to SIP provider only. I have 6 Public IP addresses
mapped on the server. I want to use the force_send_socket to allow me to
change source IP of SIP requests when being sent to the SIP provider on the basis of credentials username in the request. I have pasted my config below. Please tell me what am I doing wrong here. In the kamctlrc file i have SIP_DOMAIN=localhost
Thank you
#------CONFIG BEGINS------------------
mpath="/lib/kamailio/modules_k/"
debug=3
fork=yes
children=4
auto_aliases=no
alias=localhost
alias=192.168.10.1
alias=192.168.10.2
alias=192.168.10.3
alias=192.168.10.4
alias=192.168.10.5
alias=192.168.10.6
disable_tcp=yes
loadmodule "sl.so"
loadmodule "rr.so"
loadmodule "maxfwd.so"
loadmodule "/lib/kamailio/modules/tm.so"
loadmodule "textops.so"
modparam("rr", "enable_full_lr", 1)
route {
# Sanity Check
# ------------
# filter too old messages
if (!mf_process_maxfwd_header("10")) {
log("LOG: Too many hops\n");
sl_send_reply("483","Too Many Hops");
break;
};
if(msg:len>2048) {
sl_send_reply("413", "message too large to be forwarded over UDP without fragmentation");
exit;
};
# Record Route and NAT Preset
# --------------------
if (method != "REGISTER") {
record_route();
};
# Loose Route
# -----------
if (loose_route()) {
route(1);
return;
};
# Call Type Processing
# --------------------
if (uri != myself) {
route(1);
return;
};
if (uri == myself) {
if (method == "BYE") {
route(4);
return;
} else if (method == "CANCEL") {
route(4);
return;
} else if (method == "INVITE") {
route(3);
return;
} else if (method == "NOTIFY") {
sl_send_reply("200", "Understood");
return;
} else if (method == "OPTIONS") {
sl_send_reply("200", "Got it");
return;
}
};
route(1);
}
# Default Message Handling
# -----------------------
route[1] {
t_on_reply("1");
if (!t_relay()) {
sl_reply_error();
};
}
# INVITE Message Handling
# ----------------------------------
# ----------------------------------
route[3] {
if (uri =~ "^sip:011[0-9]@*") {
rewritehostport("sip.voipprovider.com:5060");
if (search("^(Contact|m): .*user01*(a)(127\.0\.0\.1|localhost)")) {
force_send_socket(192.168.0.2:5060);
};
route(1);
return;
};
}
# CANCEL and BYE Message Handling
# ----------------------------------
route[4] {
route(1);
}
Hello,
I am trying to encrypt/decrypt all packets belonging to an RTP stream. I
am using Kamailio v1.5 with rtpproxy, where Kamailio forces the rtpstream
through rtpproxy.
Does rtpproxy provide a hook so that i can gain access to each RTP packet
to perform encryption/decryption ? I do not want to end up having a patch
for rtpproxy that i need to update whenever there is a new release of
rtpproxy.
--
Thanks and Regards,
Vikram Ragukumar.