Hi
I am new to Kamailio and i am just trying to setup a kamailio (v4.2.3)
dispatcher to distribute calls to 2 asterisk using the call load
distribution algorithm (alg 10). I started to test and see how all it is
working and in the logs appears that the call load record it cannot be
found.
- ERROR: dispatcher [dispatch.c:1416]: ds_load_remove(): cannot find load
for (call id generated by asterisk)
I am getting this error trying a 2 call leg conversation when asterisk is
creating the BYE message destinated to the callee after receiving a BYE
message from the caller, and the BYE message by Asterisk reach Kamailio to
then apply the ds_load_update function
>From what i understand about ds_load_update it is that it sets the load to
an specific destination if Kamailio receives a 2xx reply of an INVITE
message, and removes it if Kamailio receives a BYE message based from the
Call-id received in that message, where it is actually failing in my
implementation at the moment
Here are the blocks of code of the dispatcher parameters and where the
function ds_load_update() is being used:
#!ifdef WITH_LOADBALANCE
#Parameters using Dispatcher from DB
# ----------
modparam("dispatcher", "db_url", DBURL)
modparam("dispatcher", "table_name", "dispatcher")
# ----------
#Enabling failover mechanism
# -----------
modparam("dispatcher", "flags", 2)
# -----------
#Setting dispatcher parameters in AVP
# -----------
modparam("dispatcher", "dst_avp", "$avp(AVP_DST)")
modparam("dispatcher", "grp_avp", "$avp(AVP_GRP)")
modparam("dispatcher", "cnt_avp", "$avp(AVP_CNT)")
modparam("dispatcher", "dstid_avp", "$avp(dsdstid)")
# -----------
#Setting dispatcher result in PV variables
# -----------
modparam("dispatcher", "attrs_pvname", "$var(attrs)")
# -----------
#Enabling dispatcher algorithm according to call loads
# -----------
modparam("dispatcher", "ds_hash_size",8)
modparam("dispatcher", "ds_hash_expire", 3600)
modparam("dispatcher", "ds_hash_initexpire", 60)
# -----------
# Setting parameters for probing dispatcher destinations
# -----------
modparam("dispatcher", "ds_ping_interval", 20)
modparam("dispatcher", "ds_ping_from", "sip:kamailio1@<Kamailio IP>")
modparam("dispatcher", "ds_probing_mode", 1)
modparam("dispatcher", "ds_probing_threshhold", 2)
modparam("dispatcher", "ds_ping_reply_codes", "class=2;code=480;code=404")
# -----------
...
route[WITHINDLG] {
if (has_totag()) {
# sequential request withing a dialog should
# take the path determined by record-routing
#!ifdef WITH_LOADBALANCE
if(is_method("BYE|CANCEL")){
xlog("L_ERROR","UBICAR BYE ds_load_update requesturi=$ru
from=$fu method=$rm callid=$ci to=$tu reply=$mt rrcode=$rr rcode=$rs\n");
ds_load_update();
}
#!endif
...
}
...
onreply_route[MANAGE_REPLY] {
#!ifdef WITH_LOADBALANCE
if(is_method("INVITE")) {
if(status=~"2[0-9][0-9]") {
xlog("L_ERROR","UBICAR setting ds_load_update
requesturi=$ru from=$fu method=$rm callid=$ci to=$tu reply=$mt rrcode=$rr
rcode=$rs");
ds_load_update();
}else if(status=~"[3-7][0-9][0-9]") {
ds_load_unset();
}
}
#!endif
if(status=~"[12][0-9][0-9]"){
route(NATMANAGE);
}
}
This is what i am getting from logs after the 2 call legs conversation
completes:
kam1 /usr/sbin/kamailio[4082]: ERROR: <script>: UBICAR: FROMASTERISK
70175143146f92975a5bff8876435911(a)192.168.10.194
kam1 /usr/sbin/kamailio[4082]: ERROR: <script>: UBICAR setting
ds_load_update requesturi=<null> from=sip:103@192.168.10.194 method=INVITE
callid=28d0f6e71625c9e87baec07f46167863(a)192.168.10.194 to=
sip:104@192.168.10.194 reply=2 rrcode=OK rcode=200
kam1 /usr/sbin/kamailio[4083]: ERROR: <script>: UBICAR setting
ds_load_update requesturi=<null> from=sip:103@192.168.10.194:5060
method=INVITE callid=1-3692(a)192.168.20.2 to=sip:104@192.168.10.194:5060
reply=2 rrcode=OK rcode=200
kam1 /usr/sbin/kamailio[4084]: ERROR: <script>: UBICAR BYE ds_load_update
requesturi=sip:104@192.168.10.190:5060 from=sip:103@192.168.30.1:5060
method=BYE callid=1-3692(a)192.168.20.2 to=sip:104@192.168.30.1:5060 reply=1
rrcode=<null> rcode=<null>
kam1 /usr/sbin/kamailio[4085]: ERROR: <script>: UBICAR BYE ds_load_update
requesturi=sip:104@192.168.30.2:22523;transport=UDP from=
sip:103@192.168.10.194 method=BYE callid=
28d0f6e71625c9e87baec07f46167863(a)192.168.10.194 to=sip:104@192.168.10.194
reply=1 rrcode=<null> rcode=<null>
kam1 /usr/sbin/kamailio[4085]: ERROR: dispatcher [dispatch.c:1416]:
ds_load_remove(): cannot find load for (
28d0f6e71625c9e87baec07f46167863(a)192.168.10.194)
Kamailio IP: 192.168.10.194
Asterisk IP:
+----+-------+-------------------------+-------+----------+-------------------------------+-------------+
| id | setid | destination | flags | priority | attrs
| description |
+----+-------+-------------------------+-------+----------+-------------------------------+-------------+
| 1 | 0 | sip:192.168.10.190:5060 | 2 | 0 |
duid=PBX1;my=pbx1;maxload=200 | pbx1 |
| 2 | 0 | sip:192.168.10.191:5060 | 2 | 0 |
duid=PBX2;my=pbx2;maxload=200 | pbx2 |
+----+-------+-------------------------+-------+----------+-------------------------------+-------------+
Hi all,
I am having some issues using get_redirects() from the UAC_Redirect module
in conjunction with t_next_contacts from the TM Module. I've searched
Google and the list but the only references I can find are several years
old.
I am attempting to configure Kamailio so it if receives a 3XX redirect
message, it will store the Contacts it contains, and attempt them in 'Q'
parameter order.
So for the Contact below-
Contact: <sip:10.0.97.21:5060>;q=0.2,<sip:5.29.13.139:5060>;q=0.5.
I want Kamailio to try 5.29.13.139, and if that times out, or is rejected
in someway, try 10.0.97.21.
If I use t_relay rather than t_next_contacts, kamailio branches the calls
and relays them in parallel regardless of Q value - this is not what I want.
If I use t_next_contacts, it attempts 5.29.13.139 which is rejected with a
401, but it doesn't attempt 5.29.13.139 and responds "408", "Request
Timeout MH 2"
Relevant script section is below, has anyone been able to get this working?
failure_route[302] {
if (t_check_status("302")){
xlog("L_ALERT","Failure Route: 302\n$mb");
get_redirects("*");
if (!t_load_contacts()) {
send_reply("500", "Server Internal Error - Cannot load contacts
MH");
exit;
};
if (!t_next_contacts()) {
t_reply("408", "Request Timeout MH");
} else {
t_on_failure("302");
t_relay();
exit;
};
} else if (t_check_status("[456][0-9][0-9]")){
if (!t_next_contacts()) {
t_reply("408", "Request Timeout MH 2");
} else {
t_on_failure("302");
t_relay();
exit;
}
}
}
Thanks,
Matthew
Hi All,
I'd like to use the Dispatcher Module along with 30X redirects, to monitor
gateway availability with SIP options and to provide redundancy / fail
over.
Some sources online suggest it's as easy as -
if ( method=="INVITE" ) {
dst_select_domain("1","4");
sl_send_reply("300","Redirect");
exit;
}
However when the 30X reply is sent, it contains no contact header.
Please could someone advise if it's possible to use the Dispatcher module
with 302 redirects, and what they syntax is?
Thanks,
Matthew
Hello,
I want to use Kamailio to load balance traffic across multiple asterisks.The problem is that my SIP traffic is related to conference, so if a SIP callfor a particular URI is sent to an Asterisk instance, any subsequent calls for thatSIP URI should be sent to the same Asterisk instance.Is there anyway to achieve this in Kamailio?
Thanks,Nitesh
Hello Sir,
I am a newbie to Kamailio and I am trying my first setup. I would like to use Kamailio to take in traffic using a SIP Trunk and Route the calls to another SIP trunk based on prefix.
I have added the incoming SIP trunk IP address to the address table on the MYSQL but I am unable to get a call routed out. Is there any sample configuration for Authentication via IP address and route the incoming SIP INVITE.
Regards,
Phoenix
Hi!
I plan to use rpid field but when trying to get from database, subscriber
table has rpid field filled, i get always NULL.
Is there any more needed than:
modparam("auth_db", "load_credentials", "rpid")
?
Just a check of variable
xlog(" Valor de RPID es : $avp(s:rpid)");
Shows me NULL all times
Thanks
KAMAILIO tcp_send query, connection problem
I have a KAMAILIO SIP server on a static IP from Comcast, using a modem/router Cisco DPC39412B.
I have a PC application server which is successfully signing on to the SIP server, via a LAN cable on the same network as the SIP server (Cisco).
In my second test, the PC application server is connected to the internet via a ZTE Falcon Z-917. In a third test, the PC application server is connected to the internet via a Talk-Talk fiber broadband. The connection does not occur.
>From the log files, the successful connection says:
Apr 1 10:44:30 SIP-Server kamailio[7817]: DEBUG: <core> [tcp_main.c:2281]: tcpconn_send_put(): tcp_send: send from reader (7817 (14)), reusing fd
Apr 1 10:44:30 SIP-Server kamailio[7817]: DEBUG: <core> [tcp_main.c:2516]: tcpconn_do_send(): tcp_send: sending...
Apr 1 10:44:30 SIP-Server kamailio[7817]: DEBUG: <core> [tcp_main.c:2550]: tcpconn_do_send(): tcp_send: after real write: c= 0x7f6270b8a4a0 n=565 fd=1
On the failed connection:
Apr 1 09:41:23 SIP-Server kamailio[7816]: DEBUG: <core> [tcp_main.c:1818]: tcp_send(): tcp_send: no open tcp connection found, opening new one
Apr 1 09:41:23 SIP-Server kamailio[7816]: DEBUG: <core> [ip_addr.c:243]: print_ip(): tcpconn_new: new tcp connection: 192.168.0.146
Apr 1 09:41:23 SIP-Server kamailio[7816]: DEBUG: <core> [tcp_main.c:1073]: tcpconn_new(): tcpconn_new: on port 55133, type 3
Apr 1 09:41:23 SIP-Server kamailio[7816]: DEBUG: <core> [tcp_main.c:1382]: tcpconn_add(): tcpconn_add: hashes: 1776:802:0, 803
Apr 1 09:41:23 SIP-Server kamailio[7816]: DEBUG: tls [tls_server.c:184]: tls_complete_init(): Using TLS domain TLSc<default
A while later, I get:
Apr 1 09:41:37 SIP-Server kamailio[7804]: DEBUG: usrloc [urecord.c:357]: wb_timer(): Binding 'hvs_us_iphone','sip:hvs_us_iphone@172.56.8.182:44341;transport=TLS;line=75dc89bd64369c7' has expired
Apr 1 09:41:38 SIP-Server kamailio[7820]: DEBUG: <core> [tcp_main.c:4320]: tcpconn_main_timeout(): tcp_main: entering timer for 0x7f6270b8a4a0 (ticks=862851529, timeout=862909176 (3602 s), wr_timeout=862851529 (0 s)), write queue: 197 bytes
Apr 1 09:41:38 SIP-Server kamailio[7820]: ERROR: <core> [tcp_main.c:4338]: tcpconn_main_timeout(): connect 192.168.0.146:55133 failed (timeout)
Apr 1 09:41:38 SIP-Server kamailio[7820]: DEBUG: <core> [tcp_main.c:4362]: tcpconn_main_timeout(): tcp_main: timeout for 0x7f6270b8a4a
Any clues or tips would be greatly appreciated!
Ed
Sure it is!
This is exactly what I was looking for! Actually I wasn't able to see that
there was a way to perform this action!
Thanks for your help, Olle!
I will try to create this, and when I have it done, I will post my script
here, so if someone else need the same problem I can help.
Now, I have just one more question about my scenario: when I register a
user, is there a way to create something like a "custom field" on the
location? To explain better: If possible, I can add something like a custom
header that says if the user is registered from a phone device or the web
interface, then I can perform the loop and replace only the oldest contact
using that device...
*Bruno Emer*
Mobile: +55 11 96540-0044
email: brunoemer(a)gmail.com
2016-04-01 17:18 GMT-03:00 Bruno Emer <brunoemer(a)gmail.com>:
> This is my problem... I want to have 2 contacts for AOR, and not only one.
>
> When the 3rd arrives, it must remove the oldest and continue with 2...
>
> *If I am using the 0x04 parameter, it will save just one contact, and the
> user will not be able to get the Invite both, in the mobile device and web
> interface.*
>
> *Bruno Emer*
>
> Mobile: +55 11 96540-0044
> email: brunoemer(a)gmail.com
> <https://www.facebook.com/bruno.emer.5>
> <https://www.linkedin.com/profile/view?id=86461237&trk=spm_pic>
> <https://twitter.com/brunoemer_>
> <https://www.flickr.com/photos/122070309@N03/>
> <http://google.com/+BrunoEmer> <http://instagram.com/brunoemer_>
>
> 2016-04-01 17:07 GMT-03:00 Bruno Emer <brunoemer(a)gmail.com>:
>
>> Hello, *Olle!*
>>
>> *Thanks for your help in this case, and don't worry about the time
>> (actually I wasn't even expecting to get an answer today).*
>>
>>
>> *I know the max_contacts parameter. But the problem is that if I set the
>> max_contacts to 2, when the user tries to register again, he gets an error
>> message 503. The point is that I want to get the user registered, and
>> replace the oldest location entry for the newest one.*
>>
>>
>>
>> *Bruno Emer*
>>
>> Mobile: +55 11 96540-0044
>> email: brunoemer(a)gmail.com
>>
>> 2016-04-01 16:31 GMT-03:00 Bruno Emer <brunoemer(a)gmail.com>:
>>
>>> Hello all.
>>>
>>> I have problem here and I tried to find a solution and search over
>>> internet, but without success.
>>>
>>> My scenario is the following: I have an application that must be
>>> registered in Kamailio when a user logs in the web interface, so he can get
>>> calls (something like a web softphone using webrtc). At this point, we are
>>> OK, and everything is working fine.
>>>
>>> To get these register functions I am using the parameter
>>> "save("location", "0x04")" as described in the REGISTRAR module
>>> documentation, so if a user logs in another web browser or computer, only
>>> the last one will continue registered and all calls will be forwarded to
>>> him.
>>>
>>> The point is that now we are creating a phone app that will do almost
>>> the same thing as the web interface, allowing users to receive calls using
>>> the mobile device, and here is my problem: I want to allow my users to be
>>> registered on two devices at the same time, but if a user logs into another
>>> device, I don't want to reply with a 503. I want to allow the user to
>>> register again, deregistering the oldest contact.
>>>
>>> I saw that there is a module named "ims_usrloc_scscf" and on its
>>> description it says "implemented overwrite oldest contact behaviour",
>>> but I couldn't find any documentation about it.
>>>
>>> So, is there a way to get this working today?
>>>
>>>
>>> *Bruno Emer*
>>>
>>> Mobile: +55 11 96540-0044
>>> email: brunoemer(a)gmail.com
>>>
>>
>>
>
hi ,
I want to use kamailio as a proxy ;
/ gateway1 ----->pstn
/
1、 call from backend server ---> kamailio ----->gateway2 -----> pstn
\
\ gateway3 ------->pstn
2、caller and callee number translation ;
Could you please give me some suggest;
Wade
From China
liwei(a)neulinx.com