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

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Wed Jan 4 14:32:41 CST 2012


branch "error-handling" has been updated
       via  f9d1cbcbabc11e78b99c09ef39c6e288da921906 (commit)
       via  e422566158372ea12ce851dec4b12a7145eef168 (commit)
       via  bc37777aa09787707de1c05374cb7623656b3f98 (commit)
       via  6d5ab58d36d69052c2ea7b389ef90d09351b23ff (commit)
       via  75e4696143a153403a7236520fa71dc5de685899 (commit)
       via  9bbfae7224fea73e708f6cc980f75aa4d0f0c405 (commit)
       via  872c1fcf062ceb5d0e46383b3ee9da4a65545e58 (commit)
       via  6cea9d54eac34ea83f032d7da76ad114b7867e1c (commit)
       via  20bb5be857d5c414305cfce89ffa15a1cc9e2e3c (commit)
       via  25975e396af5734953cd1b13476f439872113a3b (commit)
       via  306d97333fcc6cd2f83219f9739a786164d6e866 (commit)
       via  7552d2d7372870b6504e7d5459fe23d8925fedac (commit)
      from  e8d23580c55b5b19f62c6990225ba60efd5b5f4a (commit)

Summary of changes:
 .../SIPConfigurationIf.ice}                        |   98 ++--
 .../SIPStateReplicationIf.ice}                     |   50 +-
 .../SIPSessionCookiesIf.ice}                       |    4 +-
 slice/{SipIf.ice => SIPIf.ice}                     |    6 +-
 src/AuthManager.cpp                                |    2 +-
 src/AuthManager.h                                  |    6 +-
 src/CMakeLists.txt                                 |  176 ++++----
 src/Component.cpp                                  |  150 +++---
 src/NATOptions.h                                   |    4 +-
 src/{PJSipDummyModule.h => PJSIPDummyModule.h}     |    8 +-
 ...uction.cpp => PJSIPDummyModuleConstruction.cpp} |    8 +-
 ...SipLoggingModule.cpp => PJSIPLoggingModule.cpp} |   28 +-
 src/{PJSipLoggingModule.h => PJSIPLoggingModule.h} |   10 +-
 ...tion.cpp => PJSIPLoggingModuleConstruction.cpp} |    8 +-
 src/{PJSipManager.cpp => PJSIPManager.cpp}         |   82 ++--
 src/{PJSipManager.h => PJSIPManager.h}             |   66 ++--
 src/{PJSipModule.cpp => PJSIPModule.cpp}           |   34 +-
 src/{PJSipModule.h => PJSIPModule.h}               |   30 +-
 ...egistrarModule.cpp => PJSIPRegistrarModule.cpp} |   92 ++--
 ...SipRegistrarModule.h => PJSIPRegistrarModule.h} |   22 +-
 ...on.cpp => PJSIPRegistrarModuleConstruction.cpp} |   12 +-
 ...SipSessionModule.cpp => PJSIPSessionModule.cpp} |  371 ++++++++------
 src/{PJSipSessionModule.h => PJSIPSessionModule.h} |  102 ++--
 ...tion.cpp => PJSIPSessionModuleConstruction.cpp} |   48 +-
 src/PJUtil.h                                       |    4 +-
 ...tRegistration.cpp => SIPClientRegistration.cpp} |   66 ++-
 ...lientRegistration.h => SIPClientRegistration.h} |   34 +-
 src/{SipConfiguration.cpp => SIPConfiguration.cpp} |  428 ++++++++--------
 src/{SipConfiguration.h => SIPConfiguration.h}     |   14 +-
 src/{SipEndpoint.cpp => SIPEndpoint.cpp}           |  174 ++++----
 src/{SipEndpoint.h => SIPEndpoint.h}               |   96 ++--
 ...pEndpointFactory.cpp => SIPEndpointFactory.cpp} |   38 +-
 src/{SipEndpointFactory.h => SIPEndpointFactory.h} |   30 +-
 src/{SipModule.h => SIPModule.h}                   |   16 +-
 ...istrarListener.cpp => SIPRegistrarListener.cpp} |   44 +-
 ...pRegistrarListener.h => SIPRegistrarListener.h} |   18 +-
 ...eplicationContext.h => SIPReplicationContext.h} |   14 +-
 src/{SipSession.cpp => SIPSession.cpp}             |  538 ++++++++++---------
 src/{SipSession.h => SIPSession.h}                 |  100 ++--
 ...or.cpp => SIPSessionManagerEndpointLocator.cpp} |   18 +-
 ...ocator.h => SIPSessionManagerEndpointLocator.h} |   12 +-
 ...her.cpp => SIPSessionManagerEventPublisher.cpp} |   30 +-
 ...blisher.h => SIPSessionManagerEventPublisher.h} |   14 +-
 src/SIPStateReplicator.h                           |   61 +++
 ...ReplicatorApp.cpp => SIPStateReplicatorApp.cpp} |   50 +-
 ...Listener.cpp => SIPStateReplicatorListener.cpp} |  138 +++---
 ...honyEventSink.cpp => SIPTelephonyEventSink.cpp} |   24 +-
 ...elephonyEventSink.h => SIPTelephonyEventSink.h} |   10 +-
 ...EventSource.cpp => SIPTelephonyEventSource.cpp} |   32 +-
 ...honyEventSource.h => SIPTelephonyEventSource.h} |   10 +-
 src/{SipTransfer.cpp => SIPTransfer.cpp}           |   59 ++-
 src/{SipTransfer.h => SIPTransfer.h}               |   38 +-
 src/STUNModule.cpp                                 |   14 +-
 src/STUNModule.h                                   |   16 +-
 src/STUNTransport.cpp                              |   10 +-
 src/STUNTransport.h                                |   10 +-
 src/STUNTransportConfig.cpp                        |   34 +-
 src/STUNTransportConfig.h                          |   16 +-
 src/SipStateReplicator.h                           |   61 ---
 src/TCPTransport.cpp                               |    6 +-
 src/TCPTransport.h                                 |   10 +-
 src/TLSTransport.cpp                               |   10 +-
 src/TLSTransport.h                                 |   10 +-
 src/Transports.cpp                                 |    2 +-
 src/Transports.h                                   |    8 +-
 src/UDPTransport.cpp                               |    6 +-
 src/UDPTransport.h                                 |   10 +-
 67 files changed, 1921 insertions(+), 1829 deletions(-)
 rename slice/AsteriskSCF/Configuration/{SipSessionManager/SipConfigurationIf.ice => SIPSessionManager/SIPConfigurationIf.ice} (78%)
 rename slice/AsteriskSCF/Replication/{SipSessionManager/SipStateReplicationIf.ice => SIPSessionManager/SIPStateReplicationIf.ice} (81%)
 rename slice/AsteriskSCF/SessionCookies/{SipSessionManager/SipSessionCookiesIf.ice => SIPSessionManager/SIPSessionCookiesIf.ice} (95%)
 rename slice/{SipIf.ice => SIPIf.ice} (89%)
 rename src/{PJSipDummyModule.h => PJSIPDummyModule.h} (82%)
 rename src/{PJSipDummyModuleConstruction.cpp => PJSIPDummyModuleConstruction.cpp} (93%)
 rename src/{PJSipLoggingModule.cpp => PJSIPLoggingModule.cpp} (65%)
 rename src/{PJSipLoggingModule.h => PJSIPLoggingModule.h} (82%)
 rename src/{PJSipLoggingModuleConstruction.cpp => PJSIPLoggingModuleConstruction.cpp} (93%)
 rename src/{PJSipManager.cpp => PJSIPManager.cpp} (74%)
 rename src/{PJSipManager.h => PJSIPManager.h} (69%)
 rename src/{PJSipModule.cpp => PJSIPModule.cpp} (86%)
 rename src/{PJSipModule.h => PJSIPModule.h} (79%)
 rename src/{PJSipRegistrarModule.cpp => PJSIPRegistrarModule.cpp} (91%)
 rename src/{PJSipRegistrarModule.h => PJSIPRegistrarModule.h} (93%)
 rename src/{PJSipRegistrarModuleConstruction.cpp => PJSIPRegistrarModuleConstruction.cpp} (90%)
 rename src/{PJSipSessionModule.cpp => PJSIPSessionModule.cpp} (87%)
 rename src/{PJSipSessionModule.h => PJSIPSessionModule.h} (82%)
 rename src/{PJSipSessionModuleConstruction.cpp => PJSIPSessionModuleConstruction.cpp} (81%)
 rename src/{SipClientRegistration.cpp => SIPClientRegistration.cpp} (83%)
 rename src/{SipClientRegistration.h => SIPClientRegistration.h} (85%)
 rename src/{SipConfiguration.cpp => SIPConfiguration.cpp} (79%)
 rename src/{SipConfiguration.h => SIPConfiguration.h} (81%)
 rename src/{SipEndpoint.cpp => SIPEndpoint.cpp} (84%)
 rename src/{SipEndpoint.h => SIPEndpoint.h} (83%)
 rename src/{SipEndpointFactory.cpp => SIPEndpointFactory.cpp} (70%)
 rename src/{SipEndpointFactory.h => SIPEndpointFactory.h} (75%)
 rename src/{SipModule.h => SIPModule.h} (81%)
 rename src/{SipRegistrarListener.cpp => SIPRegistrarListener.cpp} (72%)
 rename src/{SipRegistrarListener.h => SIPRegistrarListener.h} (70%)
 rename src/{SipReplicationContext.h => SIPReplicationContext.h} (84%)
 rename src/{SipSession.cpp => SIPSession.cpp} (91%)
 rename src/{SipSession.h => SIPSession.h} (85%)
 rename src/{SipSessionManagerEndpointLocator.cpp => SIPSessionManagerEndpointLocator.cpp} (82%)
 rename src/{SipSessionManagerEndpointLocator.h => SIPSessionManagerEndpointLocator.h} (84%)
 rename src/{SipSessionManagerEventPublisher.cpp => SIPSessionManagerEventPublisher.cpp} (79%)
 rename src/{SipSessionManagerEventPublisher.h => SIPSessionManagerEventPublisher.h} (79%)
 create mode 100644 src/SIPStateReplicator.h
 rename src/{SipStateReplicatorApp.cpp => SIPStateReplicatorApp.cpp} (88%)
 rename src/{SipStateReplicatorListener.cpp => SIPStateReplicatorListener.cpp} (85%)
 rename src/{SipTelephonyEventSink.cpp => SIPTelephonyEventSink.cpp} (92%)
 rename src/{SipTelephonyEventSink.h => SIPTelephonyEventSink.h} (87%)
 rename src/{SipTelephonyEventSource.cpp => SIPTelephonyEventSource.cpp} (81%)
 rename src/{SipTelephonyEventSource.h => SIPTelephonyEventSource.h} (89%)
 rename src/{SipTransfer.cpp => SIPTransfer.cpp} (93%)
 rename src/{SipTransfer.h => SIPTransfer.h} (91%)
 delete mode 100644 src/SipStateReplicator.h


- Log -----------------------------------------------------------------
commit f9d1cbcbabc11e78b99c09ef39c6e288da921906
Author: Mark Michelson <mmichelson at digium.com>
Date:   Wed Jan 4 14:31:38 2012 -0600

    Add warning message and correct namespace error in SIPTransfer.cpp

diff --git a/src/SIPTransfer.cpp b/src/SIPTransfer.cpp
index 3f4a110..2620727 100644
--- a/src/SIPTransfer.cpp
+++ b/src/SIPTransfer.cpp
@@ -34,8 +34,9 @@ pjsip_tx_data* createNotify(pjsip_dialog *dlg, pj_int32_t cseq, bool active)
 {
     pjsip_tx_data *tdata;
     
-    if (AsteriskSCF::SipSessionManager::fail(pjsip_dlg_create_request(dlg, pjsip_get_notify_method(), -1, &tdata)))
+    if (AsteriskSCF::SIPSessionManager::fail(pjsip_dlg_create_request(dlg, pjsip_get_notify_method(), -1, &tdata)))
     {
+        lg(Warning) << "Unable to create NOTIFY request";
         return 0;
     }
 

commit e422566158372ea12ce851dec4b12a7145eef168
Author: Mark Michelson <mmichelson at digium.com>
Date:   Wed Jan 4 14:19:50 2012 -0600

    Add warning messages for SIPClientRegistration.cpp

diff --git a/src/SIPClientRegistration.cpp b/src/SIPClientRegistration.cpp
index c496f4d..91cc147 100644
--- a/src/SIPClientRegistration.cpp
+++ b/src/SIPClientRegistration.cpp
@@ -213,6 +213,10 @@ void SIPRegistrationClient::destroyPJSIPRegistration()
     {
         pjsip_regc_send(mReg, tdata);
     }
+    else
+    {
+        lg(Warning) << "Unable to create REGISTER request to unregister ourselves";
+    }
 
     pjsip_regc_destroy(mReg);
 }
@@ -336,6 +340,10 @@ void SIPRegistrationClient::authenticate(pjsip_rx_data *rdata)
         {
             sendRegister();
         }
+        else
+        {
+            lg(Warning) << "Unable to create REGISTER with authentication credentials";
+        }
     }
     return;
 }

commit bc37777aa09787707de1c05374cb7623656b3f98
Author: Mark Michelson <mmichelson at digium.com>
Date:   Wed Jan 4 14:16:46 2012 -0600

    Add log messages to PJSIPSessionModule.cpp for when PJSIP functions fail.

diff --git a/src/PJSIPSessionModule.cpp b/src/PJSIPSessionModule.cpp
index a78310b..7a9476e 100644
--- a/src/PJSIPSessionModule.cpp
+++ b/src/PJSIPSessionModule.cpp
@@ -402,6 +402,10 @@ protected:
             {
                 pjsip_inv_send_msg(mInv, mTdata);
             }
+            else
+            {
+                lg(Warning) << "Unable to create 500 response for INVITE";
+            }
             return Complete;
         }
 
@@ -436,6 +440,10 @@ protected:
             {
                 pjsip_inv_send_msg(mInv, mTdata);
             }
+            else
+            {
+                lg(Warning) << "Unable to create 488 response for INVITE";
+            }
             return Complete;
         }
 
@@ -482,6 +490,10 @@ protected:
             {
                 pjsip_inv_send_msg(mInv, mTdata);
             }
+            else
+            {
+                lg(Warning) << "Unable to create 500 response for INVITE";
+            }
         }
         return Complete;
     }
@@ -499,6 +511,10 @@ protected:
             {
                 pjsip_inv_send_msg(mInv, mTdata);
             }
+            else
+            {
+                lg(Warning) << "Unable to create 404 response for INVITE";
+            }
         }
         catch (...)
         {
@@ -506,6 +522,10 @@ protected:
             {
                 pjsip_inv_send_msg(mInv, mTdata);
             }
+            else
+            {
+                lg(Warning) << "Unable to create 500 response for INVITE";
+            }
         }
         return Complete;
     }
@@ -814,6 +834,7 @@ void PJSIPSessionModule::handleNewInvite(pjsip_rx_data *rdata)
     // Verify we can handle this invite request and respond accordingly if we can not
     if (fail(pjsip_inv_verify_request(rdata, &options, NULL, NULL, mEndpoint, &tdata)))
     {
+        lg(Warning) << "Cannot verify that we are able to handle this INVITE";
         if (tdata)
         {
             pjsip_endpt_send_response2(mEndpoint, rdata, tdata, NULL, NULL);
@@ -830,6 +851,7 @@ void PJSIPSessionModule::handleNewInvite(pjsip_rx_data *rdata)
     // If this is an attended transfer and something is amuck... respond accordingly
     if (fail(pjsip_replaces_verify_request(rdata, &replaced_dlg, PJ_FALSE, &tdata)))
     {
+        lg(Warning) << "Cannot verify that we can handle this INVITE with Replaces request";
         if (tdata)
         {
             pjsip_endpt_send_response2(mEndpoint, rdata, tdata, NULL, NULL);
@@ -922,6 +944,10 @@ void PJSIPSessionModule::handleNewInvite(pjsip_rx_data *rdata)
         {
             pjsip_inv_send_msg(inv_session, tdata);
         }
+        else
+        {
+            lg(Warning) << "Unable to create 403 response for INVITE";
+        }
         return;
     }
     SIPEndpointConfig &config = caller->getConfig();
@@ -932,6 +958,10 @@ void PJSIPSessionModule::handleNewInvite(pjsip_rx_data *rdata)
         {
             pjsip_inv_send_msg(inv_session, tdata);
         }
+        else
+        {
+            lg(Warning) << "Unable to create 403 response for INVITE";
+        }
         return;
     }
 
@@ -954,6 +984,10 @@ void PJSIPSessionModule::handleNewInvite(pjsip_rx_data *rdata)
         {
             pjsip_inv_send_msg(inv_session, tdata);
         }
+        else
+        {
+            lg(Warning) << "Unable to create 416 response for INVITE";
+        }
         return;
     }
 
@@ -1515,6 +1549,10 @@ void PJSIPSessionModule::handleInviteRejection(pjsip_inv_session* inv,
                 //a queued operation.
                 pjsip_inv_send_msg(inv, tdata);
             }
+            else
+            {
+                lg(Warning) << "Unable to create INVITE with authentication credentials";
+            }
             return;
         }
     }
@@ -1823,6 +1861,10 @@ void PJSIPSessionModule::handleNonInviteAuthentication(pjsip_inv_session* inv,
             //a queued operation.
             pjsip_dlg_send_request(dlg, tdata, -1, NULL);
         }
+        else
+        {
+            lg(Warning) << "Unable to create request with authentication credentials";
+        }
     }
     return;
 }
@@ -1913,6 +1955,10 @@ protected:
             {
                 pjsip_inv_send_msg(mInv, packet);
             }
+            else
+            {
+                lg(Warning) << "Unable to create 488 response";
+            }
             return Complete;
         }
 
@@ -2047,6 +2093,7 @@ protected:
         const pjmedia_sdp_session *offer_sdp;
         if (fail(pjmedia_sdp_neg_get_neg_remote(mInv->neg, &offer_sdp)))
         {
+            lg(Warning) << "Unable to negotiate media and create an offer SDP";
             return Complete;
         }
 

commit 6d5ab58d36d69052c2ea7b389ef90d09351b23ff
Author: Mark Michelson <mmichelson at digium.com>
Date:   Wed Jan 4 13:56:59 2012 -0600

    Add warning messages to SIPSession.cpp when PJSIP functions fail.

diff --git a/src/SIPSession.cpp b/src/SIPSession.cpp
index 51b7a7f..bc757ed 100755
--- a/src/SIPSession.cpp
+++ b/src/SIPSession.cpp
@@ -644,6 +644,10 @@ public:
             {
                 pjsip_inv_send_msg(mImplPriv->mInviteSession, packet);
             }
+            else
+            {
+                lg(Warning) << "Unable to create reinvite";
+            }
         }
 
         mCb->ice_response();
@@ -703,8 +707,10 @@ public:
         else
         {
             // If we couldn't create the reinvite no streams were added
-            mCb->ice_response(StreamInformationDict());
+            lg(Warning) << "Unable to create reinvite when adding streams";
         }
+        
+        mCb->ice_response(StreamInformationDict());
 
         return Complete;
     }
@@ -741,6 +747,10 @@ public:
             {
                 pjsip_inv_send_msg(mImplPriv->mInviteSession, packet);
             }
+            else
+            {
+                lg(Warning) << "Unable to create reinvite to remove streams";
+            }
         }
         else
         {
@@ -953,6 +963,10 @@ public:
         {
             pjsip_inv_send_msg(mSession->getInviteSession(), packet);
         }
+        else
+        {
+            lg(Warning) << "Unable to create reinvite to connect streams";
+        }
 
         mCb->ice_response();
 
@@ -983,6 +997,10 @@ public:
         {
             pjsip_inv_send_msg(mSession->getInviteSession(), packet);
         }
+        else
+        {
+            lg(Warning) << "Unable to create reinvite to disconnect streams";
+        }
 
         mCb->ice_response();
 
@@ -1125,6 +1143,7 @@ void SIPSession::initializePJSIPStructs()
                 // We could just roll along and see if the default transport selection in pjsip
                 // hooks us up.
                 //
+                lg(Warning) << "Unable to set transport for INVITE UAC dialog";
             }
         }
     }
@@ -2033,6 +2052,7 @@ public:
         pjsip_tx_data *packet;
         if (fail(pjsip_inv_invite(mImplPriv->mInviteSession, &packet)))
         {
+            lg(Warning) << "Unable to create INVITE for outbound call";
             pjsip_inv_terminate(mImplPriv->mInviteSession, 500, 0);
             pjsip_dlg_terminate(mImplPriv->mInviteSession->dlg);
             // What should we do here? Throw an exception?
@@ -3683,6 +3703,10 @@ pjmedia_sdp_session *SIPSession::createSDPAnswer(const pjmedia_sdp_session* offe
                 {
                     pjsip_inv_send_msg(mImplPriv->mInviteSession, packet);
                 }
+                else
+                {
+                    lg(Warning) << "Unable to create 488 response for INVITE";
+                }
                 return 0;
             }
         }
@@ -3822,6 +3846,10 @@ pjmedia_sdp_session *SIPSession::createSDPAnswer(const pjmedia_sdp_session* offe
                 {
                     pjsip_inv_send_msg(mImplPriv->mInviteSession, packet);
                 }
+                else
+                {
+                    lg(Warning) << "Unable to create 488 response for INVITE";
+                }
                 return 0;
             }
 
@@ -4121,6 +4149,10 @@ void SIPSession::startMedia(const pjmedia_sdp_session*, const pjmedia_sdp_sessio
                 {
                     pjsip_inv_send_msg(mImplPriv->mInviteSession, packet);
                 }
+                else
+                {
+                    lg(Warning) << "Unable to create 488 response for INVITE";
+                }
                 return;
             }
 

commit 75e4696143a153403a7236520fa71dc5de685899
Author: Mark Michelson <mmichelson at digium.com>
Date:   Wed Jan 4 13:42:23 2012 -0600

    Add some warning messages for when PJSIP calls fail.

diff --git a/src/PJSIPRegistrarModule.cpp b/src/PJSIPRegistrarModule.cpp
index a04256b..590c584 100644
--- a/src/PJSIPRegistrarModule.cpp
+++ b/src/PJSIPRegistrarModule.cpp
@@ -730,6 +730,7 @@ bool PJSIPRegistrarModule::checkAuth(pjsip_rx_data *rdata, pjsip_transaction *ts
     pjsip_tx_data *tdata;
     if (fail(pjsip_endpt_create_response(tsx->endpt, rdata, 401, NULL, &tdata)))
     {
+        lg(Warning) << "Unable to create 401 response to challenge REGISTER";
         return false;
     }
     
@@ -737,6 +738,7 @@ bool PJSIPRegistrarModule::checkAuth(pjsip_rx_data *rdata, pjsip_transaction *ts
     
     if (fail(pjsip_tsx_send_msg(tsx, tdata)))
     {
+        lg(Warning) << "Unable to send 401 response to REGISTER";
         return false;
     }
     
@@ -761,6 +763,7 @@ pj_bool_t PJSIPRegistrarModule::on_rx_request(pjsip_rx_data *rdata)
     pjsip_transaction *tsx;
     if (fail(pjsip_tsx_create_uas(&mModule, rdata, &tsx)))
     {
+        lg(Warning) << "Unable to create server transaction for inbound REGISTER";
         return PJ_TRUE;
     }
 
@@ -795,6 +798,10 @@ pj_bool_t PJSIPRegistrarModule::on_rx_request(pjsip_rx_data *rdata)
         {
             pjsip_tsx_send_msg(tsx, tdata);
         }
+        else
+        {
+            lg(Warning) << "Unable to create 400 error response for inbound REGISTER";
+        }
         return PJ_TRUE;
     }
 
@@ -833,15 +840,16 @@ pj_bool_t PJSIPRegistrarModule::on_rx_request(pjsip_rx_data *rdata)
     // We enqueue the SIP response to make sure we send it and replicate state AFTER we have updated
     // our internal bindings.
     pjsip_tx_data *tdata;
-    if (success(pjsip_endpt_create_response(tsx->endpt, rdata, 200, NULL, &tdata)))
+    if (fail(pjsip_endpt_create_response(tsx->endpt, rdata, 200, NULL, &tdata)))
     {
-        mRegistrar->addAndRemoveBindings(aor, newBindings, removedBindings, mRegistrar->getQueue());
-
-        mRegistrar->getQueue()->enqueueWork(new Response(tsx, tdata, aor, mRegistrar));
-
-        replicateState(aor, existingBindings, newBindings, removedBindings);
+        lg(Warning) << "Unable to create final REGISTER response";
+        return PJ_TRUE;
     }
 
+    mRegistrar->addAndRemoveBindings(aor, newBindings, removedBindings, mRegistrar->getQueue());
+    mRegistrar->getQueue()->enqueueWork(new Response(tsx, tdata, aor, mRegistrar));
+    replicateState(aor, existingBindings, newBindings, removedBindings);
+
     return PJ_TRUE;
 }
 

commit 9bbfae7224fea73e708f6cc980f75aa4d0f0c405
Merge: e8d2358 872c1fc
Author: Mark Michelson <mmichelson at digium.com>
Date:   Wed Jan 4 13:20:39 2012 -0600

    Merge branch 'master' into error-handling
    
    Conflicts:
    	src/PJSIPRegistrarModule.cpp
    	src/PJSIPSessionModule.cpp
    	src/SIPClientRegistration.cpp
    	src/SIPSession.cpp
    	src/SIPTransfer.cpp

diff --cc src/PJSIPRegistrarModule.cpp
index 0b4f8ed,3a35e25..a04256b
--- a/src/PJSIPRegistrarModule.cpp
+++ b/src/PJSIPRegistrarModule.cpp
@@@ -19,12 -19,11 +19,12 @@@
  #include <AsteriskSCF/System/WorkQueue/WorkQueueIf.h>
  #include <AsteriskSCF/WorkQueue/WorkQueue.h>
  #include <AsteriskSCF/WorkQueue/DefaultQueueListener.h>
- #include <AsteriskSCF/PJLib/ThreadHook.h>
+ #include <AsteriskSCF/PJLIB/ThreadHook.h>
  
- #include "PJSipRegistrarModule.h"
- #include "PJSipManager.h"
- #include "SipReplicationContext.h"
+ #include "PJSIPRegistrarModule.h"
+ #include "PJSIPManager.h"
+ #include "SIPReplicationContext.h"
 +#include "PJUtil.h"
  
  using namespace AsteriskSCF::SIP::Registration::V1;
  using namespace AsteriskSCF::System::Logging;
diff --cc src/PJSIPSessionModule.cpp
index a111209,fabcaf3..a78310b
--- a/src/PJSIPSessionModule.cpp
+++ b/src/PJSIPSessionModule.cpp
@@@ -14,16 -14,15 +14,16 @@@
   * at the top of the source tree.
   */
  
- #include "PJSipSessionModule.h"
- #include "SipTransfer.h"
- #include "SipEndpoint.h"
- #include "SipEndpointFactory.h"
- #include "SipSession.h"
- #include "PJSipManager.h"
- #include "SipStateReplicator.h"
- #include "SipTelephonyEventSource.h"
- #include "SipReplicationContext.h"
+ #include "PJSIPSessionModule.h"
+ #include "SIPTransfer.h"
+ #include "SIPEndpoint.h"
+ #include "SIPEndpointFactory.h"
+ #include "SIPSession.h"
+ #include "PJSIPManager.h"
+ #include "SIPStateReplicator.h"
+ #include "SIPTelephonyEventSource.h"
+ #include "SIPReplicationContext.h"
 +#include "PJUtil.h"
  
  #include <IceUtil/UUID.h>
  #include <boost/lexical_cast.hpp>
@@@ -351,20 -350,17 +351,20 @@@ bool PJSIPSessionModule::checkAuth(pjsi
      }
  
      pjsip_tx_data *tdata;
 -    pjsip_inv_end_session(inv, 401, NULL, &tdata);
 -
 -    authInstance->addDigests(tdata, digests);
 +    if (success(pjsip_inv_end_session(inv, 401, NULL, &tdata)))
 +    {
 +        authInstance->addDigests(tdata, digests);
  
 -    pjsip_inv_send_msg(inv, tdata);
 +        pjsip_inv_send_msg(inv, tdata);
  
 -    mAuthManager->scheduleAuthTimeout(authInstance, sessionAuthTimeout);
 -    return true;
 +        mAuthManager->scheduleAuthTimeout(authInstance, sessionAuthTimeout);
 +        return true;
 +    }
 +    lg(Warning) << "Failed to create authentication challenge";
 +    return false;
  }
  
- class SessionCreationOperation : public SipQueueableOperation
+ class SessionCreationOperation : public SIPQueueableOperation
  {
  public:
      SessionCreationOperation(
@@@ -803,8 -789,21 +803,8 @@@ ConnectedLinePtr PJSIPSessionModule::ge
      return connected;
  }
  
- void PJSipSessionModule::handleNewInvite(pjsip_rx_data *rdata)
+ void PJSIPSessionModule::handleNewInvite(pjsip_rx_data *rdata)
  {
 -    //What do we do here?
 -    //
 -    //First we need to identify who this is coming from.
 -    //If it's someone we recognize, then we can figure
 -    //out whether we need to send a 401/407 request.
 -    //For now, we don't have any sort of configured users,
 -    //so we skip this step. Instead, we'll skip ahead to
 -    //creating an endpoint, creating the invite session,
 -    //sending a 100 trying, finding the remote endpoint
 -    //to call, and placing a call to it.
 -
 -    //XXX Put caller identification code in here!
 -
      //We handle most of the processing here synchronously since
      //at this point there is no associated session, plus the lead-up
      //to creating a session is not especially intensive.
@@@ -848,11 -851,13 +848,11 @@@
      }
  
      pjsip_transaction *tsx = pjsip_rdata_get_tsx(rdata);
-     PJSipTransactionModInfo *tsx_mod_info = new PJSipTransactionModInfo(tsx);
+     PJSIPTransactionModInfo *tsx_mod_info = new PJSIPTransactionModInfo(tsx);
      tsx->mod_data[mModule.id] = (void *)tsx_mod_info;
  
 -    //XXX The sdp argument is NULL for now, but can be changed if we
 -    //know what has been configured for this particular caller.
      pjsip_inv_session *inv_session;
 -    if (pjsip_inv_create_uas(dlg, rdata, NULL, 0, &inv_session) != PJ_SUCCESS)
 +    if (fail(pjsip_inv_create_uas(dlg, rdata, NULL, 0, &inv_session)))
      {
          lg(Warning) << "Unable to create INVITE session";
          //Since the inv_session was not created, we need to access the base dialog
@@@ -862,13 -867,9 +862,13 @@@
      }
  
      // Add our own module as a dialog usage
 -    pjsip_dlg_add_usage(dlg, &mModule, NULL);
 +    if (fail(pjsip_dlg_add_usage(dlg, &mModule, NULL)))
 +    {
 +        lg(Warning) << "Unable to establish dialog usage";
 +        pjsip_inv_terminate(inv_session, 500, PJ_FALSE);
 +    }
      
-     PJSipDialogModInfo *dlg_mod_info(new PJSipDialogModInfo(dlg));
+     PJSIPDialogModInfo *dlg_mod_info(new PJSIPDialogModInfo(dlg));
      dlg->mod_data[mModule.id] = (void *)dlg_mod_info;
  
      pjsip_timer_setting session_timer_settings;
@@@ -918,13 -923,11 +918,13 @@@
      if (caller == 0)
      {
          lg(Warning) << "Unknown calling endpoint " << callerName;
 -        pjsip_inv_end_session(inv_session, 403, NULL, &tdata);
 -        pjsip_inv_send_msg(inv_session, tdata);
 +        if (success(pjsip_inv_end_session(inv_session, 403, NULL, &tdata)))
 +        {
 +            pjsip_inv_send_msg(inv_session, tdata);
 +        }
          return;
      }
-     SipEndpointConfig &config = caller->getConfig();
+     SIPEndpointConfig &config = caller->getConfig();
      if (config.sessionConfig.callDirection != BOTH && config.sessionConfig.callDirection != INBOUND)
      {
          lg(Warning) << "Caller " << callerName << " does not have permission to make inbound calls.";
@@@ -1487,10 -1489,7 +1487,10 @@@ void PJSIPSessionModule::handleInviteRe
  
  //There are some rejection codes that we can actually do something with other than
  //just kill the code.
 +//
 +//Codes that may not possibly result in retrying the call should not be handled in this
 +//function.
- void PJSipSessionModule::handleInviteRejection(pjsip_inv_session* inv,
+ void PJSIPSessionModule::handleInviteRejection(pjsip_inv_session* inv,
      pjsip_rx_data* rdata, pjsip_transaction* tsx)
  {
      int respCode = rdata->msg_info.msg->line.status.code;
@@@ -1602,81 -1599,22 +1602,81 @@@ protected
              {
                  return Complete;
              }
-             SipSessionPtr session = session_mod_info->getSessionPtr();
+             SIPSessionPtr session = session_mod_info->getSessionPtr();
              AsteriskSCF::SessionCommunications::V1::ResponseCodePtr response =
                  new AsteriskSCF::SessionCommunications::V1::ResponseCode();
 -            if (mInv->cause == 486)
 +
 +            //Cause codes for each SIP response are taken from RFC 3398 Section 8.2.6.1 (plus errata ID 2161)
 +            switch (mInv->cause)
              {
 +            case 404: // Not Found
 +            case 485: // Ambiguous
 +            case 604: // Does Not Exist Anymore
 +                response->isdnCode = 1;
 +                break;
 +            case 486: // Busy Here
 +            case 600: // Busy Everywhere
                  response->isdnCode = 17;
 -            }
 -            else if (PJSIP_IS_STATUS_IN_CLASS(mInv->cause, 500))
 -            {
 -                response->isdnCode = 34;
 -            }
 -            else
 -            {
 -                // TODO: See what cause is on a normal call completion
 +                break;
 +            case 480: // Temporarily Unavailable
 +                response->isdnCode = 18;
 +                break;
 +            case 401: // Unauthorized
 +            case 402: // Payment Required
 +            case 403: // Forbidden
 +            case 407: // Proxy Authentication Required
 +            case 603: // Decline
 +                response->isdnCode = 21;
 +                break;
 +            case 410: // Gone
 +                response->isdnCode = 22;
 +                break;
 +            case 482: // Loop Detected
 +            case 483: // Too Many Hops
 +                response->isdnCode = 25;
 +                break;
 +            case 484: // Address Incomplete
 +                response->isdnCode = 28;
 +                break;
 +            case 502: // Bad Gateway
 +                response->isdnCode = 38;
 +                break;
 +            case 400: // Bad Request
 +            case 481: // Call/Transaction Does Not Exist
 +            case 500: // Server Internal Error
 +            case 503: // Service Unavailable
 +                response->isdnCode = 41;
 +                break;
 +            case 405: // Method not allowed
 +                response->isdnCode = 63;
 +                break;
 +            case 406: // Not Acceptable
 +            case 415: // Unsupported Media Type
 +            case 501: // Not Implemented
 +                response->isdnCode = 79;
 +                break;
 +            case 408: // Request Timeout
 +            case 504: // Server Time-out
 +                response->isdnCode = 102;
 +                break;
 +            case 413: // Request Entity Too Long
 +            case 414: // Request-URI Too Long
 +            case 416: // Unsupported URI Scheme
 +            case 420: // Bad Extension
 +            case 421: // Extension Required
 +            case 423: // Interval Too Brief
 +            case 505: // Version Not Supported
 +            case 513: // Message Too Large
 +                response->isdnCode = 127;
 +                break;
 +            default:
 +                // 487, 488, and 606 have no mapping. Also,
 +                // other types of ends to sessions (like normal clearing)
 +                // will end up here.
                  response->isdnCode = 0;
 +                break;
              }
 +
              if (session)
              {
                  std::vector<AsteriskSCF::SessionCommunications::V1::SessionListenerPrx> listeners = session->getListeners();
@@@ -1906,18 -1842,18 +1906,18 @@@ protected
      {
          const pjmedia_sdp_session *remote_sdp;
          pj_status_t status;
 -        if ((status = pjmedia_sdp_neg_get_active_remote(mInv->neg, &remote_sdp)) != PJ_SUCCESS)
 +        if (fail(pjmedia_sdp_neg_get_active_remote(mInv->neg, &remote_sdp)))
          {
 -	    pjsip_tx_data *packet;
 -	    if (pjsip_inv_end_session(mInv, 488, NULL, &packet) == PJ_SUCCESS)
 -	    {
 -		pjsip_inv_send_msg(mInv, packet);
 -	    }
 -	    return Complete;
 +            pjsip_tx_data *packet;
 +            if (success(pjsip_inv_end_session(mInv, 488, NULL, &packet)))
 +            {
 +                pjsip_inv_send_msg(mInv, packet);
 +            }
 +            return Complete;
          }
  
-         PJSipSessionModInfo *session_mod_info = (PJSipSessionModInfo*)mInv->mod_data[mModuleId];
-         SipSessionPtr session = session_mod_info->getSessionPtr();
+         PJSIPSessionModInfo *session_mod_info = (PJSIPSessionModInfo*)mInv->mod_data[mModuleId];
+         SIPSessionPtr session = session_mod_info->getSessionPtr();
  
          StreamInformationDict added;
          session->createSDPAnswer(remote_sdp, added);
diff --cc src/SIPClientRegistration.cpp
index 25e2bed,aa51dba..c496f4d
--- a/src/SIPClientRegistration.cpp
+++ b/src/SIPClientRegistration.cpp
@@@ -14,8 -14,7 +14,8 @@@
   * at the top of the source tree.
   */
  
- #include "SipClientRegistration.h"
+ #include "SIPClientRegistration.h"
 +#include "PJUtil.h"
  #include <boost/numeric/conversion/cast.hpp>
  
  using namespace AsteriskSCF::System::Logging;
@@@ -153,16 -152,12 +153,16 @@@ void SIPRegistrationClient::activate(
      mReplica->addListener(mReplicaListenerProxy);
  }
  
- void SipRegistrationClient::createPJSIPRegistration(
-         const SipClientRegistrationItemPtr& confItem,
+ void SIPRegistrationClient::createPJSIPRegistration(
+         const SIPClientRegistrationItemPtr& confItem,
          pjsip_endpoint *pjEndpoint,
-         const SipEndpointPtr& sipEndpoint)
+         const SIPEndpointPtr& sipEndpoint)
  {
 -    pjsip_regc_create(pjEndpoint, this, regCallback, &mReg);
 +    if (fail(pjsip_regc_create(pjEndpoint, this, regCallback, &mReg)))
 +    {
 +        lg(Warning) << "Unable to create client registration for endpoint " << sipEndpoint->getName();
 +        return;
 +    }
  
      std::vector<pj_str_t> pjContacts;
      std::transform(confItem->contacts.begin(), confItem->contacts.end(), std::back_inserter(pjContacts), MakeContact(mReg));
@@@ -206,13 -198,11 +206,13 @@@ void SIPRegistrationClient::destroy(
      destroyPJSIPRegistration();
  }
  
- void SipRegistrationClient::destroyPJSIPRegistration()
+ void SIPRegistrationClient::destroyPJSIPRegistration()
  {
      pjsip_tx_data *tdata;
 -    pjsip_regc_unregister(mReg, &tdata);
 -    pjsip_regc_send(mReg, tdata);
 +    if (success(pjsip_regc_unregister(mReg, &tdata)))
 +    {
 +        pjsip_regc_send(mReg, tdata);
 +    }
  
      pjsip_regc_destroy(mReg);
  }
@@@ -270,23 -260,14 +270,23 @@@ void SIPRegistrationClient::sendRegiste
      std::vector<pj_str_t> contacts;
      std::transform(mContacts.begin(), mContacts.end(), std::back_inserter(contacts), MakeContact(mReg));
  
 -    pjsip_regc_update_contact(mReg, boost::numeric_cast<int>(contacts.size()), &contacts.front());
 +    if (fail(pjsip_regc_update_contact(mReg, boost::numeric_cast<int>(contacts.size()), &contacts.front())))
 +    {
 +        lg(Warning) << "Unable to update contacts for client registration for endpoint " << mEndpointName;
 +    }
  
      pjsip_tx_data *tdata;
 -    pjsip_regc_register(mReg, PJ_TRUE, &tdata);
 -    pjsip_regc_send(mReg, tdata);
 +    if (success(pjsip_regc_register(mReg, PJ_TRUE, &tdata)))
 +    {
 +        pjsip_regc_send(mReg, tdata);
 +    }
 +    else
 +    {
 +        lg(Warning) << "Unable to create outbound REGISTER request for endpoint " << mEndpointName;
 +    }
  }
  
- void SipRegistrationClient::handleRegisterResponse(pjsip_regc_cbparam *param)
+ void SIPRegistrationClient::handleRegisterResponse(pjsip_regc_cbparam *param)
  {
      switch (param->code)
      {
@@@ -326,7 -307,11 +326,7 @@@
      }
  }
  
- void SipRegistrationClient::authenticate(pjsip_rx_data *rdata)
 -//XXX This function seems like it may fit better into AuthManager
 -//or some more central place since it could be useful for authentication
 -//responses for any type of request. This is mostly not REGISTER-specific, in
 -//other words.
+ void SIPRegistrationClient::authenticate(pjsip_rx_data *rdata)
  {
      std::vector<pjsip_cred_info> creds;
      mManager->getAuthCredentials(rdata, creds, mEndpointName);
diff --cc src/SIPSession.cpp
index 01d4426,d8a1f73..51b7a7f
--- a/src/SIPSession.cpp
+++ b/src/SIPSession.cpp
@@@ -14,13 -14,12 +14,13 @@@
   * at the top of the source tree.
   */
  
- #include "PJSipManager.h"
- #include "SipEndpointFactory.h"
- #include "SipEndpoint.h"
- #include "SipSession.h"
- #include "SipTelephonyEventSource.h"
- #include "SipTelephonyEventSink.h"
+ #include "PJSIPManager.h"
+ #include "SIPEndpointFactory.h"
+ #include "SIPEndpoint.h"
+ #include "SIPSession.h"
+ #include "SIPTelephonyEventSource.h"
+ #include "SIPTelephonyEventSink.h"
 +#include "PJUtil.h"
  
  #include <Ice/Ice.h>
  #include <IceUtil/UUID.h>
diff --cc src/SIPTransfer.cpp
index 9ff5140,494b0b7..3f4a110
--- a/src/SIPTransfer.cpp
+++ b/src/SIPTransfer.cpp
@@@ -14,8 -14,7 +14,8 @@@
   * at the top of the source tree.
   */
  
- #include "SipTransfer.h"
+ #include "SIPTransfer.h"
 +#include "PJUtil.h"
  
  #include <boost/algorithm/string.hpp>
  #include <IceUtil/UUID.h>
@@@ -532,13 -516,10 +532,13 @@@ SuspendableWorkResult HandleReferOperat
              
              //Go ahead and send the 100 Trying sipfrag
              pjsip_tx_data *tdata = createNotify(mInv->dlg, mReferCSeq, true);
 -            addNotifyBody(tdata, "SIP/2.0 100 Trying");
 -            pjsip_dlg_send_request(mInv->dlg, tdata, -1, NULL);
 +            if (tdata)
 +            {
 +                addNotifyBody(tdata, "SIP/2.0 100 Trying");
 +                pjsip_dlg_send_request(mInv->dlg, tdata, -1, NULL);
 +            }
  
-             mSessionRouter->begin_connectBridgedSessionsWithDestination(operationId, session->getSessionProxy(), mTarget, false, mHook->getProxy(), d);
+             mSessionRouter->begin_connectBridgedSessionsWithDestination(operationId, session->getSessionProxy(), mTarget, true, mHook->getProxy(), d);
              return Complete;
          }
          catch (const Ice::CommunicatorDestroyedException &)

commit 872c1fcf062ceb5d0e46383b3ee9da4a65545e58
Author: Joshua Colp <jcolp at digium.com>
Date:   Tue Jan 3 12:41:43 2012 -0400

    We want to *replace* the session when doing transfers.

diff --git a/src/SIPTransfer.cpp b/src/SIPTransfer.cpp
index bd114db..494b0b7 100644
--- a/src/SIPTransfer.cpp
+++ b/src/SIPTransfer.cpp
@@ -480,7 +480,7 @@ SuspendableWorkResult HandleReferOperation::initial(const SuspendableWorkListene
 
             lg(Debug) << "handleRefer() calling router connectBridgedSessions(). ";
 
-            mSessionRouter->begin_connectBridgedSessions(operationId, mSession->getSessionProxy(), other_session->getSessionProxy(), false, d);
+            mSessionRouter->begin_connectBridgedSessions(operationId, mSession->getSessionProxy(), other_session->getSessionProxy(), true, d);
             pjsip_dlg_dec_lock(other_dlg);
             return Complete;
         }
@@ -519,7 +519,7 @@ SuspendableWorkResult HandleReferOperation::initial(const SuspendableWorkListene
             addNotifyBody(tdata, "SIP/2.0 100 Trying");
             pjsip_dlg_send_request(mInv->dlg, tdata, -1, NULL);
 
-            mSessionRouter->begin_connectBridgedSessionsWithDestination(operationId, session->getSessionProxy(), mTarget, false, mHook->getProxy(), d);
+            mSessionRouter->begin_connectBridgedSessionsWithDestination(operationId, session->getSessionProxy(), mTarget, true, mHook->getProxy(), d);
             return Complete;
         }
         catch (const Ice::CommunicatorDestroyedException &)

commit 6cea9d54eac34ea83f032d7da76ad114b7867e1c
Author: Joshua Colp <jcolp at digium.com>
Date:   Tue Jan 3 12:41:37 2012 -0400

    Remove old test code.

diff --git a/src/SIPSession.cpp b/src/SIPSession.cpp
index a6e1871..d8a1f73 100755
--- a/src/SIPSession.cpp
+++ b/src/SIPSession.cpp
@@ -1866,10 +1866,6 @@ public:
                 mImplPriv->mSessionController = 0;
             }
 
-            // Update the connected controller's ConnectedLine information.  
-            SessionOwnerIdPtr test;
-            mImplPriv->mSessionCookies.erase(test->ice_id());
-
             mCb->ice_response();
             return Complete;
         }

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


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list