|
@@ -242,10 +242,16 @@ modparam("ims_auth", "av_check_only_impu", 1)
|
|
|
modparam("ims_registrar_scscf", "default_expires", 60)
|
|
|
modparam("ims_registrar_scscf", "min_expires", 60)
|
|
|
modparam("ims_registrar_scscf", "max_expires", 60)
|
|
|
+modparam("ims_registrar_scscf", "subscription_default_expires", 80)
|
|
|
+modparam("ims_registrar_scscf", "subscription_min_expires", 80)
|
|
|
+modparam("ims_registrar_scscf", "subscription_max_expires", 80)
|
|
|
#!else
|
|
|
modparam("ims_registrar_scscf", "default_expires", 604800)
|
|
|
modparam("ims_registrar_scscf", "min_expires", 3600)
|
|
|
modparam("ims_registrar_scscf", "max_expires", 604800)
|
|
|
+modparam("ims_registrar_scscf", "subscription_default_expires", 654800)
|
|
|
+modparam("ims_registrar_scscf", "subscription_min_expires", 3700)
|
|
|
+modparam("ims_registrar_scscf", "subscription_max_expires", 605800)
|
|
|
#!endif
|
|
|
modparam("ims_registrar_scscf", "use_path", 1)
|
|
|
modparam("ims_registrar_scscf", "support_wildcardPSI",1)
|
|
@@ -309,9 +315,14 @@ route {
|
|
|
|
|
|
# we need to support subscription to reg event
|
|
|
if (is_method("SUBSCRIBE") && search("^(Event|o)([ \t]*):([ \t]*)reg")) {
|
|
|
- route(subscribe);
|
|
|
+ route(SUBSCRIBE);
|
|
|
break;
|
|
|
}
|
|
|
+
|
|
|
+ if (is_method("PUBLISH") && search("^(Event|o)([ \t]*):([ \t]*)reg")) {
|
|
|
+ route(PUBLISH);
|
|
|
+ break;
|
|
|
+ }
|
|
|
|
|
|
#Set DLG flag to track dialogs using dialog2
|
|
|
if (!is_method("REGISTER|SUBSCRIBE"))
|
|
@@ -427,16 +438,126 @@ route[REQINIT] {
|
|
|
}
|
|
|
|
|
|
######################################################################
|
|
|
-# Handle Subscribes to the REG-INFO event
|
|
|
+# Publish route
|
|
|
######################################################################
|
|
|
-route[subscribe]
|
|
|
+route[PUBLISH]
|
|
|
{
|
|
|
- #we need to deal with subs to reg event!
|
|
|
- # handle_subscribe();
|
|
|
- sl_send_reply("403", "Forbidden... for now");
|
|
|
- exit;
|
|
|
+ if (!t_newtran()) {
|
|
|
+ #absorb retransmissions
|
|
|
+ sl_reply("500","Could not create transaction");
|
|
|
+ exit;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (can_publish_reg("location")){
|
|
|
+ $var(ret)= publish_reg("location");
|
|
|
+ switch ($var(ret)){
|
|
|
+ case 1: #success
|
|
|
+ xlog("L_DBG", "Publish reg successful");
|
|
|
+ break;
|
|
|
+ case -1: #failure
|
|
|
+ xlog("L_ERR", "Publish reg failure - sending 500 Error now\n");
|
|
|
+ t_reply("500","Server Error publishing subscription");
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ xlog("L_ERR", "Unknown return code from publish reg event alue is [$var(ret)]\n");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ t_reply("403","Forbidden to PUBLISH");
|
|
|
+ exit;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+######################################################################
|
|
|
+# Subscribe route
|
|
|
+######################################################################
|
|
|
+route[SUBSCRIBE]
|
|
|
+{
|
|
|
+ if (!t_newtran()) {
|
|
|
+ #absorb retransmissions
|
|
|
+ sl_reply("500","Could not create transaction");
|
|
|
+ exit;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!has_totag()) {
|
|
|
+ xlog("L_DBG", "This is an initial SUBSCRIBE\n");
|
|
|
+ if (!term_impu_registered("location")) {
|
|
|
+ xlog("L_DBG", "We need to do an UNREG server SAR assignment\n");
|
|
|
+ assign_server_unreg("SUBSCRIBE_UNREG_SAR_REPLY", "location", "term");
|
|
|
+ exit;
|
|
|
+ }
|
|
|
+ if (!can_subscribe_to_reg("location")){
|
|
|
+ t_reply("403","Forbidden to SUBSCRIBE");
|
|
|
+ exit;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ xlog("L_DBG", "This is a subsequent SUBSCRIBE\n");
|
|
|
+ }
|
|
|
+
|
|
|
+ $var(ret)= subscribe_to_reg("location");
|
|
|
+ switch ($var(ret)){
|
|
|
+ case 1: #success
|
|
|
+ xlog("L_DBG", "Subscribe to reg successful");
|
|
|
+ break;
|
|
|
+ case -1: #failure
|
|
|
+ xlog("L_ERR", "Subscribe to reg failure - sending 500 Error now\n");
|
|
|
+ t_reply("500","Server Error saving subscription");
|
|
|
+ break;
|
|
|
+ case -2: #error
|
|
|
+ xlog("L_ERR", "Subscribe to reg error sending notify - 200 OK so subscription already sent\n");
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ xlog("L_ERR", "Unknown return code from subscribe to reg event alue is [$var(ret)]\n");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+route[SUBSCRIBE_UNREG_SAR_REPLY]
|
|
|
+{
|
|
|
+
|
|
|
+ xlog("L_DBG","saa_return code is $avp(s:saa_return_code)\n");
|
|
|
+ switch ($avp(s:saa_return_code)){
|
|
|
+ case 1: #success
|
|
|
+ xlog("L_DBG", "SAR success - will process subscribe\n");
|
|
|
+ if (can_subscribe_to_reg("location")){
|
|
|
+ $var(ret)= subscribe_to_reg("location");
|
|
|
+ switch ($var(ret)){
|
|
|
+ case 1: #success
|
|
|
+ xlog("L_DBG", "Subscribe to reg successful");
|
|
|
+ break;
|
|
|
+ case -1: #failure
|
|
|
+ xlog("L_ERR", "Subscribe to reg failure - sending 500 Error now\n");
|
|
|
+ t_reply("500","Server Error saving subscription");
|
|
|
+ break;
|
|
|
+ case -2: #error
|
|
|
+ xlog("L_ERR", "Subscribe to reg error sending notify - 200 OK so subscription already sent\n");
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ xlog("L_ERR", "Unknown return code from subscribe to reg event alue is [$var(ret)]\n");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ t_reply("403","Forbidden to SUBSCRIBE");
|
|
|
+ exit;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case -1: #failure
|
|
|
+ xlog("L_ERR", "SAR failure - Sending 403 Forbidden\n");
|
|
|
+ t_reply("403","Forbidden to SUBSCRIBE");
|
|
|
+ break;
|
|
|
+ case -2: #error
|
|
|
+ xlog("L_ERR", "SAR error - Sending 403 Forbidden\n");
|
|
|
+ t_reply("403","Forbidden to SUBSCRIBE");
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ xlog("L_ERR", "Unknown return code from SAR, value is [$avp(s:saa_return_code)] - sending 403 Forbidden\n");
|
|
|
+ t_reply("403","Forbidden to SUBSCRIBE");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ exit;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
######################################################################
|
|
|
# XMLRPC routing
|
|
|
######################################################################
|