diff --git a/daemon/src/sip/Makefile.am b/daemon/src/sip/Makefile.am index 689178a7dd26059b4baf6f545771833baa2c00cc..6acb085d720c1b294959e1c0b5d055010fd8d8df 100644 --- a/daemon/src/sip/Makefile.am +++ b/daemon/src/sip/Makefile.am @@ -19,7 +19,7 @@ libsiplink_la_SOURCES = \ sipbuddy.h \ sipvoip_pres.cpp \ sipvoip_pres.h \ - ServerPresenceSub.h + presence_subscription.h if BUILD_SDES libsiplink_la_SOURCES+= sdes_negotiator.cpp \ diff --git a/daemon/src/sip/ServerPresenceSub.h b/daemon/src/sip/presence_subscription.h similarity index 92% rename from daemon/src/sip/ServerPresenceSub.h rename to daemon/src/sip/presence_subscription.h index 902f7becf62897af7500ac45341fe43b9c02fcda..2d71875af943ac08dc34ef57c409b4c723cb6cc4 100644 --- a/daemon/src/sip/ServerPresenceSub.h +++ b/daemon/src/sip/presence_subscription.h @@ -1,5 +1,5 @@ /* - * File: ServerPresenceSub.h + * File: PresenceSubscription.h * Author: aol * * Created on April 24, 2012, 10:13 AM @@ -13,9 +13,9 @@ #include"pjsip-simple/presence.h" -class ServerPresenceSub { +class PresenceSubscription { public: - ServerPresenceSub(pjsip_evsub *evsub, char *r, std::string acc_Id, pjsip_dialog *d): + PresenceSubscription(pjsip_evsub *evsub, char *r, std::string acc_Id, pjsip_dialog *d): sub(evsub) , remote(r) , accId(acc_Id) @@ -65,7 +65,7 @@ public: friend pj_bool_t my_pres_on_rx_request(pjsip_rx_data *rdata); private: - NON_COPYABLE(ServerPresenceSub); + NON_COPYABLE(PresenceSubscription); pjsip_evsub *sub; /**< The evsub. */ char *remote; /**< Remote URI. */ std::string accId; /**< Account ID. */ diff --git a/daemon/src/sip/sipaccount.cpp b/daemon/src/sip/sipaccount.cpp index 753338e4eba92aff361e6ad201df44d03d584407..1bbcdcbfe9d36f895808d80d6d1c063212e8dd8f 100644 --- a/daemon/src/sip/sipaccount.cpp +++ b/daemon/src/sip/sipaccount.cpp @@ -1214,25 +1214,25 @@ bool SIPAccount::isIP2IP() const * Presence Management for IP2IP accounts * * when the account receive a SUBSCRIBE from an IP account, - * a new ServerPresenceSub of this account is added to ServerPresenceSub list. + * a new PresenceSubscription of this account is added to PresenceSubscription list. * Then notifications can be send to each serverSubscriptions element */ -/* Presence : Method used to add serverSubscription to ServerPresenceSub list in case of IP2IP accounts */ -void SIPAccount::addServerSubscription(ServerPresenceSub *s) { +/* Presence : Method used to add serverSubscription to PresenceSubscription list in case of IP2IP accounts */ +void SIPAccount::addServerSubscription(PresenceSubscription *s) { serverSubscriptions.push_back(s); DEBUG("server subscription added"); } -/* Presence : Method used to remove serverSubscription to ServerPresenceSub list in case of IP2IP accounts */ -void SIPAccount::removerServerSubscription(ServerPresenceSub *s) { +/* Presence : Method used to remove serverSubscription to PresenceSubscription list in case of IP2IP accounts */ +void SIPAccount::removerServerSubscription(PresenceSubscription *s) { serverSubscriptions.remove(s); DEBUG("server subscription removed"); } /* Presence : Method used to notify each serverSubscription of a new presencein case of IP2IP accounts */ void SIPAccount::notifyServers(const std::string &newPresenceStatus, const std::string &newChannelStatus) { - std::list< ServerPresenceSub *>::iterator serverIt; + std::list< PresenceSubscription *>::iterator serverIt; DEBUG("iterating through servers"); for (serverIt = serverSubscriptions.begin(); serverIt != serverSubscriptions.end(); serverIt++) (*serverIt)->notify(newPresenceStatus, newChannelStatus); diff --git a/daemon/src/sip/sipaccount.h b/daemon/src/sip/sipaccount.h index 8083d84eba74ff9f54243b8bb3de0a42027d9e13..af031db29efbc5a701f95cd5059d80c1bd9fe995 100644 --- a/daemon/src/sip/sipaccount.h +++ b/daemon/src/sip/sipaccount.h @@ -43,7 +43,7 @@ #include "pjsip-ua/sip_regc.h" #include "noncopyable.h" -#include "ServerPresenceSub.h" +#include "presence_subscription.h" typedef std::vector<pj_ssl_cipher> CipherArray; namespace Conf { @@ -518,8 +518,8 @@ class SIPAccount : public Account { //void addBuddy(const std::string &uri, bool subscribe); //void removeBuddy(const std::string &uri); - void addServerSubscription(ServerPresenceSub *s); - void removerServerSubscription(ServerPresenceSub *s); + void addServerSubscription(PresenceSubscription *s); + void removerServerSubscription(PresenceSubscription *s); void notifyServers(const std::string &newPresenceStatus, const std::string &newChannelStatus); private: NON_COPYABLE(SIPAccount); @@ -772,7 +772,7 @@ class SIPAccount : public Account { /** * Server subscription (added by ELOI) */ - std::list< ServerPresenceSub *> serverSubscriptions; + std::list< PresenceSubscription *> serverSubscriptions; }; diff --git a/daemon/src/sip/sipvoip_pres.cpp b/daemon/src/sip/sipvoip_pres.cpp index 0f25885b58939cdf3a09a36d1fde546d29c944bf..3c558613bcca6fd3269eace5c8248aa732901126 100644 --- a/daemon/src/sip/sipvoip_pres.cpp +++ b/daemon/src/sip/sipvoip_pres.cpp @@ -67,16 +67,16 @@ void pres_evsub_on_srv_state(pjsip_evsub *sub, pjsip_event *event) { std::string accountId = "IP2IP";/* ebail : this code is only used for IP2IP accounts */ SIPAccount *acc = Manager::instance().getSipAccount(accountId); PJ_UNUSED_ARG(event); - ServerPresenceSub *server; + PresenceSubscription *presenceSub; // PJSUA_LOCK(); /* ebail : FIXME figure out if locking is necessary or not */ - server = (ServerPresenceSub *) pjsip_evsub_get_mod_data(sub, + presenceSub = (PresenceSubscription *) pjsip_evsub_get_mod_data(sub, ((SIPVoIPLink*) (acc->getVoIPLink()))->getModId() /*my_mod_pres.id*/); - WARN("Server subscription to %s is %s", server->remote, pjsip_evsub_get_state_name(sub)); + WARN("Presence subscription to %s is %s", presenceSub->remote, pjsip_evsub_get_state_name(sub)); - if (server) { + if (presenceSub) { pjsip_evsub_state state; - WARN("Server subscription to %s is %s", server->remote, pjsip_evsub_get_state_name(sub)); + WARN("Server subscription to %s is %s", presenceSub->remote, pjsip_evsub_get_state_name(sub)); state = pjsip_evsub_get_state(sub); @@ -184,7 +184,7 @@ pj_bool_t my_pres_on_rx_request(pjsip_rx_data *rdata) { status = pjsip_uri_print(PJSIP_URI_IN_REQ_URI, dlg->remote.info->uri, remote, PJSIP_MAX_URL_SIZE); pjsip_uri_print(PJSIP_URI_IN_CONTACT_HDR, dlg->local.info->uri, contact.ptr, PJSIP_MAX_URL_SIZE); - ServerPresenceSub *serverSub = new ServerPresenceSub(sub, remote, accountId, dlg); + PresenceSubscription *presenceSub = new PresenceSubscription(sub, remote, accountId, dlg); if (status < 1) pj_ansi_strcpy(remote, "<-- url is too long-->"); @@ -193,16 +193,16 @@ pj_bool_t my_pres_on_rx_request(pjsip_rx_data *rdata) { // pjsip_evsub_add_header(sub, &acc->cfg.sub_hdr_list); int modId = ((SIPVoIPLink*) (acc->getVoIPLink()))->getModId(); - pjsip_evsub_set_mod_data(sub, modId/*my_mod_pres.id*/, serverSub); - acc->addServerSubscription(serverSub); + pjsip_evsub_set_mod_data(sub, modId/*my_mod_pres.id*/, presenceSub); + acc->addServerSubscription(presenceSub); /* Add server subscription to the list: */ // pj_list_push_back(&pjsua_var.acc[acc_id].pres_srv_list, uapres); /* Capture the value of Expires header. */ expires_hdr = (pjsip_expires_hdr*) pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_EXPIRES, NULL); if (expires_hdr) - serverSub->setExpires(expires_hdr->ivalue); + presenceSub->setExpires(expires_hdr->ivalue); else - serverSub->setExpires(-1); + presenceSub->setExpires(-1); st_code = (pjsip_status_code) 200; reason = pj_str("OK"); @@ -250,7 +250,7 @@ pj_bool_t my_pres_on_rx_request(pjsip_rx_data *rdata) { pjsip_pres_set_status(sub, &pres_status); ev_state = PJSIP_EVSUB_STATE_ACTIVE; - if (serverSub->expires == 0) + if (presenceSub->expires == 0) ev_state = PJSIP_EVSUB_STATE_TERMINATED; /* Create and send the NOTIFY to active subscription: */