Browse Source

presence: fix expires value

issue : when a UA subscribes with a expires value out of bounds of min/max expires and sip_min_expires_action = 2 (force value), the reported value to omnipresence is the original expires and not the corrected value.
3.20
lazedo 11 years ago
parent
commit
4ecf1d8444
1 changed files with 15 additions and 4 deletions
  1. +15
    -4
      kamailio/presence-role.cfg

+ 15
- 4
kamailio/presence-role.cfg View File

@ -1,4 +1,8 @@
######## Presence server module ######## ######## Presence server module ########
#!trydef PRESENCE_MIN_EXPIRES 300
#!trydef PRESENCE_MIN_EXPIRES_ACTION 2
#!trydef PRESENCE_MAX_EXPIRES 3600
modparam("htable", "htable", "p=>size=32;autoexpire=600;") modparam("htable", "htable", "p=>size=32;autoexpire=600;")
loadmodule "presence.so" loadmodule "presence.so"
@ -14,9 +18,9 @@ modparam("presence", "expires_offset", 60)
modparam("presence", "send_fast_notify", 1) modparam("presence", "send_fast_notify", 1)
modparam("presence", "clean_period", 30) modparam("presence", "clean_period", 30)
modparam("presence", "publ_cache", 0) modparam("presence", "publ_cache", 0)
modparam("presence", "min_expires_action", 2)
modparam("presence", "min_expires", 300)
modparam("presence", "max_expires", 3600)
modparam("presence", "min_expires_action", PRESENCE_MIN_EXPIRES_ACTION)
modparam("presence", "min_expires", PRESENCE_MIN_EXPIRES)
modparam("presence", "max_expires", PRESENCE_MAX_EXPIRES)
modparam("presence", "sip_uri_match", 1) modparam("presence", "sip_uri_match", 1)
modparam("presence", "waitn_time", 1) modparam("presence", "waitn_time", 1)
modparam("presence", "notifier_processes", 5) modparam("presence", "notifier_processes", 5)
@ -58,6 +62,13 @@ route[HANDLE_SUBSCRIBE]
exit; exit;
} }
$var(Expires) = $hdr(Expires);
if($var(Expires) < PRESENCE_MIN_EXPIRES) {
$var(Expires) = PRESENCE_MIN_EXPIRES;
} else if($var(Expires) > PRESENCE_MAX_EXPIRES) {
$var(Expires) = PRESENCE_MAX_EXPIRES;
}
##RabbitMQ ##RabbitMQ
$var(fs_path) = "%3C" + $rz + "%3A" + $Ri + "%3A" + $Rp + "%3Btransport=" + $proto + "%3Blr%3Breceived=" + $si+":"+$sp+"%3E"; $var(fs_path) = "%3C" + $rz + "%3A" + $Ri + "%3A" + $Rp + "%3Btransport=" + $proto + "%3Blr%3Breceived=" + $si+":"+$sp+"%3E";
$var(fs_contact) = "<" + $(ct{tobody.uri}) + ";fs_path=" + $var(fs_path) + ">"; $var(fs_contact) = "<" + $(ct{tobody.uri}) + ";fs_path=" + $var(fs_path) + ">";
@ -65,7 +76,7 @@ route[HANDLE_SUBSCRIBE]
$var(fs_contact) = $var(fs_contact) + ";" + $(ct{tobody.params}); $var(fs_contact) = $var(fs_contact) + ";" + $(ct{tobody.params});
} }
$var(amqp_payload_request) = "{'Event-Category' : 'presence', 'Event-Name' : 'subscription', 'Event-Package' : '" + $hdr(event) + "', 'Expires' : " + $hdr(Expires) + ", 'Queue' : 'BLF-MY_HOSTNAME', 'Server-ID' : 'BLF-MY_HOSTNAME' ,'Contact' : '" + $var(fs_contact) + "', 'Call-ID' : '" + $ci + "', 'From' : '" + $(fu{s.tolower}) +"', 'User' : '" + $(tu{s.tolower}) + "', 'User-Agent' : '" + $ua + "' }";
$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})" }';
kazoo_publish("dialoginfo_subs", "dialoginfo_subs", $var(amqp_payload_request)); kazoo_publish("dialoginfo_subs", "dialoginfo_subs", $var(amqp_payload_request));


Loading…
Cancel
Save