Author: derek Date: Tue Jul 31 22:19:10 2007 New Revision: 382 Modified: sofaswitch/trunk/voip/comms.cxx sofaswitch/trunk/voip/jocall.cxx sofaswitch/trunk/voip/jocall.h sofaswitch/trunk/voip/mymanager.cxx sofaswitch/trunk/voip/mymanager.h Log: Change the manner in which we accept/reject calls. This change brings us into line with the opal Library standard. Modified: sofaswitch/trunk/voip/comms.cxx ============================================================================== --- sofaswitch/trunk/voip/comms.cxx (original) +++ sofaswitch/trunk/voip/comms.cxx Tue Jul 31 22:19:10 2007 @@ -204,12 +204,6 @@ PTRACE(0, "The command \"" << cmds[1] << "\" was not understood -- sorry"); doAnswer = FALSE; } - if(!doAnswer) { - PTRACE(3, "Reject this call"); - PWaitAndSignal m(opalCallLock); - myOpalCall->Clear(); - return; - } PString thisToken; { @@ -217,6 +211,16 @@ if (myOpalCall != NULL) thisToken = myOpalCall->GetToken(); } + + if(!doAnswer) { + PTRACE(3, "Reject this call"); + manager.AcceptThisCall(thisToken, FALSE); + PWaitAndSignal m(opalCallLock); + if (myOpalCall != NULL) + myOpalCall->Clear(); + return; + } + PTRACE(3, "Accept this call on OpalCall token " << thisToken); manager.AcceptThisCall(thisToken); } Modified: sofaswitch/trunk/voip/jocall.cxx ============================================================================== --- sofaswitch/trunk/voip/jocall.cxx (original) +++ sofaswitch/trunk/voip/jocall.cxx Tue Jul 31 22:19:10 2007 @@ -185,15 +185,18 @@ manager.GetControllerId()); } -void MyOpalCall::AcceptThisCall() +void MyOpalCall::AcceptThisCall(BOOL doAccept) { PTRACE(3, "Process request to accept this call"); for (PSafePtr<OpalConnection> conn(connectionsActive, PSafeReadOnly); conn != NULL; ++conn) { PSafePtr<OpalUdpSsConnection> connection; connection = PSafePtrCast<OpalConnection, OpalUdpSsConnection>(conn); - if (connection != NULL) { - connection->AcceptIncoming(); - PTRACE(3, "Finished Answering the call for " << connection->GetToken()); + if (connection == NULL) { + if (doAccept) + conn->AnsweringCall(OpalConnection::AnswerCallNow); + else + conn->AnsweringCall(OpalConnection::AnswerCallDenied); + PTRACE(3, "Finished Answering the call for " << conn->GetToken()); } } } Modified: sofaswitch/trunk/voip/jocall.h ============================================================================== --- sofaswitch/trunk/voip/jocall.h (original) +++ sofaswitch/trunk/voip/jocall.h Tue Jul 31 22:19:10 2007 @@ -112,16 +112,17 @@ void SendThisDtmf(const PString & userInput ///DTMF to send ); - /**Make the OpalConnections in this call accept this incoming + /**Make the OpalConnections in this call accept/reject this incoming call. This will move the status of the incoming call to - connecting. + connecting/releasing */ - void AcceptThisCall(); + void AcceptThisCall(BOOL doAccept ///<True to indicate we accept the call. + ); /**Send a request to the remote controller, asking them if we can answer this incoming voip call */ void IncomingCall(const PString & remoteNode ///person calling us - ); + ); /**Close this id off */ void CloseThisId(); Modified: sofaswitch/trunk/voip/mymanager.cxx ============================================================================== --- sofaswitch/trunk/voip/mymanager.cxx (original) +++ sofaswitch/trunk/voip/mymanager.cxx Tue Jul 31 22:19:10 2007 @@ -437,7 +437,7 @@ } -void MyManager::AcceptThisCall(const PString & uniqueCallId) +void MyManager::AcceptThisCall(const PString & uniqueCallId, BOOL doAccept) { PTRACE(3, "Accept this call if we can find it " << uniqueCallId); OpalCall *oCall = FindCallWithLock(uniqueCallId); @@ -448,8 +448,8 @@ MyOpalCall *call; call = PSafePtrCast<OpalCall, MyOpalCall>(oCall); - PTRACE(3, "Accept this call as we have found it " << uniqueCallId); - call->AcceptThisCall(); + PTRACE(3, "Accept/Reject this call as we have found it " << uniqueCallId); + call->AcceptThisCall(doAccept); } PString MyManager::GetStatusInfo(const PString & token) Modified: sofaswitch/trunk/voip/mymanager.h ============================================================================== --- sofaswitch/trunk/voip/mymanager.h (original) +++ sofaswitch/trunk/voip/mymanager.h Tue Jul 31 22:19:10 2007 @@ -173,8 +173,11 @@ /**Get information (in a textual form) of how long this call has been up */ PString GetDurationInfo(const PString & token); - /**Advise the manager to accept this call, which has a particular callId */ - void AcceptThisCall(const PString & uniqueCallId); + /**Advise the manager to accept/reject this call, which has a particular callId. + The default action is to accept this call. + + If the doAccept arguement is false, the call is rejected.*/ + void AcceptThisCall(const PString & uniqueCallId, BOOL doAccept = TRUE); /**Advise the manager to reject this call, which has a particular callId */ void RejectThisCall(const PString & uniqueCallId);
participants (1)
-
SofaSWITCH SVN