[asterisk-scf-commits] asterisk-scf/integration/sip.git branch "registrar" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Thu Jun 9 16:53:20 CDT 2011


branch "registrar" has been updated
       via  72fce78916b051f6d76a4e61de9fb5d26eec10de (commit)
       via  51d7a0addacb9eae0fc88bea5b010a0559b4b887 (commit)
       via  df0ebe1c9b2b5eb5b99f1a5e4140dd13b3a14622 (commit)
       via  842ac2916a9dacfa0151dd121763d94aba3f23b5 (commit)
       via  c44cbcab1add8308822053fda7ebb73a79cadb1b (commit)
       via  3405b3d255c963ba920e859580e1d48062dd241b (commit)
       via  f629cf1b575eb73348d837cd2864a7f76c1a4159 (commit)
       via  9b157bc4d9957ef74d6cf277035305ea2c39f0bb (commit)
       via  a41ade002c57ccdd90495a8c0d50ba40dd69e19d (commit)
       via  d85f529e42fa80a0a9f3309c34aab9d5b19fa1cc (commit)
       via  edef933ea00de1a54440827f7731e7732d06efeb (commit)
       via  f8f80a33da9ca89ee1c2d6f7e01a53eeddb723d5 (commit)
       via  700a00bcbae0ee7d6e04353b35007daedd87e2cf (commit)
       via  b4996480a53d71759531ca0ddd8c78fc2b3c96aa (commit)
       via  50741df4192403a029c07a9348983023de1d8a3e (commit)
       via  0e36a390c38355413afde6da286342f780a35a87 (commit)
       via  fb9f4f3a7b813ee52200427d9c544eccb439ea37 (commit)
       via  c81b0fc11568a4b86ab67f8fc9de678f1692c2b8 (commit)
       via  b78b8a44294837357cece3e68fbafb00b2344c20 (commit)
       via  129d4f1fa49096b11f99e553c2c1a8bb6f8041a4 (commit)
       via  635de237c3aef8713ab818ceda11faf81930477d (commit)
       via  eac4258e1eae1ddb66c102438c6e4336f773e04e (commit)
       via  366a988285e61b635662501351607e8f45659c16 (commit)
       via  13b6132b4f653ae22175e55c14a375cf0ecb2622 (commit)
       via  20239f35caeaca630680c7719c70808deeab42ca (commit)
       via  960d3916fcb553e42df35266060363a425972007 (commit)
       via  f233332d7f4039a7fb007a42c207eb988dd9c77e (commit)
       via  71753eef2f0662b2642b0f5beef628c07c891bba (commit)
       via  ccfb81d546c08b540f175a65fc905123f430f4fc (commit)
       via  4709f65485b46d0c5299d7e8877c1c7b58326444 (commit)
       via  6e45f7d7d7ec3e8be48c53e0b581a946171b1c59 (commit)
       via  5e0a6d5fd9e409306d77ec066506a8de6afa6be4 (commit)
       via  069e20776fc5e0d44dbe7d5e4963167d93e64d6a (commit)
       via  56969fd2d98b159e1695d77a689fb78ecbfb6ebf (commit)
       via  30f4658ce0ba340fd90667a5483714ada1e5097c (commit)
       via  98584e0f7b7db43e806c59053c5c3df397152521 (commit)
       via  c807bf56d40a56549bc37ea3a3e46d8f540821da (commit)
       via  7246f8002b621284be27c987248888c5f701b7de (commit)
       via  b04ec118712501b0512f7c231015dfba60d8d965 (commit)
       via  8eb9a6461494bff1489e01b5541b569e7ecef3bc (commit)
       via  40f2cf7feed6d313e0f59a3188906960ea0eb84c (commit)
       via  57d2734e77552204087bcddeb9fa183255a4d140 (commit)
       via  1580cf9ff932630cb695b181826263c7e293405c (commit)
       via  01e69f75a66763af70bca71aa0783e98169ffd72 (commit)
       via  33d9123112321a9aae36a9f021c1c00fb6b0c425 (commit)
       via  0c327d8e8c59536fda95b1e07f0c54f31b825fdd (commit)
       via  d64b6e6f37ba0048fd66948ae6caf0864af1b3a7 (commit)
       via  847e828ad8e207d2d16cbf6ade1b7004fb2426f2 (commit)
       via  5c696c9882975b9feb11c4ea2d535378e77bcd04 (commit)
       via  958eccbe685be31e05b8651dd7bc3a72a3d11c99 (commit)
       via  7d0b2a500d2e8867bc3fe8db177e2f968d97a849 (commit)
       via  a4f034dcfb22c527a701dc32eb24df15faf38622 (commit)
       via  a7f1600075e5990bbecef9f273bf8cb0af77f444 (commit)
       via  623654b3e60749219d9fa790649f6833200c708f (commit)
       via  d64aea41b53bc585a88fa155bffe6c02562f29af (commit)
       via  72aedeaee32c837c3978f8e91d35af258dd6c880 (commit)
       via  349e921f0cc58898d43db5330643fc3789b0e7bf (commit)
       via  e9d1aa434ba33120497c9dee97ef386f955753b3 (commit)
       via  080f90db10d408e73b4dc9e8eeea8f32c5c0fcb1 (commit)
       via  81752bfad6b946001b867f04ab47ed1a73203b54 (commit)
       via  9fee5b0a87b2ca58c6c4c4a9fd20dc4773217d2c (commit)
       via  9353dd8149dd64b463bd207a9be0bc5bd02e1b8f (commit)
       via  673f9e8d81c71018e60c6e7117348528c679ac72 (commit)
       via  576ef02976be38ad1d9ce56a1d1a78145386acec (commit)
       via  8ca653bd739b1b898d408fc439c12cfd85fa1f81 (commit)
       via  e1847341cfa58fa1881760591e1b15c89a3b3d98 (commit)
       via  31f82419f61f057124629513bc58b08b0cbf3c0f (commit)
       via  9efb966a80d43d8472f1844e1960f7c3c4b26fc3 (commit)
       via  19dcde2cc6fabcf7abcfcc41a6987169910c70ee (commit)
       via  0aa8e7cbb655426867811936cf679d2add799d33 (commit)
       via  c7611f180ddcaab977b7c2450d1c2af7f5c30d22 (commit)
       via  275aecd899a44502b0a4f76eab747691bd92af5f (commit)
       via  3f83eaaeae44fb9716be7e0932fb52b67dbfb759 (commit)
       via  78e5e7f41cc406ab6fd735cd3bc2684f2ededd38 (commit)
       via  851a92b67b53c0f75bc703da381c4371d7aa0c23 (commit)
       via  e67a41c2641c54ab24d231d2d7e12ad17825bda3 (commit)
       via  1178a5061d81b691a58ffc2ac79be859a5feeade (commit)
       via  2e022453c47afd990d1f27e4403e813a45060e84 (commit)
       via  9f7b96df9ee33cb9469d21446a7cdde44c3ccb7a (commit)
       via  369e38a8e535a447a56e913dd3da63d857bc1ab0 (commit)
       via  1f9e8d9ff5e1fa75e0cd9f6be7699efc400dc796 (commit)
       via  556bf54a532d466b1b77c5872d01de211386ef15 (commit)
       via  bfbb0f9d2ced1b1ec12b1cf4c6b57625451bc47c (commit)
       via  8dd3dc0e1a319ae29aa0cfd7eb67955d26d79241 (commit)
       via  b2c9c8642fbde0022dd790f0a7fc4ccaa58071b1 (commit)
       via  76872d653fe255eb38335206d55eee31ad94f0c6 (commit)
       via  ee47a2ef8ac50751307755c71010d5c4b91effcc (commit)
       via  f268b4a8686fa136d4b6a4894d7232a439cf0b6f (commit)
       via  b917d36d4d91e0069678882fa6785a6ff78ce677 (commit)
       via  d395576d5663b58be0b3ac74609e735b5fa858d5 (commit)
       via  13f04bb0a3bc4098b7cc9b1a5f394e2876376292 (commit)
       via  5620383d390adef3a55d7a81234f1e1a8ff03430 (commit)
       via  5077625e83930a58b416ecac15e4a5a4faddf206 (commit)
       via  c7e5b4344e2f6745eeae14f1d77b6606a32475f7 (commit)
       via  2e4c74f5339433707eec29646d525d90be864ecc (commit)
       via  fd891bdc0b102fa187af0d4f44c24b1ded09c590 (commit)
       via  de1c49f45105d4a62b9572f8bf4efbf8c718933c (commit)
       via  0791f44ddb97bced3ded5da19580ba16966e9f63 (commit)
       via  2d535b3c8813521ba060c544c80baabc2b452f76 (commit)
       via  4c8c74c547955dd93c9e15d2f5c188918517aeeb (commit)
       via  ca95f560a6c8ccf5b3ffd2bff26249b982ecedea (commit)
       via  307e2b902ca3b1466aff00951914feb31bdedfec (commit)
       via  0fafee70d034c4406eb11b37817b12a70b50304e (commit)
       via  1f886e1225940e228bec9a983cf4a7b844e69cb4 (commit)
       via  24244fa6392253ffe2ff6c60757435be1b26da20 (commit)
       via  2b68a207e8b733c5d32f7f3baa63ab743a4a4f82 (commit)
       via  872dc33703f403a63e896a8b778a1e43fa7bad09 (commit)
       via  929982dac23f77950f2b7ff18ec85b51a42de558 (commit)
       via  95c838e77ca99e63a13721981e2aa07867c4bea1 (commit)
       via  d7418a0d23a8a23431e859442c782501abfc0553 (commit)
       via  7a25b8073e1e0d2bb2391a3feafb61b6bdacb380 (commit)
       via  6ced932f19f094541afd5c7ef8b069ea83f26438 (commit)
       via  238e6bb3ddcb4d697e3ac5189c73e0683132ad5e (commit)
       via  04e2c162bc7f6cd6b9bceb74089d1a9a29148b59 (commit)
       via  0c1ba29dc6631ac5ce38a3d2629fe17afcd39627 (commit)
       via  df6502431fb6d495c88eb9a223820f063432bd7e (commit)
       via  6fa0d1a69f5290d1154951965017380dc4e61825 (commit)
       via  06ba07d7d56ed8447eeb188eb4bb5770a9c41adc (commit)
       via  a2ce7d678f3574f6f63691dacead5e2574ded080 (commit)
       via  413bb6369fb40c99a952305fa924dc087da7792c (commit)
       via  626ae7f220d8b0ad44820a5110eeceb61248d032 (commit)
       via  ab478a5684fed6d71a1169104ff9067a240b1e81 (commit)
       via  dd6f1be516148b8f328adf3f174c43fe949a1b61 (commit)
       via  0024d93bcf841b13eec471b2d3f726cdbe686978 (commit)
       via  db6b6404ec286000fcb921edfe080fc6c2cc1c9d (commit)
       via  148efc74ad128c054300d461fb29ae8e31392bed (commit)
       via  827fc662e122ea00689893d167e77a46adf47a15 (commit)
       via  dc0dbb97620670914e030aab47cf1e0f90915ef1 (commit)
       via  c5ed0db396867362132166c17aac2a74274bb48d (commit)
       via  891cedd06767489bf8e00b9c1b98318d9c09d3ef (commit)
       via  0f17de699ae1b4e8f7abdb69053405a30b4b7952 (commit)
       via  4c5178bacdf897e9717c93187b2bcb657f2e1871 (commit)
       via  d17c5711691e51a7a46e787da409c568e8dc6cfd (commit)
       via  e37d9494e7db63a6f9e0798020dc3de62533da91 (commit)
       via  72138cabee93955fb3d648ac78c1faea422e2733 (commit)
       via  01940e42606ff1b41b53778a2b5148021be8d80b (commit)
       via  053aefa444ff4d34070d67d6f45809005c9c7c57 (commit)
       via  8b96c2315423a29b508d1d32622b5fd28b386653 (commit)
       via  116744bd3cb957d26797c50bcc63e4c673ec49ad (commit)
       via  7560c60db1c62ab3b846eba93098d9e81f1be09d (commit)
       via  db9137c28c816f89efc2f9d69accd5e60cc7ec95 (commit)
       via  1cc1ec91224cb05370e8e996433ecb7b5f8201fe (commit)
       via  49098782accde3746af4857574c15ceac1ea7916 (commit)
       via  475da6c6e49647d883663e3b93e443c57f415169 (commit)
       via  0adc89a842ccb2893a472539fe89ffb2e032f41a (commit)
       via  f9be80d1e56708c2673f952d14a0a42b35cb891e (commit)
       via  c004843947a6e1724a08225c7791cb46eee01304 (commit)
      from  c5eff00eb9e4e64bac262fbc8f0ff7631c9b5cf8 (commit)

Summary of changes:
 CMakeLists.txt                           |   39 +-
 config/Sip.config                        |   82 ++
 config/SipConfigurator.py                |  178 ++++
 config/test_sip_state_replicator.conf    |    8 +
 local-slice/SipConfigurationIf.ice       |  569 ++++++++----
 local-slice/SipStateReplicationIf.ice    |   19 +-
 src/CMakeLists.txt                       |   58 +-
 src/PJSipLoggingModule.cpp               |    8 +-
 src/PJSipLoggingModule.h                 |    2 +
 src/PJSipManager.cpp                     |  102 ++-
 src/PJSipManager.h                       |  108 ++-
 src/PJSipModule.cpp                      |   14 +-
 src/PJSipModule.h                        |    3 +-
 src/PJSipRegistrarModule.cpp             |   79 ++-
 src/PJSipRegistrarModule.h               |    2 +
 src/PJSipSessionModule.cpp               | 1593 +++++++++++++++++++-----------
 src/PJSipSessionModule.h                 |  223 ++++-
 src/PJSipSessionModuleConstruction.cpp   |   25 +-
 src/SipConfiguration.cpp                 | 1525 ++++++++++++++++++++++++++++
 src/SipConfiguration.h                   |   48 +
 src/SipEndpoint.cpp                      |  123 ++-
 src/SipEndpoint.h                        |   66 +-
 src/SipEndpointFactory.cpp               |   24 +-
 src/SipEndpointFactory.h                 |   23 +-
 src/SipSession.cpp                       |  911 ++++++++++++-----
 src/SipSession.h                         |  116 ++-
 src/SipSessionManagerApp.cpp             |  193 +++--
 src/SipSessionManagerEndpointLocator.cpp |   22 +-
 src/SipSessionManagerEndpointLocator.h   |    9 +-
 src/SipSessionManagerEventPublisher.cpp  |   11 +-
 src/SipSessionManagerEventPublisher.h    |    2 +-
 src/SipStateReplicator.h                 |   47 +-
 src/SipStateReplicatorApp.cpp            |  153 +++-
 src/SipStateReplicatorListener.cpp       |   60 +-
 34 files changed, 5052 insertions(+), 1393 deletions(-)
 create mode 100644 config/Sip.config
 create mode 100755 config/SipConfigurator.py
 create mode 100644 src/SipConfiguration.cpp
 create mode 100644 src/SipConfiguration.h


- Log -----------------------------------------------------------------
commit 72fce78916b051f6d76a4e61de9fb5d26eec10de
Author: Mark Michelson <mmichelson at digium.com>
Date:   Thu Jun 9 16:53:27 2011 -0500

    Start fixing compiler errors.
    
    There's still an odd one though.

diff --git a/src/PJSipManager.h b/src/PJSipManager.h
index b0fa340..56fe148 100644
--- a/src/PJSipManager.h
+++ b/src/PJSipManager.h
@@ -93,9 +93,13 @@ public:
 private:
     static PJSipManager *mInstance;
     pjsip_endpoint *mEndpoint;
-    PJSipSessionModule *mSessionModule;
-    PJSipLoggingModule *mLoggingModule;
-    PJSipRegistrarModule *mRegistrarModule;
+    PJSipSessionModulePtr mSessionModule;
+    PJSipLoggingModulePtr mLoggingModule;
+    PJSipRegistrarModulePtr mRegistrarModule;
+    pj_thread_t *mPjThread;
+    pj_caching_pool mCachingPool;
+    pj_pool_t *mMemoryPool;
+    pjsip_transport *mUdpTransport;
     /**
      * Create a UDP transport.
      */
@@ -110,16 +114,6 @@ private:
      * Create a TLS transport.
      */
     pjsip_tpfactory *createTLSTransport(std::string, int, pjsip_tls_setting*);
-private:
-    static PJSipManager *mInstance;
-    pjsip_endpoint *mEndpoint;
-    PJSipSessionModulePtr mSessionModule;
-    PJSipLoggingModulePtr mLoggingModule;
->>>>>>> master
-    pj_thread_t *mPjThread;
-    pj_caching_pool mCachingPool;
-    pj_pool_t *mMemoryPool;
-    pjsip_transport *mUdpTransport;
 
     bool setTransports(pjsip_endpoint *endpoint, const Ice::PropertiesPtr& props);
 };
diff --git a/src/PJSipRegistrarModule.cpp b/src/PJSipRegistrarModule.cpp
index 844afbc..2993f77 100644
--- a/src/PJSipRegistrarModule.cpp
+++ b/src/PJSipRegistrarModule.cpp
@@ -71,28 +71,29 @@ public:
         }
     }
 
-    void updateBindings(const std::string &aor, BindingSeq& existingBindings, BindingSeq& newBindings, BindingSeq& removedBindings)
+    void updateBindings(const std::string &aor, BindingSeq&, BindingSeq& newBindings, BindingSeq& removedBindings)
     {
         //Best way to do this...
         //First, find the sequence of bindings for this particular AoR that we are going to be
         //updating.
 
-        BindingSeq::iterator currentBindings = mBindings.find(aor);
+        BindingDict::iterator thingy = mBindings.find(aor);
 
         //Let's add in the new bindings, shall we?
-        if (currentBindings == mBindings.end())
+        if (thingy == mBindings.end())
         {
             mBindings.insert(make_pair(aor,newBindings));
         }
         else
         {
-            currentBindings->push_back(newBindings);
-            currentBindings->erase(std::remove(currentBindings->begin(), currentBindings->end(), removedBindings), currentBindings->end());
+            BindingSeq& currentBindings = thingy->second;
+            currentBindings.insert(currentBindings.end(), newBindings.begin(), newBindings.end());
+            currentBindings.erase(std::remove(currentBindings.begin(), currentBindings.end(), removedBindings), currentBindings.end());
         }
 
         // We have our internal stuff all sorted out. Now we need to notify listeners and replicas.
-        BindingUpdateSeq newBindingUpdateSeq(createBindingUpdateSeq(newBindings));
-        BindingUpdateSeq removedBindingUpdateSeq(createBindingUpdateSeq(removedBindings));
+        BindingUpdateSeq newBindingUpdateSeq(createBindingUpdateSeq(aor, newBindings));
+        BindingUpdateSeq removedBindingUpdateSeq(createBindingUpdateSeq(aor, removedBindings));
         for (std::vector<RegistrarListenerPrx>::iterator iter = mListeners.begin();
                 iter != mListeners.end(); ++iter)
         {
@@ -111,7 +112,9 @@ public:
         {
             contacts.push_back((*iter)->contact);
         }
-        BindingUpdatePtr update(new BindingUpdate(aor, contacts));
+        BindingUpdate update;
+        update.aor = aor;
+        update.contacts = contacts;
         returnedSeq.push_back(update);
         return returnedSeq;
     }
@@ -125,7 +128,7 @@ public:
     std::vector<RegistrarListenerPrx> mListeners;
 };
 
-pj_status_t PJSipRegistrarModule::load(pjsip_endpoint *endpt)
+pj_status_t PJSipRegistrarModule::load(pjsip_endpoint *)
 {
     return PJ_SUCCESS;
 }
@@ -174,10 +177,10 @@ std::vector<pjsip_contact_hdr *> PJSipRegistrarModule::extractRegisterContacts(p
     return registerContacts;
 }
 
-bool verifyContacts(const std::vector<pjsip_contact_hdr *> contacts)
+bool verifyContacts(const std::vector<pjsip_contact_hdr *>& contacts)
 {
     bool multipleContacts = contacts.size() > 1;
-    for (<std::vector<pjsip_contact_hdr *>::iterator iter = contacts.begin();
+    for (std::vector<pjsip_contact_hdr *>::const_iterator iter = contacts.begin();
             iter != contacts.end(); ++iter)
     {
         if ((*iter)->star)
@@ -292,7 +295,7 @@ pj_bool_t PJSipRegistrarModule::on_rx_request(pjsip_rx_data *rdata)
     //The first thing we should do is verify that the contacts we extracted are well-formed.
     //Specifically, we're going to make sure they haven't done something silly like including
     //a '*' contact in a list with others or specifying a non-zero expiration for a '*' contact.
-    if (!verifyContacts(registerContacts, callID, cSeq))
+    if (!verifyContacts(registerContacts))
     {
         pjsip_tx_data *tdata;
         pjsip_endpt_create_response(tsx->endpt, rdata, 400, NULL, &tdata);
@@ -313,12 +316,12 @@ pj_bool_t PJSipRegistrarModule::on_rx_request(pjsip_rx_data *rdata)
         {
             if (expiration == 0)
             {
-                removedBindings.push_back(bindingToUpdate);
+                removedBindings.push_back(*bindingToUpdate);
             }
             else
             {
                 updateBinding(*bindingToUpdate, callID, cSeq, time(NULL) + expiration);
-                existingBindings.push_back(existingBindings);
+                existingBindings.push_back(*bindingToUpdate);
             }
         }
         else
@@ -339,26 +342,26 @@ pj_bool_t PJSipRegistrarModule::on_rx_request(pjsip_rx_data *rdata)
     return PJ_FALSE;
 }
 
-pj_bool_t PJSipRegistrarModule::on_rx_response(pjsip_rx_data *rdata)
+pj_bool_t PJSipRegistrarModule::on_rx_response(pjsip_rx_data *)
 {
     // The registrar is purely a UAS and will never get any responses.
     return PJ_FALSE;
 }
 
-pj_status_t PJSipRegistrarModule::on_tx_request(pjsip_tx_data *tdata)
+pj_status_t PJSipRegistrarModule::on_tx_request(pjsip_tx_data *)
 {
     // The registrar is purely a UAS and will never send requests.
     return PJ_SUCCESS;
 }
 
-pj_status_t PJSipRegistrarModule::on_tx_response(pjsip_tx_data *tdata)
+pj_status_t PJSipRegistrarModule::on_tx_response(pjsip_tx_data *)
 {
     // I can't think of anything in particular we'd want to do prior
     // to sending a response.
     return PJ_SUCCESS;
 }
 
-void PJSipRegistrarModule::on_tsx_state(pjsip_transaction *tsx, pjsip_event *event)
+void PJSipRegistrarModule::on_tsx_state(pjsip_transaction *, pjsip_event *)
 {
     // I can't think of anything we'd want to do on a transaction state
     // change.
diff --git a/src/PJSipRegistrarModule.h b/src/PJSipRegistrarModule.h
index 2f6105b..d5f7acf 100644
--- a/src/PJSipRegistrarModule.h
+++ b/src/PJSipRegistrarModule.h
@@ -57,5 +57,7 @@ private:
     RegistrarIPtr mRegistrar;
 };
 
+typedef IceUtil::Handle<PJSipRegistrarModule> PJSipRegistrarModulePtr;
+
 };
 };

commit 51d7a0addacb9eae0fc88bea5b010a0559b4b887
Merge: df0ebe1 842ac29
Author: Mark Michelson <mmichelson at digium.com>
Date:   Thu Jun 9 16:01:24 2011 -0500

    Merge branch 'master' into registrar
    
    Conflicts:
    	src/CMakeLists.txt
    	src/PJSipManager.cpp
    	src/PJSipManager.h

diff --cc src/CMakeLists.txt
index e9b9f9a,5aa8e59..a10e59f
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@@ -27,9 -32,8 +32,11 @@@ asterisk_scf_component_add_file(SipSess
  asterisk_scf_component_add_file(SipSessionManager PJSipLoggingModule.cpp)
  asterisk_scf_component_add_file(SipSessionManager PJSipLoggingModuleConstruction.cpp)
  asterisk_scf_component_add_file(SipSessionManager PJSipLoggingModule.h)
 +asterisk_scf_component_add_file(SipSessionManager PJSipRegistrarModule.cpp)
 +asterisk_scf_component_add_file(SipSessionManager PJSipRegistrarModuleConstruction.cpp)
 +asterisk_scf_component_add_file(SipSessionManager PJSipRegistrarModule.h)
+ asterisk_scf_component_add_file(SipSessionManager SipConfiguration.cpp)
+ asterisk_scf_component_add_file(SipSessionManager SipConfiguration.h)
  asterisk_scf_component_add_file(SipSessionManager SipStateReplicatorListener.cpp)
  asterisk_scf_component_add_file(SipSessionManager SipStateReplicator.h)
  asterisk_scf_component_add_slice(SipSessionManager ../local-slice/SipIf.ice)
diff --cc src/PJSipManager.cpp
index 8897d92,ffd2854..ef525df
--- a/src/PJSipManager.cpp
+++ b/src/PJSipManager.cpp
@@@ -86,12 -93,7 +93,12 @@@ void PJSipManager::registerLoggingModul
      mLoggingModule = new PJSipLoggingModule(mEndpoint);
  }
  
 +void PJSipManager::registerRegistrarModule()
 +{
 +    mRegistrarModule = new PJSipRegistrarModule(mEndpoint);
 +}
 +
- PJSipSessionModule *PJSipManager::getSessionModule()
+ PJSipSessionModulePtr PJSipManager::getSessionModule()
  {
      return mSessionModule;
  }
diff --cc src/PJSipManager.h
index 33094b0,9138770..b0fa340
--- a/src/PJSipManager.h
+++ b/src/PJSipManager.h
@@@ -83,17 -84,24 +85,37 @@@ public
      void registerLoggingModule();
  
      /**
 +     * Register the PJSIPRegistrar, responsible
 +     * for keeping track of bindings of contact URIs to
 +     * addresses of record.
 +     */
 +    void registerRegistrarModule();
 +private:
 +    static PJSipManager *mInstance;
 +    pjsip_endpoint *mEndpoint;
 +    PJSipSessionModule *mSessionModule;
 +    PJSipLoggingModule *mLoggingModule;
 +    PJSipRegistrarModule *mRegistrarModule;
++    /**
+      * Create a UDP transport.
+      */
+     pjsip_transport *createUDPTransport(std::string, int);
+ 
+     /**
+      * Create a TCP transport.
+      */
+     pjsip_tpfactory *createTCPTransport(std::string, int);
+ 
+     /**
+      * Create a TLS transport.
+      */
+     pjsip_tpfactory *createTLSTransport(std::string, int, pjsip_tls_setting*);
+ private:
+     static PJSipManager *mInstance;
+     pjsip_endpoint *mEndpoint;
+     PJSipSessionModulePtr mSessionModule;
+     PJSipLoggingModulePtr mLoggingModule;
++>>>>>>> master
      pj_thread_t *mPjThread;
      pj_caching_pool mCachingPool;
      pj_pool_t *mMemoryPool;

commit df0ebe1c9b2b5eb5b99f1a5e4140dd13b3a14622
Author: Mark Michelson <mmichelson at digium.com>
Date:   Thu Jun 9 15:48:03 2011 -0500

    Adjust logic for updating bindings so that it is easier to send updates
    to listeners und replicas.

diff --git a/src/PJSipRegistrarModule.cpp b/src/PJSipRegistrarModule.cpp
index becac42..844afbc 100644
--- a/src/PJSipRegistrarModule.cpp
+++ b/src/PJSipRegistrarModule.cpp
@@ -71,14 +71,49 @@ public:
         }
     }
 
-    void updateBindings(const std::string &aor, BindingSeq bindings)
+    void updateBindings(const std::string &aor, BindingSeq& existingBindings, BindingSeq& newBindings, BindingSeq& removedBindings)
     {
-        mBindings.erase(aor);
-        if (!bindings.empty())
+        //Best way to do this...
+        //First, find the sequence of bindings for this particular AoR that we are going to be
+        //updating.
+
+        BindingSeq::iterator currentBindings = mBindings.find(aor);
+
+        //Let's add in the new bindings, shall we?
+        if (currentBindings == mBindings.end())
+        {
+            mBindings.insert(make_pair(aor,newBindings));
+        }
+        else
+        {
+            currentBindings->push_back(newBindings);
+            currentBindings->erase(std::remove(currentBindings->begin(), currentBindings->end(), removedBindings), currentBindings->end());
+        }
+
+        // We have our internal stuff all sorted out. Now we need to notify listeners and replicas.
+        BindingUpdateSeq newBindingUpdateSeq(createBindingUpdateSeq(newBindings));
+        BindingUpdateSeq removedBindingUpdateSeq(createBindingUpdateSeq(removedBindings));
+        for (std::vector<RegistrarListenerPrx>::iterator iter = mListeners.begin();
+                iter != mListeners.end(); ++iter)
         {
-            mBindings.insert(make_pair(aor, bindings));
+            //Listeners are only concerned with new and removed bindings. There's no need to tell them of existing ones.
+            (*iter)->contactsAdded(newBindingUpdateSeq);
+            (*iter)->contactsRemoved(removedBindingUpdateSeq);
         }
-        //XXX We should replicate state here and update listeners here.
+        //XXX This would be where we replicate state. BACKBURNER!
+    }
+
+    BindingUpdateSeq createBindingUpdateSeq(const std::string& aor, BindingSeq& bindings)
+    {
+        BindingUpdateSeq returnedSeq;
+        Ice::StringSeq contacts;
+        for (BindingSeq::iterator iter = bindings.begin(); iter != bindings.end(); ++iter)
+        {
+            contacts.push_back((*iter)->contact);
+        }
+        BindingUpdatePtr update(new BindingUpdate(aor, contacts));
+        returnedSeq.push_back(update);
+        return returnedSeq;
     }
 
     // Ready-made empty sequence to return when someone tries to grab
@@ -248,7 +283,7 @@ pj_bool_t PJSipRegistrarModule::on_rx_request(pjsip_rx_data *rdata)
     // way decided upon before trying to write any code for it.
 
     std::string aor = getAOR(rdata);
-    BindingSeq existingBindings = mRegistrar->getAORBindings(aor);
+    BindingSeq currentBindings = mRegistrar->getAORBindings(aor);
     std::vector<pjsip_contact_hdr *> registerContacts = extractRegisterContacts(rdata);
 
     std::string callID(pj_strbuf(&rdata->msg_info.cid->id), pj_strlen(&rdata->msg_info.cid->id));
@@ -264,33 +299,38 @@ pj_bool_t PJSipRegistrarModule::on_rx_request(pjsip_rx_data *rdata)
         pjsip_tsx_send_msg(tsx, tdata);
     }
 
+    BindingSeq newBindings;
+    BindingSeq removedBindings;
+    BindingSeq existingBindings;
     for (std::vector<pjsip_contact_hdr *>::iterator iter = registerContacts.begin();
             iter != registerContacts.end(); ++iter)
     {
         BindingSeq::iterator bindingToUpdate = findMatchingBinding(*iter, existingBindings);
 
         int expiration = getExpiration(*iter, rdata);
+
         if (bindingToUpdate != existingBindings.end())
         {
             if (expiration == 0)
             {
-                existingBindings.erase(bindingToUpdate);
+                removedBindings.push_back(bindingToUpdate);
             }
             else
             {
-                updateBinding(*existingBinding, callID, cSeq, time(NULL) + expiration);
+                updateBinding(*bindingToUpdate, callID, cSeq, time(NULL) + expiration);
+                existingBindings.push_back(existingBindings);
             }
         }
         else
         {
             BindingPtr binding = createNewBinding(*iter, callID, cSeq, time(NULL) + expiration);
-            existingBindings.push_back(binding);
+            newBindings.push_back(binding);
         }
     }
 
     // Now existingBindings should be an up-to-date list of bindings for
     // this AoR.
-    mRegistrar->updateBindings(aor, existingBindings);
+    mRegistrar->updateBindings(aor, existingBindings, newBindings, removedBindings);
 
     pjsip_tx_data *tdata;
     pjsip_endpt_create_response(tsx->endpt, rdata, 200, NULL, &tdata);

-----------------------------------------------------------------------


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list