From 1c7b7603937cb7f32d6109c22a978bb8efd37e6c Mon Sep 17 00:00:00 2001 From: Aleksandar Yosifov Date: Wed, 22 Apr 2020 16:25:32 +0300 Subject: [PATCH] ims_registrar_scscf: pass event type as parameter - pass event type as parameter in notify_subscribers() --- src/modules/ims_registrar_scscf/cxdx_callbacks.c | 4 ++-- src/modules/ims_registrar_scscf/reg_rpc.c | 2 +- src/modules/ims_registrar_scscf/registrar_notify.c | 6 +++--- src/modules/ims_registrar_scscf/registrar_notify.h | 2 +- src/modules/ims_registrar_scscf/save.c | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/modules/ims_registrar_scscf/cxdx_callbacks.c b/src/modules/ims_registrar_scscf/cxdx_callbacks.c index 8fc5142c243..98aed405e4d 100644 --- a/src/modules/ims_registrar_scscf/cxdx_callbacks.c +++ b/src/modules/ims_registrar_scscf/cxdx_callbacks.c @@ -93,7 +93,7 @@ AAAMessage* cxdx_process_rtr(AAAMessage *rtr) { impucontact->contact->state = CONTACT_DELETE_PENDING; if (r->shead) { //send NOTIFY to all subscribers of this IMPU. - notify_subscribers(r, 0, 0); + notify_subscribers(r, 0, 0, IMS_REGISTRAR_CONTACT_UNREGISTERED); } impucontact->contact->state = CONTACT_DELETED; ul.unlock_contact_slot_i(impucontact->contact->sl); @@ -122,7 +122,7 @@ AAAMessage* cxdx_process_rtr(AAAMessage *rtr) { impucontact->contact->state = CONTACT_DELETE_PENDING; if (r->shead) { //send NOTIFY to all subscribers of this IMPU. - notify_subscribers(r, 0, 0); + notify_subscribers(r, 0, 0, IMS_REGISTRAR_CONTACT_UNREGISTERED); } impucontact->contact->state = CONTACT_DELETED; ul.unlock_contact_slot_i(impucontact->contact->sl); diff --git a/src/modules/ims_registrar_scscf/reg_rpc.c b/src/modules/ims_registrar_scscf/reg_rpc.c index 40c6e736696..a009645489e 100644 --- a/src/modules/ims_registrar_scscf/reg_rpc.c +++ b/src/modules/ims_registrar_scscf/reg_rpc.c @@ -66,7 +66,7 @@ static void reg_rpc_dereg_impu(rpc_t* rpc, void* ctx) impucontact->contact->state = CONTACT_DELETE_PENDING; if (impu_rec->shead) { //send NOTIFY to all subscribers of this IMPU. - notify_subscribers(impu_rec, 0, 0); + notify_subscribers(impu_rec, 0, 0, IMS_REGISTRAR_CONTACT_UNREGISTERED); } impucontact->contact->state = CONTACT_DELETED; ul.unlock_contact_slot_i(impucontact->contact->sl); diff --git a/src/modules/ims_registrar_scscf/registrar_notify.c b/src/modules/ims_registrar_scscf/registrar_notify.c index 988ce155e2e..a6237923878 100644 --- a/src/modules/ims_registrar_scscf/registrar_notify.c +++ b/src/modules/ims_registrar_scscf/registrar_notify.c @@ -534,8 +534,8 @@ int event_reg(udomain_t* _d, impurecord_t* r_passed, int event_type, str *presen } } -int notify_subscribers(impurecord_t* impurecord, str *explit_dereg_contact, int num_explit_dereg_contact) { - event_reg(0, impurecord, IMS_REGISTRAR_CONTACT_UNREGISTERED, 0, 0, explit_dereg_contact, num_explit_dereg_contact); +int notify_subscribers(impurecord_t* impurecord, str *explit_dereg_contact, int num_explit_dereg_contact, int event_type) { + event_reg(0, impurecord, event_type, 0, 0, explit_dereg_contact, num_explit_dereg_contact); return 0; } @@ -593,7 +593,7 @@ int process_contact(ims_subscription* subscription, udomain_t * _d, int expires, ucontact->state = CONTACT_DELETE_PENDING; if (implicit_impurecord->shead) { //send NOTIFY to all subscribers of this IMPU. - notify_subscribers(implicit_impurecord, 0, 0); + notify_subscribers(implicit_impurecord, 0, 0, IMS_REGISTRAR_CONTACT_UNREGISTERED); } ul.unlock_contact_slot(&contact_uri); // if (ul.unlink_contact_from_impu(implicit_impurecord, ucontact, 1, 0 /*implicit dereg of contact from IMPU*/) != 0) { diff --git a/src/modules/ims_registrar_scscf/registrar_notify.h b/src/modules/ims_registrar_scscf/registrar_notify.h index 76ed60807c1..ac4a3b5d829 100644 --- a/src/modules/ims_registrar_scscf/registrar_notify.h +++ b/src/modules/ims_registrar_scscf/registrar_notify.h @@ -161,6 +161,6 @@ void notify_destroy(); int aor_to_contact(str* aor, str* contact); int contact_port_ip_match(str *c1, str *c2); -int notify_subscribers(impurecord_t* impurecord, str *explit_dereg_contact, int num_explit_dereg_contact); +int notify_subscribers(impurecord_t* impurecord, str *explit_dereg_contact, int num_explit_dereg_contact, int event_type); #endif //S_CSCF_REGISTRAR_NOTIFY_H_ diff --git a/src/modules/ims_registrar_scscf/save.c b/src/modules/ims_registrar_scscf/save.c index a10cf0373fd..43dfd4797b2 100644 --- a/src/modules/ims_registrar_scscf/save.c +++ b/src/modules/ims_registrar_scscf/save.c @@ -830,7 +830,7 @@ int update_contacts(struct sip_msg* msg, udomain_t* _d, //now build the contact buffer to be include in the reply message and unlock build_contact(impu_rec, contact_header); build_p_associated_uri(*s); - notify_subscribers(impu_rec, 0, 0); + notify_subscribers(impu_rec, 0, 0, IMS_REGISTRAR_CONTACT_REGISTERED); ul.unlock_udomain(_d, public_identity); break; case AVP_IMS_SAR_RE_REGISTRATION: @@ -913,7 +913,7 @@ int update_contacts(struct sip_msg* msg, udomain_t* _d, if (ul.update_impurecord(_d, public_identity, 0, reg_state, -1 /*do not change send sar on delete */, 0 /*this is explicit so barring must be 0*/, 0, s, ccf1, ccf2, ecf1, ecf2, &impu_rec) != 0) { LM_ERR("Unable to update explicit impurecord for <%.*s>\n", public_identity->len, public_identity->s); } - notify_subscribers(impu_rec, 0, 0); + notify_subscribers(impu_rec, 0, 0, IMS_REGISTRAR_CONTACT_REGISTERED); ul.unlock_udomain(_d, public_identity); break; case AVP_IMS_SAR_USER_DEREGISTRATION: @@ -1011,7 +1011,7 @@ int update_contacts(struct sip_msg* msg, udomain_t* _d, // s = s->next; // } // } - notify_subscribers(tmp_impu_rec, (str*) explicit_dereg_contact, num_explicit_dereg_contact); + notify_subscribers(tmp_impu_rec, (str*) explicit_dereg_contact, num_explicit_dereg_contact, IMS_REGISTRAR_CONTACT_UNREGISTERED); for (h = msg->contact; h; h = h->next) { if (h->type == HDR_CONTACT_T && h->parsed) {