public XMLServiceResultStruct GetActiveCalls(string username)
        {
            XMLServiceResultStruct opResult = new XMLServiceResultStruct(true, "Sorry an unknown error has occurred processing your request. Please try reloading the page and if the error persists contact [email protected].", null);
            
            /*try
            {
                List<SIPCallDescriptor> userCalls = SIPCallDescriptor.GetCurrentCalls(username);

                if (userCalls != null && userCalls.Count > 0)
                {
                    string callURIs = "<callsinprogress>";

                    foreach (SIPCallDescriptor userCall in userCalls)
                    {
                        // Timer update
                        SIPCallDescriptor call = SIPCallDescriptor.GetCall(username, userCall.SwitchCallId);    // Retreive call information

                        string arrow = (call.SwitchedCall.IsOutgoingCall == true) ? "rightarrow.png" : "leftarrow.png";

                        string callStatus = (call.m_callInProgress == true) ? "In Progress" : "Active";

                        callURIs +=
                            " <call>" +
                            "  <switchcallid>" + userCall.SwitchCallId + "</switchcallid>" + 
                            "  <clienturi>" + userCall.ClientTransaction.TransactionRequestURI.CanonicalAddress + "</clienturi>" +
                            "  <clientfromname>" + userCall.ClientTransaction.TransactionRequestFrom.Name + "</clientfromname>" +
                            "  <clientfromuri>" + userCall.ClientTransaction.TransactionRequestFrom.URI.CanonicalAddress + "</clientfromuri>" +
                            "  <clientsocket>" + userCall.ClientTransaction.RemoteEndPoint + "</clientsocket>" +
                            "  <arrow>" + arrow + "</arrow>" +
                            "  <callStatus>" + callStatus + "</callStatus>" +
                            "  <serveruri>" + SIPURI.ParseSIPURI(userCall.SwitchedCall.Uri).CanonicalAddress + "</serveruri>" +
                            "  <serverfromname>" + userCall.ServerTransaction.TransactionRequestFrom.Name + "</serverfromname>" +
                            "  <serverfromuri>" + userCall.ServerTransaction.TransactionRequestFrom.URI.CanonicalAddress + "</serverfromuri>" +
                            "  <serversocket>" + userCall.ServerEndPoint + "</serversocket>" +
                            "  <duration>0</duration>" +
                            " </call>"; 
                    } // end foreach
                    callURIs += "</callsinprogress>";

                    string resultMessage = null;
                    if (userCalls.Count == 1)
                    {
                        resultMessage = "1 active call found for " + username + ".";
                    }
                    else
                    {
                        resultMessage = userCalls.Count + " calls found for " + username + ".";
                    }

                    opResult = new XMLServiceResultStruct(false, resultMessage, callURIs);
                }
                else
                {
                    opResult = new XMLServiceResultStruct(false, "No active calls found for " + username + ".", "<callsinprogress/>");
                }
            }
            catch (Exception excp)
            {
                logger.Error("Exception GetActiveCalls. " + excp.Message);
                opResult.Message = "Exception. " + excp.Message;
            }*/

            return opResult;
        }
示例#2
0
        public XMLServiceResultStruct GetActiveCalls(string username)
        {
            XMLServiceResultStruct opResult = new XMLServiceResultStruct(true, "Sorry an unknown error has occurred processing your request. Please try reloading the page and if the error persists contact [email protected].", null);

            /*try
             * {
             *  List<SIPCallDescriptor> userCalls = SIPCallDescriptor.GetCurrentCalls(username);
             *
             *  if (userCalls != null && userCalls.Count > 0)
             *  {
             *      string callURIs = "<callsinprogress>";
             *
             *      foreach (SIPCallDescriptor userCall in userCalls)
             *      {
             *          // Timer update
             *          SIPCallDescriptor call = SIPCallDescriptor.GetCall(username, userCall.SwitchCallId);    // Retreive call information
             *
             *          string arrow = (call.SwitchedCall.IsOutgoingCall == true) ? "rightarrow.png" : "leftarrow.png";
             *
             *          string callStatus = (call.m_callInProgress == true) ? "In Progress" : "Active";
             *
             *          callURIs +=
             *              " <call>" +
             *              "  <switchcallid>" + userCall.SwitchCallId + "</switchcallid>" +
             *              "  <clienturi>" + userCall.ClientTransaction.TransactionRequestURI.CanonicalAddress + "</clienturi>" +
             *              "  <clientfromname>" + userCall.ClientTransaction.TransactionRequestFrom.Name + "</clientfromname>" +
             *              "  <clientfromuri>" + userCall.ClientTransaction.TransactionRequestFrom.URI.CanonicalAddress + "</clientfromuri>" +
             *              "  <clientsocket>" + userCall.ClientTransaction.RemoteEndPoint + "</clientsocket>" +
             *              "  <arrow>" + arrow + "</arrow>" +
             *              "  <callStatus>" + callStatus + "</callStatus>" +
             *              "  <serveruri>" + SIPURI.ParseSIPURI(userCall.SwitchedCall.Uri).CanonicalAddress + "</serveruri>" +
             *              "  <serverfromname>" + userCall.ServerTransaction.TransactionRequestFrom.Name + "</serverfromname>" +
             *              "  <serverfromuri>" + userCall.ServerTransaction.TransactionRequestFrom.URI.CanonicalAddress + "</serverfromuri>" +
             *              "  <serversocket>" + userCall.ServerEndPoint + "</serversocket>" +
             *              "  <duration>0</duration>" +
             *              " </call>";
             *      } // end foreach
             *      callURIs += "</callsinprogress>";
             *
             *      string resultMessage = null;
             *      if (userCalls.Count == 1)
             *      {
             *          resultMessage = "1 active call found for " + username + ".";
             *      }
             *      else
             *      {
             *          resultMessage = userCalls.Count + " calls found for " + username + ".";
             *      }
             *
             *      opResult = new XMLServiceResultStruct(false, resultMessage, callURIs);
             *  }
             *  else
             *  {
             *      opResult = new XMLServiceResultStruct(false, "No active calls found for " + username + ".", "<callsinprogress/>");
             *  }
             * }
             * catch (Exception excp)
             * {
             *  logger.Error("Exception GetActiveCalls. " + excp.Message);
             *  opResult.Message = "Exception. " + excp.Message;
             * }*/

            return(opResult);
        }