Compare commits

...

36 Commits
master ... 3.22

Author SHA1 Message Date
  OnNet fd0b8157f1 Update default.cfg (#90) 10 years ago
  David Singer 7c430bb659 KAZOO-4863 As Admin need logging for slow Kamilio script commands and enhanced failure logs (#89) 10 years ago
  lazedo aa84c04980 Merge pull request #88 from 2600hz/lazedo-patch-2 10 years ago
  lazedo 68588fff0a remove antiflood call on empty password 10 years ago
  lazedo 1cac24ad30 HELP-22885 anti-flood role may block media servers 10 years ago
  lazedo d7b6abaacd fix antiflood reset auth 10 years ago
  Luis Azedo 6280869210 KAZOO-4435 back port early-only 10 years ago
  lazedo d0eab21f59 HELP-21051 reselect when associated media is unavailable (#77) 10 years ago
  lazedo c48afe8d3e HELP-22078 query cluster for call-id when relevant (#78) 10 years ago
  bitbashing 687a9c5e79 Revert "HELP-21493 respond 503 when there is no ecallmgr" (#82) 10 years ago
  lazedo e0e9c75fb6 HELP-21493 respond 503 when there is no ecallmgr (#79) 10 years ago
  Darren Schreiber 4281c7cecc HELP-22404 fix issue where Asterisk hates multiple m= lines 10 years ago
  lazedo 06d7e45303 Merge pull request #74 from 2600hz/3.22-kam-3.3.5 10 years ago
  Luis Azedo 4718a745a1 compatibility with new active_watchers 10 years ago
  karl anderson 4dd178403a HELP-21099: restore http-server-close 10 years ago
  karl anderson d65cf9e928 HELP-21046: force_fine_statistics has been replaced with rates_mode 10 years ago
  lazedo 713f512758 disable unsupported events 10 years ago
  karl anderson 1313be3edb update the default ports 10 years ago
  karl anderson 52349481eb keep this list together 10 years ago
  bitbashing 231a15f58b Merge pull request #71 from 2600hz/lazedo-patch-1 10 years ago
  bitbashing 7d6920bd27 Merge pull request #72 from 2600hz/presence 10 years ago
  lazedo 5c15f139fa add presence query & notify & sync 10 years ago
  lazedo fdcebb3368 registrar: check empty password 10 years ago
  bmac901 474d130f0c Update tls-role.cfg 10 years ago
  bitbashing 66d136678c Merge pull request #70 from 2600hz/lazedo-patch-1 10 years ago
  lazedo e28dc9974e fast pickup compatibility with FS 1.6 10 years ago
  bitbashing 56af24028e Merge pull request #69 from 2600hz/lazedo-patch-1 10 years ago
  lazedo 051a02948d kamailio presence: use $subs(uri) 10 years ago
  lazedo 6b7e3bc581 remove double checked retrans 10 years ago
  lazedo 6d657722dc vNext - check retrans 10 years ago
  lazedo 7ba68ada1b presence_xml : force_dummy_presence 10 years ago
  lazedo 1477c900bb Update presence-role.cfg 10 years ago
  Luis Azedo 8a131241f7 add support for channel xml fetch on 1.4.26 10 years ago
  Luis Azedo 80be7c5f5a add support for transfer events in 1.4.26 10 years ago
  swysor 766ef534cb KAZOO-4329: removed fifo file ref from local.cfg as this defaults to /var/run/kamailio 10 years ago
  swysor 6e227617c1 KAZOO-4329: Moved kamailio_fifo back to /var/run/kamailio 10 years ago
19 changed files with 285 additions and 31 deletions
Split View
  1. +3
    -1
      freeswitch/freeswitch.xml
  2. +3
    -1
      freeswitch/sip_profiles/sipinterface_1.xml
  3. +1
    -0
      haproxy/haproxy.cfg
  4. +7
    -3
      kamailio/antiflood-role.cfg
  5. +1
    -1
      kamailio/dbtext/active_watchers
  6. +1
    -1
      kamailio/dbtext/version
  7. +75
    -5
      kamailio/default.cfg
  8. +15
    -0
      kamailio/defs.cfg
  9. +2
    -1
      kamailio/dispatcher-role.cfg
  10. +14
    -6
      kamailio/fast-pickup-role.cfg
  11. +3
    -0
      kamailio/kamailio.cfg
  12. +7
    -4
      kamailio/local.cfg
  13. +5
    -2
      kamailio/presence-role.cfg
  14. +32
    -0
      kamailio/presence_notify_sync-role.cfg
  15. +65
    -0
      kamailio/presence_query-role.cfg
  16. +43
    -0
      kamailio/presence_sync-role.cfg
  17. +5
    -5
      kamailio/registrar-role.cfg
  18. +1
    -0
      kamailio/tls-role.cfg
  19. +2
    -1
      rabbitmq/rabbitmq.config

+ 3
- 1
freeswitch/freeswitch.xml View File

@ -37,10 +37,12 @@
<X-PRE-PROCESS cmd="set" data="send_silence_when_idle=400"/>
<X-PRE-PROCESS cmd="set" data="codecs=H263,OPUS,G7221@32000h,G7221@16000h,G722,PCMU,PCMA,G729,GSM,Speex"/>
<X-PRE-PROCESS cmd="set" data="codecs=OPUS,H263,H264,G7221@32000h,G7221@16000h,G722,PCMU,PCMA,G729,GSM,Speex"/>
<X-PRE-PROCESS cmd="set" data="ignore_display_updates=false"/>
<X-PRE-PROCESS cmd="set" data="sdp_m_per_ptime=false"/>
<section name="configuration" description="Various Configuration">
<X-PRE-PROCESS cmd="include" data="autoload_configs/*.xml"/>
</section>


+ 3
- 1
freeswitch/sip_profiles/sipinterface_1.xml View File

@ -183,10 +183,12 @@
<!--<param name="watchdog-event-timeout" value="30000"/>-->
<!-- LOGGING -->
<!-- Logging / Events -->
<param name="debug" value="info"/>
<param name="sip-trace" value="true"/>
<param name="log-auth-failures" value="true"/>
<param name="fire-transfer-events" value="true"/>
<param name="channel-xml-fetch-on-nightmare-transfer" value="true"/>
</settings>
<gateways>
<X-PRE-PROCESS cmd="include" data="/etc/freeswitch/gateways/*.xml"/>


+ 1
- 0
haproxy/haproxy.cfg View File

@ -14,6 +14,7 @@ defaults
option redispatch
option httpchk GET /
option allbackups
option http-server-close
maxconn 2000
retries 3
timeout connect 6000ms


+ 7
- 3
kamailio/antiflood-role.cfg View File

@ -21,7 +21,9 @@ modparam("pike", "remove_latency", ANTIFLOOD_RATE_EXPIRE)
route[ANTIFLOOD_RATE_LIMIT]
{
if (has_totag() || isflagset(FLAG_TRUSTED_SOURCE)) {
if (has_totag()
|| isflagset(FLAG_TRUSTED_SOURCE)
|| isflagset(FLAG_INTERNALLY_SOURCED)) {
return;
}
@ -35,7 +37,9 @@ route[ANTIFLOOD_RATE_LIMIT]
route[ANITFLOOD_AUTH_LIMIT]
{
if (isflagset(FLAG_TRUSTED_SOURCE)) {
if (has_totag()
|| isflagset(FLAG_TRUSTED_SOURCE)
|| isflagset(FLAG_INTERNALLY_SOURCED)) {
return(1);
}
@ -58,7 +62,7 @@ route[ANTIFLOOD_SUCCESSFUL_AUTH]
route[ANTIFLOOD_RESET_AUTH]
{
$var(user) = "sip:" + $(kzE{kz.json,Username}) + "@" + $(kzE{kz.json,Realm});
$var(user) = $(kzE{kz.json,Username}) + "@" + $(kzE{kz.json,Realm});
sht_rm_name_re("antiflood=>$(var(user){re.subst,/\\./\\\\./g})::.*");
}


+ 1
- 1
kamailio/dbtext/active_watchers View File

@ -1 +1 @@
id(int,auto) presentity_uri(string) watcher_username(string) watcher_domain(string) to_user(string) to_domain(string) event(string) event_id(string,null) to_tag(string) from_tag(string) callid(string) local_cseq(int) remote_cseq(int) contact(string) record_route(string,null) expires(int) status(int) reason(string,null) version(int) socket_info(string) local_contact(string) from_user(string) from_domain(string) updated(int) updated_winfo(int)
id(int,auto) presentity_uri(string) watcher_username(string) watcher_domain(string) to_user(string) to_domain(string) event(string) event_id(string,null) to_tag(string) from_tag(string) callid(string) local_cseq(int) remote_cseq(int) contact(string) record_route(string,null) expires(int) status(int) reason(string,null) version(int) socket_info(string) local_contact(string) from_user(string) from_domain(string) updated(int) updated_winfo(int) flags(int) user_agent(string,null)

+ 1
- 1
kamailio/dbtext/version View File

@ -2,7 +2,7 @@ table_name(string) table_version(int)
address:6
trusted:5
pua:7
active_watchers:11
active_watchers:12
presentity:4
watchers:3
location:8

+ 75
- 5
kamailio/default.cfg View File

@ -30,6 +30,8 @@ mem_summary = 12
log_stderror = no
log_facility = LOG_LOCAL0
log_name="kamailio"
latency_limit_action=2000
latency_limit_db=2000
####### Alias Parameters #########
auto_aliases = yes
@ -86,6 +88,9 @@ mpath="/usr/lib64/kamailio/modules/"
######## Kamailio control connector module ########
loadmodule "ctl.so"
######## set params at runtime
loadmodule "cfg_rpc.so"
######## Kamailio core extensions module ########
loadmodule "kex.so"
@ -138,7 +143,6 @@ loadmodule "xlog.so"
####### FIFO support for Management Interface ########
loadmodule "mi_fifo.so"
modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")
######## UAC ########
loadmodule "uac.so"
@ -220,6 +224,15 @@ include_file "registrar-sync-role.cfg"
#!ifdef FAST_PICKUP-ROLE
include_file "fast-pickup-role.cfg"
#!endif
#!ifdef PRESENCE_SYNC-ROLE
include_file "presence_sync-role.cfg"
#!endif
#!ifdef PRESENCE_QUERY-ROLE
include_file "presence_query-role.cfg"
#!endif
#!ifdef PRESENCE_NOTIFY_SYNC-ROLE
include_file "presence_notify_sync-role.cfg"
#!endif
####### Permissions module ##########
loadmodule "permissions.so"
@ -230,6 +243,8 @@ modparam("permissions", "db_mode", 1)
route
{
route(SANITY_CHECK);
route(CHECK_RETRANS);
# log the basic info regarding this call
xlog("L_INFO", "$ci|start|received $pr request $rm $ou");
@ -294,6 +309,15 @@ route
route(EXTERNAL_TO_INTERNAL_RELAY);
}
route[CHECK_RETRANS]
{
# handle retransmissions
if(t_precheck_trans()) {
t_check_trans();
exit;
}
}
route[SANITY_CHECK]
{
if (!sanity_check()) {
@ -501,9 +525,6 @@ route[PREPARE_INITIAL_REQUESTS]
exit();
}
# handle re-transmissions
t_check_trans();
if (is_method("UPDATE")) {
xlog("L_WARN", "$ci|end|update outside dialog not allowed");
send_reply("403", "Dialog does not exist");
@ -560,6 +581,7 @@ route[INTERNAL_TO_EXTERNAL_RELAY]
remove_hf_re("^X-.*");
t_on_reply("EXTERNAL_REPLY");
t_on_failure("EXTERNAL_FAULT");
t_set_fr(0, 10000);
@ -599,6 +621,8 @@ route[EXTERNAL_TO_INTERNAL_RELAY]
onreply_route[EXTERNAL_REPLY]
{
# this route handles replies that are coming from a carrier or customer device
xlog("L_INFO", "$ci|start|received external $rm reply $T_reply_code $rr source $si:$sp");
xlog("L_INFO", "$ci|log|external reply $T_reply_code");
#!ifdef WEBSOCKETS-ROLE
@ -622,9 +646,10 @@ onreply_route[EXTERNAL_REPLY]
onreply_route[INTERNAL_REPLY]
{
# this route handles replies that are comming from our media server
# this route handles replies that are coming from our media server
xlog("L_INFO", "$ci|start|received internal reply $T_reply_code $rr");
xlog("L_INFO", "$ci|log|source $si:$sp");
xlog("L_INFO", "$ci|log|method $rm");
#!ifdef WEBSOCKETS-ROLE
route(NAT_WEBSOCKETS_CORRECT);
@ -665,6 +690,20 @@ onreply_route[INTERNAL_REPLY]
$var(reply_reason) = $rr;
}
failure_route[EXTERNAL_FAULT]
{
if($T(reply_type)==1){
# a request timeout, destination did not respond in time, does not show up in on_reply
# http://www.kamailio.org/wiki/cookbooks/4.3.x/pseudovariables#t_name
if(isflagset(FLAG_SESSION_PROGRESS)) {
#may be during re-invite, update, bye, cancel, etc or initial invite after 18x (transaction has a to tag)
xlog("L_INFO", "$ci|start|external failure route, $T_reply_code locally generated for method $rm after progress");
} else {
xlog("L_INFO", "$ci|start|external failure route, $T_reply_code locally generated for method $rm no progress");
}
}
}
failure_route[INTERNAL_FAULT]
{
# this branch handles failures (>=300) to our media servers,
@ -672,6 +711,16 @@ failure_route[INTERNAL_FAULT]
# if the failure cause was due to the transaction being
# cancelled then we are complete
if($T(reply_type)==1){
# a request timeout, destination did not respond in time, does not show up in on_reply
# http://www.kamailio.org/wiki/cookbooks/4.3.x/pseudovariables#t_name
if(isflagset(FLAG_SESSION_PROGRESS)) {
#may be during re-invite, update, bye, cancel, etc or initial invite after 18x (transaction has a to tag)
xlog("L_INFO", "$ci|start|internal failure route, $T_reply_code locally generated for method $rm after progress");
} else {
xlog("L_INFO", "$ci|start|internal failure route, $T_reply_code locally generated for method $rm no progress");
}
}
if (t_is_canceled()) {
xlog("L_INFO", "$ci|log|transaction was cancelled");
exit;
@ -784,6 +833,20 @@ event_route[kazoo:mod-init]
#!endif
#!ifdef PRESENCE_SYNC-ROLE
$var(payload) = "{ 'exchange' : 'presence' , 'type' : 'topic', 'queue' : 'PRESENCE-QUEUE-MY_HOSTNAME', 'routing' : 'sync', 'auto_delete' : 1, 'durable' : 0, 'no_ack' : 1, 'wait_for_consumer_ack' : 0 }";
kazoo_subscribe("$var(payload)");
#!endif
#!ifdef PRESENCE_QUERY-ROLE
$var(payload) = "{ 'exchange' : 'omnipresence' , 'type' : 'topic', 'routing' : 'presence.search_req.*', 'federate' : 1 }";
kazoo_subscribe("$var(payload)");
#!endif
}
event_route[kazoo:consumer-event]
@ -801,5 +864,12 @@ event_route[kazoo:consumer-event-connection-closed]
xlog("L_INFO","connection to $(kzE{kz.json,host}) closed");
}
#!ifdef PRESENCE_NOTIFY_SYNC-ROLE
event_route[tm:local-request]
{
route(PRESENCE_LOCAL_NOTIFY);
}
#!endif
# vim: tabstop=4 softtabstop=4 shiftwidth=4 expandtab

+ 15
- 0
kamailio/defs.cfg View File

@ -0,0 +1,15 @@
## NOTE: DO NOT CHANGE THIS FILE, EDIT local.cfg ##
####### defs ########
#!ifndef KAZOO_DB_URL
#!substdef "!KAZOO_DB_URL!text:///etc/kazoo/kamailio/dbtext!g"
#!endif
#!ifndef MAX_WHILE_LOOPS
#!substdef "!MAX_WHILE_LOOPS!500!g"
#!endif
# vim: tabstop=4 softtabstop=4 shiftwidth=4 expandtab

+ 2
- 1
kamailio/dispatcher-role.cfg View File

@ -104,7 +104,8 @@ route[DISPATCHER_FIND_ROUTES]
$var(prefered_route) = $sht(associations=>$var(contact_uri));
xlog("L_INFO", "$ci|log|found association for contact uri $var(contact_uri)");
if (!route(DISPATCHER_REORDER_ROUTES)) {
$sht(associations=>$var(association)) = $null;
$sht(associations=>$var(contact_uri)) = $null;
route(DISPATCHER_FIND_ROUTES);
}
}
}


+ 14
- 6
kamailio/fast-pickup-role.cfg View File

@ -31,11 +31,14 @@ route[FAST_PICKUP_ATTEMPT]
$var(replaced_call_id) = $(hdr(Replaces){s.select,0,;});
}
if($var(replaced_call_id) != "none") {
xlog("L_INFO", "$ci|log|replaces call-id $var(replaced_call_id)");
### when the cluster has the ability to respond to parked call-id (fake call)
### remove the 2nd question '&& !($(ru{uri.user}) =~ "\*3")'
if($var(replaced_call_id) != "none" && !($(ru{uri.user}) =~ "\*3")) {
xlog("L_INFO", "$ci|log|querying cluster for location of call-id $var(replaced_call_id)");
$var(amqp_payload_request) = '{"Event-Category" : "call_event" , "Event-Name" : "channel_status_req", "Call-ID" : "' + $var(replaced_call_id) + '", "Active-Only" : true }';
$var(amqp_routing_key) = "call.status_req." + $(var(replaced_call_id){kz.encode});
sl_send_reply("100", "Attempting K query");
sl_send_reply("100", "Attempting to connect your call");
$avp(kz_timeout) = 500;
if(kazoo_query("callevt", $var(amqp_routing_key), $var(amqp_payload_request))) {
$du = $(kzR{kz.json,Switch-URL});
if($du != $null) {
@ -85,13 +88,18 @@ route[FAST_PICKUP_INIT]
{
$var(AppName) = $(kzE{kz.json,App-Name});
if($var(AppName) == "park") {
$var(Pickup) = ";kazoo-pickup=true";
$var(Pickup) = ";a-leg=true";
} else {
if($(kzE{kz.json,State}) == "confirmed"){
$var(Pickup) = ";early-only=true";
} else {
$var(Pickup) = "";
}
}
$sht(fp=>$(kzE{kz.json,Call-Cookie})::Switch-URI) = $(kzE{kz.json,Switch-URI});
$sht(fp=>$(kzE{kz.json,Call-Cookie})::Call-ID) = $(kzE{kz.json,Target-Call-ID});
$sht(fp=>$(kzE{kz.json,Call-Cookie})::URI) = "sip:" + $(kzE{kz.json,From-User}) + "@" + $(kzE{kz.json,To-Realm}) + $var(Pickup);
$sht(fp=>$(kzE{kz.json,Call-Cookie})::Call-ID) = $(kzE{kz.json,Target-Call-ID}) + $var(Pickup);
$sht(fp=>$(kzE{kz.json,Call-Cookie})::URI) = "sip:" + $(kzE{kz.json,From-User}) + "@" + $(kzE{kz.json,To-Realm}) ;
}
# vim: tabstop=4 softtabstop=4 shiftwidth=4 expandtab

+ 3
- 0
kamailio/kamailio.cfg View File

@ -26,6 +26,9 @@
####### Local Configuration ########
include_file "local.cfg"
####### defaults not configured in local ########
include_file "defs.cfg"
####### Default Configuration ######
include_file "default.cfg"


+ 7
- 4
kamailio/local.cfg View File

@ -25,6 +25,9 @@ debug = L_INFO
# # #!trydef MESSAGE-ROLE
# # #!trydef PUSHER-ROLE
# # #!trydef REGISTRAR_SYNC-ROLE
# # #!trydef PRESENCE_QUERY-ROLE
# # #!trydef PRESENCE_SYNC-ROLE
# # #!trydef PRESENCE_NOTIFY_SYNC-ROLE
################################################################################
## SERVER INFORMATION
@ -85,10 +88,10 @@ mhomed=0
#!substdef "!UDP_ALG_SIP!udp:MY_IP_ADDRESS:7000!g"
#!substdef "!TCP_ALG_SIP!tcp:MY_IP_ADDRESS:7000!g"
#!substdef "!TLS_ALG_SIP!tls:MY_IP_ADDRESS:7001!g"
#!substdef "!TCP_WS!tcp:MY_IP_ADDRESS:8080!g"
#!substdef "!UDP_WS_SIP!udp:MY_IP_ADDRESS:8080!g"
#!substdef "!TLS_WSS!tls:MY_IP_ADDRESS:8443!g"
#!substdef "!UDP_WSS_SIP!udp:MY_IP_ADDRESS:8443!g"
#!substdef "!TCP_WS!tcp:MY_IP_ADDRESS:5064!g"
#!substdef "!UDP_WS_SIP!udp:MY_IP_ADDRESS:5064!g"
#!substdef "!TLS_WSS!tls:MY_IP_ADDRESS:5065!g"
#!substdef "!UDP_WSS_SIP!udp:MY_IP_ADDRESS:5065!g"
## YOU SHOULD NOT HAVE TO CHANGE THESE!
## This will bind the default SIP listeners


+ 5
- 2
kamailio/presence-role.cfg View File

@ -11,7 +11,10 @@ loadmodule "presence_mwi.so"
loadmodule "presence_xml.so"
modparam("presence_dialoginfo", "force_dummy_dialog", 1)
modparam("presence_xml", "force_dummy_presence", 1)
modparam("presence_xml", "force_active", 1)
modparam("presence_xml", "disable_winfo", 1)
modparam("presence_xml", "disable_bla", 1)
modparam("presence", "subs_db_mode", 3)
modparam("presence", "expires_offset", 60)
@ -76,7 +79,7 @@ route[HANDLE_SUBSCRIBE]
$var(fs_contact) = $var(fs_contact) + ";" + $(ct{tobody.params});
}
$var(amqp_payload_request) = '{"Event-Category" : "presence", "Event-Name" : "subscription", "Event-Package" : "$hdr(event)", "Expires" : "$var(Expires)", "Queue" : "BLF-MY_HOSTNAME", "Server-ID" : "BLF-MY_HOSTNAME" , "Contact" : "$(ct{s.escape.common})", "Call-ID" : "$ci", "From" : "$fu", "User" : "$tu", "User-Agent" : "$(ua{s.escape.common})" }';
$var(amqp_payload_request) = '{"Event-Category" : "presence", "Event-Name" : "subscription", "Event-Package" : "$hdr(event)", "Expires" : "$var(Expires)", "Queue" : "BLF-MY_HOSTNAME", "Server-ID" : "BLF-MY_HOSTNAME" , "Contact" : "$(ct{s.escape.common})", "Call-ID" : "$ci", "From" : "$fu", "User" : "$subs(uri)", "User-Agent" : "$(ua{s.escape.common})" }';
kazoo_publish("dialoginfo_subs", "dialoginfo_subs", $var(amqp_payload_request));
@ -106,7 +109,7 @@ event_route[kazoo:consumer-event-presence-update]
$var(call-id) = $(kzE{kz.json,Call-ID});
if( $(kzE{kz.json,Event-Package}) == "dialog") {
if($sht(p=>$var(call-id)) != $(kzE{kz.json,State}) || $(kzE{kz.json,Flush-Level}) != $null) {
xlog("L_INFO", "$var(call-id)|log|received $(kzE{kz.json,Event-Package}) update for $(kzE{kz.json,From}) state $(kzE{kz.json,State})");
xlog("L_INFO", "$(kzE{kz.json,Target-Call-ID})|log|received $(kzE{kz.json,Event-Package}) update for $(kzE{kz.json,From}) state $(kzE{kz.json,State})");
$sht(p=>$(kzE{kz.json,Call-ID})) = $(kzE{kz.json,State});
#!ifdef FAST_PICKUP-ROLE
route(FAST_PICKUP_INIT);


+ 32
- 0
kamailio/presence_notify_sync-role.cfg View File

@ -0,0 +1,32 @@
######## Presence notify sync ########
## send notify sync back to kazoo
kazoo.presence_notify = 0 descr "enable/disable sending notify callback to omnipresence"
route[PRESENCE_LOCAL_NOTIFY]
{
if($rm != "NOTIFY" || @cfg_get.kazoo.presence_notify != 1) {
return;
}
$avp(notify_body) = $rb;
$avp(notify_event) = $hdr(Event);
t_on_reply("PRESENCE_NOTIFY_REPLY");
t_on_failure("PRESENCE_NOTIFY_FAULT");
}
onreply_route[PRESENCE_NOTIFY_REPLY]
{
$var(amqp_payload_request) = '{"Event-Category" : "presence", "Event-Name" : "notify", "Event-Package" : "$avp(notify_event)", "Call-ID" : "$ci", "From" : "$fu", "To" : "$tu", "Body" : "$(avp(notify_body){s.escape.common})", "Sequence" : $cs, "Reply" : $T_reply_code }';
$var(rk) = "notify." + $(td{kz.encode}) + "." + $(tU{kz.encode});
kazoo_publish("omnipresence", "$var(rk)", $var(amqp_payload_request));
xlog("L_INFO", "$ci|log|sent notify callback for event $avp(notify_event) : $tu");
}
failure_route[PRESENCE_NOTIFY_FAULT]
{
$var(amqp_payload_request) = '{"Event-Category" : "presence", "Event-Name" : "notify", "Event-Package" : "$avp(notify_event)", "Call-ID" : "$ci", "From" : "$fu", "To" : "$tu", "Body" : "$(avp(notify_body){s.escape.common})", "Sequence" : $cs, "Reply" : $T_reply_code }';
$var(rk) = "notify." + $(td{kz.encode}) + "." + $(tU{kz.encode});
kazoo_publish("omnipresence", "$var(rk)", $var(amqp_payload_request));
xlog("L_INFO", "$ci|log|sent notify callback error $T_reply_code for event $avp(notify_event) : $tu");
}

+ 65
- 0
kamailio/presence_query-role.cfg View File

@ -0,0 +1,65 @@
######## Presence query server module ########
####### SQL OPS module ##########
#!ifndef SQLOPS-LOADED
loadmodule "sqlops.so"
modparam("sqlops","sqlcon", "cb=>KAZOO_DB_URL")
#!trydef SQLOPS-LOADED
#!endif
event_route[kazoo:consumer-event-presence-search-req]
{
xlog("L_INFO", "received presence search_req $kzE");
$var(Queue) = $(kzE{kz.json,Server-ID});
$var(Event) = $(kzE{kz.json,Event-Package});
$var(Domain) = $(kzE{kz.json,Realm});
$var(Username) = $(kzE{kz.json,Username});
$var(Now) = $TS;
$var(Items) = "";
$var(Query) = $_s(select * from presentity where domain = "$var(Domain)");
if($var(Event) != "") {
$var(Query) = $var(Query) + $_s( and event = "$var(Event)");
}
if($var(Username) != "") {
$var(Query) = $var(Query) + $_s( and username = "$var(Username)");
}
$var(Query) = $var(Query) + " order by username, event, id";
xlog("L_INFO", "$ci| QUERY $var(Query)");
$var(rows) = 0;
if (sql_xquery("cb", "$var(Query)", "ra") == 1)
{
while($xavp(ra) != $null) {
$var(Username) = $xavp(ra=>username);
$var(Sep2)="";
$var(Evt)="";
while($xavp(ra) != $null && $var(Username) == $xavp(ra=>username))
{
$var(Event) = $xavp(ra=>event);
$var(Sep3)="";
$var(Sub)="";
while($xavp(ra) != $null && $var(Username) == $xavp(ra=>username) && $var(Event) == $xavp(ra=>event))
{
$var(Sub) = $var(Sub) + $_s($var(Sep3)"$xavp(ra=>id)" : {"etag" : "$xavp(ra=>etag)", "body" : "$(xavp(ra=>body){s.escape.common})" });
$var(Sep3)=", ";
pv_unset("$xavp(ra)");
}
$var(Evt) = $var(Evt) + $var(Sep2) + $_s("$var(Event)") + " : { " + $var(Sub) + "}";
$var(Sep2)=", ";
}
$var(Usr) = $_s("$var(Username)") + " : { " + $var(Evt) + " }";
## xlog("L_INFO", "$ci| RESULT \"Subscriptions\" : { $var(Usr) }");
$var(amqp_payload_request) = '{"Event-Category" : "presence", "Event-Name" : "search_partial_resp", "Msg-ID" : "$(kzE{kz.json,Msg-ID})", "Subscriptions" : { $var(Usr) } }';
kazoo_publish("targeted", "$var(Queue)", $var(amqp_payload_request));
$var(rows) = $var(rows) + 1;
}
}
$var(amqp_payload_request) = '{"Event-Category" : "presence", "Event-Name" : "search_resp", "Msg-ID" : "$(kzE{kz.json,Msg-ID})" }';
kazoo_publish("targeted", "$var(Queue)", $var(amqp_payload_request));
xlog("L_INFO", "$ci| sent $var(rows) search_partial_resp in result of search_req");
}
# vim: tabstop=4 softtabstop=4 shiftwidth=4 expandtab

+ 43
- 0
kamailio/presence_sync-role.cfg View File

@ -0,0 +1,43 @@
######## Presence sync server module ########
####### SQL OPS module ##########
#!ifndef SQLOPS-LOADED
loadmodule "sqlops.so"
modparam("sqlops","sqlcon", "cb=>KAZOO_DB_URL")
#!trydef SQLOPS-LOADED
#!endif
event_route[kazoo:consumer-event-presence-sync]
{
xlog("L_INFO", "received SYNC $kzE");
$var(Queue) = $(kzE{kz.json,Server-ID});
$var(Now) = $TS;
######## SEND BACK START ########
$var(amqp_payload_request) = '{"Event-Category" : "presence", "Event-Name" : "sync", "Action" : "Start" }';
kazoo_publish("targeted", "$var(Queue)", $var(amqp_payload_request));
if (sql_xquery("cb", "select * from active_watchers where expires > $var(Now)", "ra") == 1)
{
while($xavp(ra) != $null)
{
$var(runloop) = 1;
while($xavp(ra) != $null && $var(runloop) < MAX_WHILE_LOOPS ) {
xlog("L_INFO", "[id, presentity, watcher] = [$xavp(ra=>id), $xavp(ra=>presentity_uri), $xavp(ra=>watcher_username)]");
$var(Expires) = $xavp(ra=>expires) - $var(Now);
xlog("L_INFO", "EXPIRES $var(Expires) , $xavp(ra=>expires) , $var(Now)");
$var(amqp_payload_request) = '{"Event-Category" : "presence", "Event-Name" : "subscription", "Event-Package" : "$xavp(ra=>event)", "Expires" : $var(Expires), "Server-ID" : "BLF-MY_HOSTNAME" , "Contact" : "$xavp(ra=>contact)", "Call-ID" : "$xavp(ra=>callid)", "From" : "sip:$xavp(ra=>watcher_username)@$xavp(ra=>watcher_domain)", "User" : "$xavp(ra=>presentity_uri)" }"';
kazoo_publish("targeted", "$var(Queue)", $var(amqp_payload_request));
pv_unset("$xavp(ra)");
$var(runloop) = $var(runloop) + 1;
}
}
}
######## SEND BACK END ########
$var(amqp_payload_request) = '{"Event-Category" : "presence", "Event-Name" : "sync", "Action" : "End" }';
kazoo_publish("targeted", "$var(Queue)", $var(amqp_payload_request));
}
# vim: tabstop=4 softtabstop=4 shiftwidth=4 expandtab

+ 5
- 5
kamailio/registrar-role.cfg View File

@ -79,22 +79,22 @@ route[ATTEMPT_AUTHORIZATION]
} else {
$var(amqp_payload_request) = "{'Event-Category' : 'directory' , 'Event-Name' : 'authn_req', 'Method' : 'REGISTER', 'Auth-Realm' : '" + $fd + "', 'Auth-User' : '" + $fU + "', 'From' : '" + $fu + "', 'To' : '" + $tu +"' }";
$var(amqp_routing_key) = "authn.req." + $(fd{kz.encode});
sl_send_reply("100", "Attempting K query");
sl_send_reply("100", "Attempting registrar query");
if(kazoo_query("callmgr", $var(amqp_routing_key), $var(amqp_payload_request))) {
$var(password) = $(kzR{kz.json,Auth-Password});
$xavp(ulattrs=>custom_channel_vars) = $(kzR{kz.json,Custom-Channel-Vars});
xlog("L_INFO", "$ci|log|authenticating $Au via Kazoo query response");
xlog("L_INFO", "$ci|log|authenticating $Au via registrar query response");
} else {
xlog("L_INFO", "$ci|log|failed to query Kazoo for authentication credentials for $Au $si:$sp");
xlog("L_INFO", "$ci|log|failed to query registrar for authentication credentials for $Au $si:$sp");
append_to_reply("Retry-After: 60\r\n");
sl_send_reply("500", "Retry Later");
exit;
}
}
if($var(password) == $null) {
if($var(password) == $null || $var(password) == "") {
auth_challenge("$fd", "0");
xlog("L_INFO", "$ci|end|issued auth challenge to registration attempt for $Au $si:$sp");
xlog("L_INFO", "$ci|end|issued auth challenge to registration attempt for $Au $si:$sp due to empty password");
exit;
}


+ 1
- 0
kamailio/tls-role.cfg View File

@ -6,3 +6,4 @@ listen=TLS_ALG_SIP
####### TLS Parameters #########
loadmodule "tls.so"
modparam("tls", "config", "/etc/kazoo/kamailio/tls.cfg")
modparam("tls", "low_mem_threshold1", 0)

+ 2
- 1
rabbitmq/rabbitmq.config View File

@ -3,5 +3,6 @@
,{vm_memory_high_watermark, 0.8}
,{loopback_users, []}
]},
{rabbitmq_management_agent, [ {force_fine_statistics, false} ] }
{rabbitmq_management, [{rates_mode, none}]},
{rabbitmq_management_agent, [{rates_mode, none}]}
].

Loading…
Cancel
Save