Author: derek Date: Thu Aug 23 01:22:58 2007 New Revision: 394 Modified: sofaswitch/trunk/callflow/tests/makevoipcall.src sofaswitch/trunk/sofa/include/sofa/messages.h sofaswitch/trunk/sofa/src/messages.cxx sofaswitch/trunk/voip/comms.cxx sofaswitch/trunk/voip/comms.h sofaswitch/trunk/voip/jocall.cxx sofaswitch/trunk/voip/mymanager.cxx sofaswitch/trunk/voip/udpconnection.cxx Log: *Tweaks to make it more easier to use - and match the OPAL call progress phases. More work is requried here. *Modify logging levels. Modified: sofaswitch/trunk/callflow/tests/makevoipcall.src ============================================================================== --- sofaswitch/trunk/callflow/tests/makevoipcall.src (original) +++ sofaswitch/trunk/callflow/tests/makevoipcall.src Thu Aug 23 01:22:58 2007 @@ -1,3 +1,3 @@ -11<B>156<B>121<B> extra <special>Tool Tip<ms>Request Node<ms><special>Request node from (Python code)<ms>"sound"<ms><special>Timer period (seconds)<ms>1<ms><special>Info to send to remote node (Python code)<ms><ms><special>Python variable: generated data<ms>self.soundNode<ms><special> <B><Shape>19<B>168<B>499<B> extra <special>Tool Tip<ms>Send Dtmf to the voip node<ms><special>Worker node to activate (python code)<ms>self.voipNode<ms><special>DTMF to send to worker node (python code)<ms>self.dtmfData<ms><special> <B><Shape>5<B>141<B>281<B> extra <special>Tool Tip<ms>TEST: have a sound and voip node.<ms><special>Test (Python code)<ms>(self.voipNode != None) and (self.soundNode != None)<ms><special> <B><Shape>9<B>166<B>171<B>166,171,166,281<special>Tool Tip<ms>Join blocks shape<ms><special> <B><Shape>2<B>291<B>710<B> extra <special>Tool Tip<ms>Suspend Processing<ms><special> <B><Shape>9<B>120<B>198<B>120,198,120,253,359,253<special>Tool Tip<ms>Join blocks shape<ms><special> <B><Shape>9<B>166<B>479<B>166,479<special>Tool Tip<ms>Join blocks shape<ms><special> <B><Shape>9<B>165<B>522<B>165,522,165,598,251,601<special>Tool Tip<ms>Join blocks shape<ms><special> <B><Shape>9<B>188<B>214<B>188,214,188,251,359,252<special>Tool Tip<ms>Join blocks shape<ms><special> <B><Shape>9<B>139<B>116<B>139,116,181,121<special>Tool Tip<ms>Join blocks shape<ms><special> <B><Shape>7<B>225<B>646<B> extra <special>Tool Tip<ms>End Call<ms><special>Worker node to activate (python code)<ms>self.voipNode<ms><special> <B><Shape>9<B>191<B>306<B>191,306,237,307<special>Tool Tip<ms>Join blocks shape<ms><special> <B><Shape>15<B>226<B>601<B> extra <special>Tool Tip<ms>Make sound node -talk to noone<ms><special>First SofaSwitch worker (python)<ms>"sound"<ms><special>Second SofaSwitch worker (python)<ms>"noone"<ms><special> <B><Shape>7<B>95<B>148<B> extra <special>Tool Tip<ms>End Call<ms><special>Worker node for termination (Python code)<ms>self.soundNode<ms><special> <B><Shape>9<B>271<B>711<B>271,711,316,711<special>Tool Tip<ms>Join blocks shape<ms><special> <B><Shape>6<B>141<B>330<B> extra <special>Tool Tip<ms>Make Call to a remote entity<ms><special>Worker node to activate (python code)<ms>self.voipNode<ms><special>Call destination (python code)<ms>self.scriptArgs<ms><special> <B><Shape>14<B>235<B>452<B> extra <special>Tool Tip<ms>Wait for voip call to end<ms><special>Event sought (Python code)<ms><ms><special>Event sought (Regular Exp)<ms>Terminating<ms><special>Python variable: source of the event<ms>self.eventSource<ms><special>Python variable: name of the event<ms>self.eventName<ms><special>Python variable: generated data<ms>self.eventData<ms><special> <B><Shape>9<B>248<B>502<B>248,502,251,601<special>Tool Tip<ms>Join blocks shape<ms><special> <B><Shape>2<B>360<B>272<B> extra <special>Tool Tip<ms>Suspend Processing<ms><special> <B><Shape>9<B>206<B>141<B>206,141,272,141<special>Tool Tip<ms>Join blocks shape<ms><special> <B><Shape>5<B>140<B>472<B> extra <special>Tool Tip<ms>Test for dtmf data of "9"<ms><special>Test (Python code)<ms>self.dtmfData=="9"<ms><special> <B><Shape>11<B>89<B>96<B> extra <special>Tool Tip<ms>Request Node<ms><special>Request node from (Python code)<ms>"voip"<ms><special>Timer period (seconds)<ms>1<ms><special>Info to send to remote node (Python code)<ms><ms><special>Python variable: generated data<ms>self.voipNode<ms><special> <B><Shape>12<B>224<B>689<B> extra <special>Tool Tip<ms>Timer which initates a shutdown, after some tidyup - messages etc have been sent.<ms><special>Timer period (seconds, Python code)<ms>1<ms><special>Timer label (Python code)<ms>"endeverything"<ms><special> <B><Shape>15<B>141<B>381<B> extra <special>Tool Tip<ms>Transfer Media between the voip and sound node<ms><special>First SofaSwitch worker (python)<ms>self.voipNode<ms><special>Second SofaSwitch worker (python)<ms>self.soundNode<ms><special> <B><Shape>2<B>211<B>306<B> extra <special>Tool Tip<ms>Suspend Processing<ms><special> <B><Shape>12<B>334<B>253<B> extra <special>Tool Tip<ms>Timer<ms><special>Timer period (seconds, Python code)<ms>0.2<ms><special>Timer label (Python code)<ms>"expire timer"<ms><special> <B><Shape>14<B>153<B>429<B> extra <special>Tool Tip<ms>Wait for DTMF data<ms><special>Event sought (Python code)<ms><ms><special>Event sought (Regular Exp)<ms>DTMF<ms><special>Python variable: source of the event<ms>self.eventSource<ms><special>Python variable: name of the event<ms>self.eventName<ms><special>Python variable: generated data<ms>self.dtmfData<ms><special> <B><Shape>20<B>229<B>740<B> extra <special>Tool Tip<ms>Death<ms><special> <B><Shape>2<B>169<B>538<B> extra <special>Tool Tip<ms>Suspend Processing<ms><special> <B><Shape>1<B>89<B>43<B> extra <special>Tool Tip<ms>Start Processing<ms><special> <B><Shape>2<B>258<B>468<B> extra <special>Tool Tip<ms>Suspend Processing<ms><special> <B><Shape>9<B>99<B>146<B>99,146,101,269,166,281<special>Tool Tip<ms>Join blocks shape<ms><special> <B><Shape>7<B>163<B>164<B> extra <special>Tool Tip<ms>End Call<ms><special>Worker node for termination (Python code)<ms>self.voipNode<ms><special> <B><Shape>2<B>244<B>139<B> extra <special>Tool Tip<ms>Suspend Processing<ms><special> <B><Shape>9<B>203<B>451<B>203,451,248,452<special>Tool Tip<ms>Join blocks shape<ms><special> <B><Shape>20<B>336<B>305<B> extra <special>Tool Tip<ms>Death<ms><special> <B><Shape> +9<B>120<B>198<B>120,198,120,253,359,253<special>Tool Tip<ms>Join blocks shape<ms><special> <B><Shape>7<B>225<B>646<B> extra <special>Tool Tip<ms>End Call<ms><special>Worker node to activate (python code)<ms>self.voipNode<ms><special> <B><Shape>7<B>163<B>164<B> extra <special>Tool Tip<ms>End Call<ms><special>Worker node for termination (Python code)<ms>self.voipNode<ms><special> <B><Shape>12<B>224<B>689<B> extra <special>Tool Tip<ms>Timer which initates a shutdown, after some tidyup + messages etc have been sent.<ms><special>Timer period (seconds, Python code)<ms>1<ms><special>Timer label (Python code)<ms>"endeverything"<ms><special> <B><Shape>9<B>191<B>306<B>191,306,237,307<special>Tool Tip<ms>Join blocks shape<ms><special> <B><Shape>15<B>141<B>381<B> extra <special>Tool Tip<ms>Transfer Media between the voip and sound node<ms><special>First SofaSwitch worker (python)<ms>self.voipNode<ms><special>Second SofaSwitch worker (python)<ms>self.soundNode<ms><special> <B><Shape>14<B>153<B>429<B> extra <special>Tool Tip<ms>Wait for DTMF data<ms><special>Event sought (Python code)<ms><ms><special>Event sought (Regular Exp)<ms>DTMF<ms><special>Python variable: source of the event<ms>self.eventSource<ms><special>Python variable: name of the event<ms>self.eventName<ms><special>Python variable: generated data<ms>self.dtmfData<ms><special> <B><Shape>9<B>206<B>141<B>206,141,272,141<special>Tool Tip<ms>Join blocks shape<ms><special> <B><Shape>15<B>226<B>601<B> extra <special>Tool Tip<ms>Make sound node +talk to itself.<ms><special>First SofaSwitch worker (python)<ms>"sound"<ms><special>Second SofaSwitch worker (python)<ms>"sound"<ms><special> <B><Shape>9<B>188<B>214<B>188,214,188,251,359,252<special>Tool Tip<ms>Join blocks shape<ms><special> <B><Shape>2<B>244<B>139<B> extra <special>Tool Tip<ms>Suspend Processing<ms><special> <B><Shape>7<B>95<B>148<B> extra <special>Tool Tip<ms>End Call<ms><special>Worker node for termination (Python code)<ms>self.soundNode<ms><special> <B><Shape>11<B>89<B>96<B> extra <special>Tool Tip<ms>Request Node<ms><special>Request node from (Python code)<ms>"voip"<ms><special>Timer period (seconds)<ms>1<ms><special>Info to send to remote node (Python code)<ms><ms><special>Python variable: generated data<ms>self.voipNode<ms><special> <B><Shape>2<B>258<B>468<B> extra <special>Tool Tip<ms>Suspend Processing<ms><special> <B><Shape>9<B>271<B>711<B>271,711,316,711<special>Tool Tip<ms>Join blocks shape<ms><special> <B><Shape>12<B>334<B>253<B> extra <special>Tool Tip<ms>Timer<ms><special>Timer period (seconds, Python code)<ms>0.2<ms><special>Timer label (Python code)<ms>"expire timer"<ms><special> <B><Shape>9<B>99<B>146<B>99,146,101,269,166,281<special>Tool Tip<ms>Join blocks shape<ms><special> <B><Shape>9<B>203<B>451<B>203,451,248,452<special>Tool Tip<ms>Join blocks shape<ms><special> <B><Shape>2<B>211<B>306<B> extra <special>Tool Tip<ms>Suspend Processing<ms><special> <B><Shape>9<B>248<B>502<B>248,502,251,601<special>Tool Tip<ms>Join blocks shape<ms><special> <B><Shape>2<B>360<B>272<B> extra <special>Tool Tip<ms>Suspend Processing<ms><special> <B><Shape>9<B>165<B>522<B>165,522,165,598,251,601<special>Tool Tip<ms>Join blocks shape<ms><special> <B><Shape>9<B>166<B>171<B>166,171,166,281<special>Tool Tip<ms>Join blocks shape<ms><special> <B><Shape>20<B>229<B>740<B> extra <special>Tool Tip<ms>Death<ms><special> <B><Shape>14<B>235<B>452<B> extra <special>Tool Tip<ms>Wait for voip call to end<ms><special>Event sought (Python code)<ms><ms><special>Event sought (Regular Exp)<ms>Terminating<ms><special>Python variable: source of the event<ms>self.eventSource<ms><special>Python variable: name of the event<ms>self.eventName<ms><special>Python variable: generated data<ms>self.eventData<ms><special> <B><Shape>5<B>141<B>281<B> extra <special>Tool Tip<ms>TEST: have a sound and voip node.<ms><special>Test (Python code)<ms>(self.voipNode != None) and (self.soundNode != None)<ms><special> <B><Shape>20<B>336<B>305<B> extra <special>Tool Tip<ms>Death<ms><special> <B><Shape>2<B>169<B>538<B> extra <special>Tool Tip<ms>Suspend Processing<ms><special> <B><Shape>1<B>89<B>43<B> extra <special>Tool Tip<ms>Start Processing<ms><special> <B><Shape>9<B>139<B>116<B>139,116,181,121<special>Tool Tip<ms>Join blocks shape<ms><special> <B><Shape>9<B>166<B>479<B>166,479<special>Tool Tip<ms>Join blocks shape<ms><special> <B><Shape>2<B>291<B>710<B> extra <special>Tool Tip<ms>Suspend Processing<ms><special> <B><Shape>5<B>140<B>472<B> extra <special>Tool Tip<ms>Test for dtmf data of "9"<ms><special>Test (Python code)<ms>self.dtmfData=="9"<ms><special> <B><Shape>19<B>168<B>499<B> extra <special>Tool Tip<ms>Send Dtmf to the voip node<ms><special>Worker node to activate (python code)<ms>self.voipNode<ms><special>DTMF to send to worker node (python code)<ms>self.dtmfData<ms><special> <B><Shape>6<B>141<B>330<B> extra <special>Tool Tip<ms>Make Call to a remote entity<ms><special>Worker node to activate (python code)<ms>self.voipNode<ms><special>Call destination (python code)<ms>self.scriptArgs<ms><special> <B><Shape>11<B>156<B>121<B> extra <special>Tool Tip<ms>Request Node<ms><special>Request node from (Python code)<ms>"sound"<ms><special>Timer period (seconds)<ms>1<ms><special>Info to send to remote node (Python code)<ms><ms><special>Python variable: generated data<ms>self.soundNode<ms><special> <B><Shape> Modified: sofaswitch/trunk/sofa/include/sofa/messages.h ============================================================================== --- sofaswitch/trunk/sofa/include/sofa/messages.h (original) +++ sofaswitch/trunk/sofa/include/sofa/messages.h Thu Aug 23 01:22:58 2007 @@ -197,7 +197,11 @@ 2) transferUdp messageid addr:port sent in response to 1) 3) transferUdp messageid addr:port done sent in response to 2) - An application would not normally override this method.*/ + An entity which handles call setup/teardown would not normally override + this method. + + Although, a supervisor, which watchs lots of calls, will override this + and treat it as an error on receiving this comand.*/ virtual void ProcessTransferUdp(PStringArray &cmds, PString & sender); /**we have received a command advising us that we are to end now */ Modified: sofaswitch/trunk/sofa/src/messages.cxx ============================================================================== --- sofaswitch/trunk/sofa/src/messages.cxx (original) +++ sofaswitch/trunk/sofa/src/messages.cxx Thu Aug 23 01:22:58 2007 @@ -46,7 +46,7 @@ ourPassword = _ourPassword; ourBaseId = _ourId; buildCount = 0; - PTRACE(3, "BASEId is " << ourBaseId); + PTRACE(5, "BASEId is " << ourBaseId); PINDEX slash = ourBaseId.Find('/'); if (slash != P_MAX_INDEX) { @@ -54,7 +54,7 @@ remoteServer = ourBaseId.Left(slash); } else ourNodeId = ourBaseId; - PTRACE(3, "NODEId is " << ourNodeId); + PTRACE(5, "NODEId is " << ourNodeId); } LaunchNewId::~LaunchNewId() @@ -64,7 +64,7 @@ PString LaunchNewId::CreateNewId() { - PTRACE(3, "Create a new id"); + PTRACE(5, "Create a new id"); PWaitAndSignal m(countMutex); PString res; if (buildCount == 0) { @@ -73,7 +73,7 @@ } else res = ourNodeId + PString(buildCount++); - PTRACE(3, "New id created at " << res); + PTRACE(5, "New id created at " << res); return res; } @@ -87,7 +87,7 @@ ourId = lid.CreateNewId(); ourPassword = lid.GetOurPassword(); remoteServer = lid.GetServer(); - PTRACE(3, "Constructor for MessageFrame " << ourId); + PTRACE(5, "Constructor for MessageFrame " << ourId); keepGoing = TRUE; @@ -117,7 +117,7 @@ WORD localPort = preferredPort; for (; preferredPort != 0;) { if (audioSocket.Listen(INADDR_ANY, 0, localPort)) { - PTRACE(3, "audio receive/send socket to listen on port " << localPort); + PTRACE(4, "audio receive/send socket to listen on port " << localPort); break; } @@ -137,7 +137,7 @@ { Terminate(); WaitForTermination(); - PTRACE(3, "DEstructor for MessageFrame " << ourId); + PTRACE(5, "DEstructor for MessageFrame " << ourId); } void MessageFrame::DtmfReceivedFromTheWorld(const PString & receivedDtmf) @@ -163,7 +163,7 @@ return FALSE; } - PTRACE(3, "WaitForInitialised start wait for connection"); + PTRACE(5, "WaitForInitialised start wait for connection"); goodConnection.Wait(); if (!keepGoing) { PTRACE(3, "Thread " << GetOurId() << " failed as we could not connect"); @@ -171,7 +171,7 @@ return FALSE; } - PTRACE(3, "WaitForInitialised start wait for source id"); + PTRACE(5, "WaitForInitialised start wait for source id"); writeSourceId.Wait(); if (!keepGoing) { PTRACE(3, "Thread " << GetOurId() << " failed as no source id received"); @@ -179,30 +179,28 @@ return FALSE; } - PTRACE(3, "WaitForInitialised start all done ok."); - PTRACE(3, "Thread " << GetOurId() << " is initialised ok"); + PTRACE(5, "WaitForInitialised start all done ok."); + PTRACE(4, "Thread " << GetOurId() << " is initialised ok"); return TRUE; } void MessageFrame::Terminate() { - PTRACE(3, "Terminate the message frame for " << GetOurId()); - keepGoing = FALSE; audioSocket.Close(); CloseMessagesSocket(); threadRunning.Signal(); goodConnection.Signal(); writeSourceId.Signal(); - PTRACE(3, "Finish Terminate the message frame for " << GetOurId()); + PTRACE(4, "Finish Terminate the message frame for " << GetOurId()); } void MessageFrame::Initialise() { SetThreadName(PString("Messages.") + ourId); - PTRACE(3, "Message frame Initialise begin"); + PTRACE(5, "Message frame Initialise begin"); messagesSocket.SetPort(5000); - PTRACE(3, "Message frame connect to port 5000 of server \"" + PTRACE(5, "Message frame connect to port 5000 of server \"" << remoteServer << "\""); for(PINDEX tryCount = 0; keepGoing && (tryCount < 5); tryCount++) { @@ -210,43 +208,42 @@ PTRACE(3, "Failed to connect to \"" << remoteServer << "\" error was \"" << messagesSocket.GetErrorText() << "\""); } - PTRACE(3, "finish a try to connect"); if (messagesSocket.GetErrorCode() == PChannel::NoError) { tryCount = 100; - PTRACE(3, "successfull connect for " << ourId); + PTRACE(5, "successfull connect for " << ourId); } else { - PTRACE(1, "Error text from connect is " << messagesSocket.GetErrorText()); + PTRACE(3, "Error text from connect is " << messagesSocket.GetErrorText()); PThread::Sleep(10); } } if (!keepGoing) { - PTRACE(3, "initialize end - keepgoing is false"); + PTRACE(4, "initialize end - keepgoing is false "); return; } - PTRACE(3, "ok, we have connected - probably"); + PTRACE(5, "ok, we have connected - probably"); if (messagesSocket.GetErrorCode() != PChannel::NoError) { - PTRACE(1, "error fail warning GIVE UP on this link. After 5 tries, could not get in." ); + PTRACE(3, "error fail warning GIVE UP on this link. After 5 tries, could not get in." ); PTRACE(3, "multiple efforts to connect aborted " ); keepGoing = FALSE; goodConnection.Signal(); return; } - PTRACE(3, "ok - we have a good connection"); + PTRACE(5, "ok - we have a good connection"); goodConnection.Signal(); if (!messagesSocket.SetOption(TCP_NODELAY, 1, IPPROTO_TCP)) { PTRACE(1, "SetOption(TCP_NODELAY) failed: " << messagesSocket.GetErrorText()); if (!keepGoing) { - PTRACE(3, "initialize end TCP_NODELAY- keepgoing is false"); + PTRACE(4, "initialize end TCP_NODELAY- keepgoing is false"); return; } } if (!messagesSocket.SetOption(SO_KEEPALIVE, 1)) { - PTRACE(1, "SetOption(keepalive) failed: " << messagesSocket.GetErrorText()); + PTRACE(3, "SetOption(keepalive) failed: " << messagesSocket.GetErrorText()); if (!keepGoing) { PTRACE(3, "initialize end SO_KEEPALIVE- keepgoing is false"); return; @@ -318,7 +315,7 @@ if (!keepGoing) { PTRACE(3, "END fail warning of message frame thread for " << ourId); } - PTRACE(3, "Initialise all done and was successfull. "); + PTRACE(5, "Initialise all done and was successfull. "); PINDEX maxm = 2000; PBYTEArray data(maxm); @@ -331,11 +328,10 @@ readSize[ir] = 1; while(keepGoing){ - PTRACE(3, "next iteration of read loop"); messagesSocket.Read(data.GetPointer(), maxm); PINDEX size = messagesSocket.GetLastReadCount(); PINDEX lastError = messagesSocket.GetErrorCode(); - PTRACE(4, "Read size is " << size << " and error code " << lastError); + readSize[readIndex] = size; readIndex = (readIndex + 1) % consecutiveReadNulls; PINDEX readSum = 0; @@ -352,9 +348,9 @@ } if (lastError != PChannel::NoError) { - PTRACE(1, "Failed in read from comms socket, code is " + PTRACE(3, "Failed in read from comms socket, code is " << messagesSocket.GetErrorText()); - PTRACE(1, "End Process Incoming Messages as we had a read error."); + PTRACE(3, "End Process Incoming Messages as we had a read error."); keepGoing = FALSE; continue; } else { @@ -362,9 +358,7 @@ } } - PTRACE(3, " - thread has finished"); - - PTRACE(3, "End of Process Incoming Messages - thread has finished"); + PTRACE(5, "End of Process Incoming Messages - thread has finished"); CloseMessagesSocket(); OnTermination(); @@ -373,7 +367,7 @@ void MessageFrame::OnTermination() { - PTRACE(1, " End of the emssage frame thread.for " << GetOurId()); + PTRACE(5, " End of the emssage frame thread.for " << GetOurId()); } void MessageFrame::ProcessIncomingMessages(PBYTEArray & block, @@ -393,7 +387,7 @@ for(i = 0; i < result.GetSize(); i++) { PString res = result[i]; - PTRACE(3, "Incoming message of \"" << res << "\""); + PTRACE(5, "Incoming message of \"" << res << "\""); PINDEX l = res.Find(':'); if (l == P_MAX_INDEX) { PTRACE(3, "Could not find a colon in " << res); @@ -428,7 +422,7 @@ void MessageFrame::SendThisMessageTo(const char *message, PString dest) { PString msg(message); - PTRACE(3, "Sendmessage " << msg << " " << dest); + PTRACE(3, "Sendmessage " << msg << " to " << dest); SendThisMessageTo(msg, dest); } @@ -440,10 +434,6 @@ PTRACE(3, "the message " << message << " is dropped, cause we are closed "); return; } - - PStringStream summary; - summary <<"Now we send the message \"" << message << "\" to " << dest; - PTRACE(3, summary); PBYTEArray binary; binary.SetSize(dest.GetLength() + 1 + message.GetLength() + 1); @@ -454,10 +444,8 @@ binary[binary.GetSize() - 1] = 0; writeMessageLock.Wait(); - if (messagesSocket.Write(binary.GetPointer(), binary.GetSize())) { - PTRACE(3, "Sent message just fine"); - } else { - PTRACE(3, "Failed to send message " << messagesSocket.GetErrorText()); + if (messagesSocket.Write(binary.GetPointer(), binary.GetSize()) == FALSE) { + PTRACE(3, "Failed to send message " << _message << " to " << dest << ". error was " << messagesSocket.GetErrorText()); } writeMessageLock.Signal(); } @@ -465,9 +453,9 @@ void MessageFrame::ProcessMessage(PString message, PString sender) { PStringArray cmds = message.Tokenise(" ", FALSE); - PTRACE(3, "Now process \"" << message << "\""); + if (cmds[0] *= availableCommands[0]) { - PTRACE(2, "ProcessHangup " << cmds[0]); + PTRACE(4, "ProcessHangup " << cmds[0]); if (OkToHangup()) { keepGoing = FALSE; ProcessHangup(cmds, sender); @@ -480,61 +468,61 @@ } if (cmds[0] *= availableCommands[1]) { - PTRACE(2, "ProcessCallNode " << cmds[0]); + PTRACE(4, "ProcessCallNode " << cmds[0]); ProcessCallNode(cmds, sender); return; } if (cmds[0] *= availableCommands[2]) { - PTRACE(2, "ProcessStatusQuery " << cmds[0]); + PTRACE(4, "ProcessStatusQuery " << cmds[0]); ProcessStatusQuery(cmds, sender); return; } if (cmds[0] *= availableCommands[3]) { - PTRACE(2, "ProcessDuration " << cmds[0]); + PTRACE(4, "ProcessDuration " << cmds[0]); ProcessDuration(cmds, sender); return; } if (cmds[0] *= availableCommands[4]) { - PTRACE(2, "ProcessIdentify " << cmds[0]); + PTRACE(4, "ProcessIdentify " << cmds[0]); ProcessIdentify(cmds, sender); return; } if (cmds[0] *= availableCommands[5]) { - PTRACE(2, "ProcessDebug " << cmds[0]); + PTRACE(4, "ProcessDebug " << cmds[0]); ProcessDebug(cmds, sender); return; } if (cmds[0] *= availableCommands[6]) { - PTRACE(2, "ProcessAnswer " << cmds[0]); + PTRACE(4, "ProcessAnswer " << cmds[0]); ProcessAnswer(cmds, sender); return; } if (cmds[0] *= availableCommands[7]) { - PTRACE(2, "ProcessTransferUdp " << cmds[0]); + PTRACE(4, "ProcessTransferUdp " << cmds[0]); ProcessTransferUdp(cmds, sender); return; } if (cmds[0] *= availableCommands[8]) { - PTRACE(2, "ProcessQueryAddress (or query local address)" << cmds[0]); + PTRACE(4, "ProcessQueryAddress (or query local address)" << cmds[0]); ProcessQueryLocalAddress(cmds, sender); return; } if (cmds[0] *= availableCommands[9]) { - PTRACE(2, "ProcessAdviseSendAddress " << cmds[0]); + PTRACE(4, "ProcessAdviseSendAddress " << cmds[0]); ProcessAdviseSendAddress(cmds, sender); return; } if (cmds[0] *= availableCommands[10]) { - PTRACE(2, "ProcessQuitNow " << cmds[0]); + PTRACE(4, "ProcessQuitNow " << cmds[0]); if (OkToQuitNow()) { keepGoing = FALSE; ProcessQuitNow(cmds, sender); @@ -547,50 +535,50 @@ } if (cmds[0] *= availableCommands[11]) { - PTRACE(2, "ProcessHelp " << cmds[0]); + PTRACE(4, "ProcessHelp " << cmds[0]); ProcessHelp(cmds, sender); return; } if (cmds[0] *= availableCommands[12]) { - PTRACE(2, "ProcessQueryDestAddress (or query destination address)" << cmds[0]); + PTRACE(4, "ProcessQueryDestAddress (or query destination address)" << cmds[0]); ProcessQueryDestAddress(cmds, sender); return; } if (cmds[0] *= availableCommands[13]) { - PTRACE(2, "ProcessSendDtmf " << cmds[0]); + PTRACE(4, "ProcessSendDtmf " << cmds[0]); ProcessSendDtmf(cmds, sender); return; } if (cmds[0] *= availableCommands[14]) { - PTRACE(2, "ProcessRequestNewId " << cmds[0]); + PTRACE(4, "ProcessRequestNewId " << cmds[0]); ProcessRequestNewId(cmds, sender); return; } if (cmds[0] *= availableCommands[15]) { - PTRACE(2, "ProcessSetReceivedMsgFile " << cmds[0]); + PTRACE(4, "ProcessSetReceivedMsgFile " << cmds[0]); ProcessSetWriteFile(cmds, sender); return; } if (cmds[0] *= availableCommands[16]) { - PTRACE(2, "ProcessSetAnnouncementFile " << cmds[0]); + PTRACE(4, "ProcessSetAnnouncementFile " << cmds[0]); ProcessSetReadFile(cmds, sender); return; } if (cmds[0] *= availableCommands[17]) { - PTRACE(2, "ReportToMe " << cmds[0]); + PTRACE(4, "ReportToMe " << cmds[0]); SetRemoteController(sender); return; } #ifdef PMEMORY_CHECK if (cmds[0] *= availableCommands[18]) { - PTRACE(2, "ProcessMemoryDump " << cmds[0]); + PTRACE(4, "ProcessMemoryDump " << cmds[0]); ProcessMemoryDump(cmds, sender); return; } Modified: sofaswitch/trunk/voip/comms.cxx ============================================================================== --- sofaswitch/trunk/voip/comms.cxx (original) +++ sofaswitch/trunk/voip/comms.cxx Thu Aug 23 01:22:58 2007 @@ -54,6 +54,12 @@ { PTRACE(3, "Destroy the Comms class instance for " << GetOurId() << " all done"); + PWaitAndSignal m(opalCallLock); + if (myOpalCall != NULL) { + myOpalCall->SafeDereference(); + myOpalCall = NULL; + } + DecComms(); } @@ -237,19 +243,6 @@ return TRUE; } -void Comms::AdviseCallRelease() -{ - PTRACE(3, "Advise of call hangup on " << GetOurId() << " and " << remoteController); - PString advise = PString("Hangup ") + GetOurId(); - SendThisMessageTo(advise, remoteController); - - PWaitAndSignal m(opalCallLock); - if (myOpalCall != NULL) { - myOpalCall->SafeDereference(); - myOpalCall = NULL; - } -} - PUDPSocket & Comms::GetAudioSocket() { PTRACE(6, "Return reference to audio socket"); Modified: sofaswitch/trunk/voip/comms.h ============================================================================== --- sofaswitch/trunk/voip/comms.h (original) +++ sofaswitch/trunk/voip/comms.h Thu Aug 23 01:22:58 2007 @@ -74,15 +74,17 @@ /**Send a message to the remote controller that we are closing down now */ virtual void StopAllCommunications(); - /**Send a message to the remote controller saying that we are - created (and established in the Opal sense of a connection). The - id of this node is appended to the message. + /**Send a message to the remote controller saying that we are created (and + established in the Opal sense of a connection). The id of this node is + appended to the message. + + Note that there is no need to send a message to the remote controller we + have died. The remote controller will get this "death" message from the + server. ((The message server will note that our socket has died, and + notify the controller accordingly)). */ void AdviseCallCreation(); - /**Tell this comms instance to let go of the OpalCall pointer */ - void AdviseCallRelease(); - /**Assign a value to the jocall pointer */ void SetMyOpalCallPtr(MyOpalCall *ptr); Modified: sofaswitch/trunk/voip/jocall.cxx ============================================================================== --- sofaswitch/trunk/voip/jocall.cxx (original) +++ sofaswitch/trunk/voip/jocall.cxx Thu Aug 23 01:22:58 2007 @@ -153,7 +153,6 @@ void MyOpalCall::OnReleased(OpalConnection & connection) { - comms.AdviseCallRelease(); PTRACE(2, "On Released of connection. " << connection.GetToken()); OpalCall::OnReleased(connection); } Modified: sofaswitch/trunk/voip/mymanager.cxx ============================================================================== --- sofaswitch/trunk/voip/mymanager.cxx (original) +++ sofaswitch/trunk/voip/mymanager.cxx Thu Aug 23 01:22:58 2007 @@ -439,8 +439,8 @@ BOOL MyManager::OnIncomingConnection( - OpalConnection & connection, ///< Connection that is calling - unsigned options, ///< options for new connection + OpalConnection & connection, + unsigned options, OpalConnection::StringOptions * stringOptions ) { Modified: sofaswitch/trunk/voip/udpconnection.cxx ============================================================================== --- sofaswitch/trunk/voip/udpconnection.cxx (original) +++ sofaswitch/trunk/voip/udpconnection.cxx Thu Aug 23 01:22:58 2007 @@ -189,7 +189,6 @@ if (soundChannel == NULL) return NULL; - PTRACE(3, "ZZZ\tCreate opal audio media stream for " << mediaFormat << " and source of " << isSource); return new OpalAudioMediaStream(*this, mediaFormat, sessionID, isSource, 2, soundChannel); }