// 实现外域发送消息公共方法(支持重定向)
 IVS_INT32 CXmlProcess::GetCommSendMgrForRedirect(CXml &xml, CUserMgr* pUserMgr, NSS_MSG_TYPE_E msgType, IVS_INT32 iType, const IVS_CHAR* pCameraCode,const IVS_CHAR* pDomainCode)
 {
	 CHECK_POINTER(pDomainCode, IVS_OPERATE_MEMORY_ERROR);
	 CHECK_POINTER(pUserMgr, IVS_OPERATE_MEMORY_ERROR);

	 IVS_UINT32 xmlLen = 0;
	 const IVS_CHAR* pReq = xml.GetXMLStream(xmlLen);
	 CHECK_POINTER(pReq, IVS_OPERATE_MEMORY_ERROR);

	 BP_RUN_LOG_INF("Get CommSendMgr For Redirect", "send XML = %s", pReq);

	 // 构造带域的请求消息,并发送
	 CSendNssMsgInfo sendNssMsgInfo;
	 sendNssMsgInfo.SetNeedXml(TYPE_NSS_XML);
	 sendNssMsgInfo.SetNetElemType(NET_ELE_SMU_NSS);
	 sendNssMsgInfo.SetReqID(msgType);
	 sendNssMsgInfo.SetReqData(pReq);
	 sendNssMsgInfo.SetCameraCode(pCameraCode);
	 sendNssMsgInfo.SetDomainCode(pDomainCode);
	 std::string strpRsp;
	 IVS_INT32 iNeedRedirect = IVS_FAIL;
	 IVS_INT32 iRet = pUserMgr->SendCmd(sendNssMsgInfo,strpRsp,iNeedRedirect);

     if (IVS_SUCCEED != iRet)
     {
          BP_RUN_LOG_ERR(iRet,"Get CommSendMgr For Redirect", "seng cmd fail");
          return iRet;
     }

	 if(NSS_GET_VOICE_INFO_REQ == msgType || NSS_GET_CAMERA_CFG_REQ == msgType)
	 {
		 if (IVS_SUCCEED == iNeedRedirect)
		 {
			 iRet = pUserMgr->SendRedirectServe(sendNssMsgInfo,strpRsp);
		 }
	 }

	 // 返回相应消息
	 if (BUILSTRING == iType)
	 {
		 if (strpRsp.empty())
		 {
			 BP_RUN_LOG_ERR(iRet,"NULL == strpRsp", "iRet = %d", iRet);
			 return iRet;
		 }
		 if(iRet == IVS_SUCCEED)
		 { 
			 iRet = IVS_XML_INVALID;
			 xml.RemoveElem();
			 if(xml.Parse(strpRsp.c_str()))
			 {
				 iRet = IVS_SUCCEED;
			 }
		 }
		 BP_RUN_LOG_INF("Get CommSendMgr For Redirect", "revice XML = %s", strpRsp.c_str());
	 }

	 return iRet;
 }
IVS_INT32 CXmlProcess::GetCommBuildRet( CXml &xml, NSS_MSG_TYPE_E msgType, IVS_INT32 iType, const std::string& strLinkID)
{
    IVS_UINT32 xmlLen = 0;
    const IVS_CHAR* pReq = xml.GetXMLStream(xmlLen);
    CHECK_POINTER(pReq, IVS_OPERATE_MEMORY_ERROR);

	BP_RUN_LOG_INF("COCXXmlProcess::GetCommBuildRet", "send XML = %s", pReq);
    //创建要发送的CMD,拼装了NSS消息头
    CCmd* pCmd = CNSSOperator::instance().BuildSMUCmd(msgType, pReq, strLinkID);
    CHECK_POINTER(pCmd, IVS_SDK_RET_BP_CMD_REQ_INVALID);

    //发送消息
    CCmd *pCmdRsp = CNSSOperator::instance().SendSyncCmd(pCmd);
    CHECK_POINTER(pCmdRsp, IVS_NET_RECV_TIMEOUT);

    //返回响应消息
    IVS_INT32 iRet = IVS_SUCCEED;
    const IVS_CHAR* pRsp = NULL;
    if (BUILDRET == iType)
    {
        iRet = CNSSOperator::instance().ParseCmd2NSS(pCmdRsp);
    }
    else
    {
        pRsp = CNSSOperator::instance().ParseCmd2XML(pCmdRsp, iRet);        
    }
	BP_RUN_LOG_INF("GetCommBuildRet", "revice XML = %s", pRsp);

    HW_DELETE(pCmdRsp);
    if (BUILSTRING == iType)
    {
        if (NULL == pRsp)
        {
            BP_RUN_LOG_ERR(iRet,"NULL == pRsp", "iRet = %d", iRet);
            return iRet;
        }

        if(iRet == IVS_SUCCEED)
        { 
            iRet = IVS_XML_INVALID;
            xml.RemoveElem();
            if(xml.Parse(pRsp))
            {
                iRet = IVS_SUCCEED;
            }
            IVS_DELETE(pRsp, MUILI);
        }
    }
    BP_RUN_LOG_INF("GetCommBuildRet", "iType = %d,iRet = %d", iType, iRet);
	return iRet;
}