📄 provisioninterface.cxx
字号:
throw(VException&){ initializePolicyServerList(); _policyServerGrpCont.getHostToGroupMap(retList);}voidProvisionInterface::getJtapiData(const string& jtapiName, VJtapiServerData& data)throw (VException&){ string dRead = _interface.readItem(VJTAPIS, jtapiName); if (dRead.size()) { try { data.parse(dRead); } catch (VException& e) { char buf[256]; sprintf(buf, "Failed to parse XML data for jtapi %s", jtapiName.c_str()); cpLog(LOG_ALERT, buf); throw VBadDataException(buf, __FILE__, __LINE__, 0); } } else { cpLog(LOG_ALERT, "Failed to access Jtapi server data."); throw VMissingDataException("Failed to access Jtapi server data.", __FILE__, __LINE__, 0); }}voidProvisionInterface::getFeatureData(const string& featureName, VFeatureServerData& data)throw (VException&){ string dRead = _interface.readItem(VFEATURES, featureName); if (dRead.size()) { try { data.parse(dRead); } catch (VException& e) { char buf[256]; sprintf(buf, "Failed to parse XML data for Feature %s", featureName.c_str()); cpLog(LOG_ALERT, buf); throw VBadDataException(buf, __FILE__, __LINE__, 0); } } else { cpLog(LOG_ALERT, "Failed to access feature server data."); throw VMissingDataException("Failed to access feature server data.", __FILE__, __LINE__, 0); }}voidProvisionInterface::getMarshalData(const string& marshalName, VMarshalServerData& data)throw (VException&){ string dRead = _interface.readItem(VMARSHALS, marshalName); if (dRead.size()) { try { data.parse(dRead); } catch (VException& e) { char buf[256]; sprintf(buf, "Failed to parse XML data for marshal %s", marshalName.c_str()); cpLog(LOG_ALERT, buf); throw VBadDataException(buf, __FILE__, __LINE__, 0); } } else { cpLog(LOG_ALERT, "Failed to access marshal server data."); throw VMissingDataException("Failed to access marshal server data.", __FILE__, __LINE__, 0); }}voidProvisionInterface::getLocationData(const string& locationName, VLocationServerData& data)throw (VException&){ string dRead = _interface.readItem(VLOCATIONS, locationName); if (dRead.size()) { try { data.parse(dRead); } catch (VException& e) { char buf[256]; sprintf(buf, "Failed to parse XML data for location server %s", locationName.c_str()); cpLog(LOG_ALERT, buf); throw VBadDataException(buf, __FILE__, __LINE__, 0); } } else { cpLog(LOG_ALERT, "Failed to access location server data."); throw VMissingDataException("Failed to access location server data.", __FILE__, __LINE__, 0); }}voidProvisionInterface::getLocationRouteData(const string& locationRouteName, VLocationRouteData& data)throw (VException&){ string dRead = _interface.readItem(VLOCATIONS, locationRouteName); if (dRead.size()) { try { data.parse(dRead); } catch (VException& e) { char buf[256]; sprintf(buf, "Failed to parse XML data for location server routes %s", locationRouteName.c_str()); cpLog(LOG_ALERT, buf); throw VBadDataException(buf, __FILE__, __LINE__, 0); } } else { cpLog(LOG_ALERT, "Failed to access location server route data."); throw VMissingDataException("Failed to access location server route data.", __FILE__, __LINE__, 0); }}voidProvisionInterface::getCdrData(const string& cdrName, VCdrServerData& data)throw (VException&){ string dRead = _interface.readItem(VCDRS, cdrName); if (dRead.size()) { try { data.parse(dRead); } catch (VException& e) { char buf[256]; sprintf(buf, "Failed to parse XML data for Cdr %s", cdrName.c_str()); cpLog(LOG_ALERT, buf); throw VBadDataException(buf, __FILE__, __LINE__, 0); } } else { cpLog(LOG_ALERT, "Failed to access Cdr server data."); throw VMissingDataException("Failed to access Cdr server data.", __FILE__, __LINE__, 0); }}voidProvisionInterface::getRedirectData(const string& redirectName, VRedirectServerData& data)throw (VException&){ string dRead = _interface.readItem(VRSERVERS, redirectName); if (dRead.size()) { try { data.parse(dRead); } catch (VException& e) { char buf[256]; sprintf(buf, "Failed to parse XML data for redirect %s", redirectName.c_str()); cpLog(LOG_ALERT, buf); throw VBadDataException(buf, __FILE__, __LINE__, 0); } } else { cpLog(LOG_ALERT, "Failed to access redirect server data."); throw VMissingDataException("Failed to access redirect server data.", __FILE__, __LINE__, 0); }}voidProvisionInterface::getPolicyData(const string& policyName, VPolicyServerData& data)throw (VException&){ string dRead = _interface.readItem(VPOLICIES, policyName); if (dRead.size()) { try { data.parse(dRead); } catch (VException& e) { char buf[256]; sprintf(buf, "Failed to parse XML data for Policy %s", policyName.c_str()); cpLog(LOG_ALERT, buf); throw VBadDataException(buf, __FILE__, __LINE__, 0); } } else { cpLog(LOG_ALERT, "Failed to access policy server data."); throw VMissingDataException("Failed to access policy server data.", __FILE__, __LINE__, 0); }}voidProvisionInterface::getAccountData(const string& userName, VAccountData& data)throw (VException&){ string dRead = _interface.readItem(VACCOUNTS, userName); if (dRead.size()) { try { data.parse(dRead); } catch (VException& e) { char buf[256]; sprintf(buf, "Failed to parse XML data for Account %s", userName.c_str()); cpLog(LOG_ALERT, buf); throw VBadDataException(buf, __FILE__, __LINE__, 0); } } else { cpLog(LOG_ALERT, "Failed to access requested account data."); throw VMissingDataException("Failed to access requested account data.", __FILE__, __LINE__, 0); }}stringProvisionInterface::getUserIp(const string& userName)throw (VException&){ string retStr; string dRead = _interface.readItem(VACCOUNTS, userName); if (dRead.size()) { VXmlParser parser(dRead); retStr = parser.getContent("user", "ipaddr"); } else { cpLog(LOG_ALERT, "Failed to access user account."); throw VMissingDataException("Failed to access user account", __FILE__, __LINE__, 0); } return retStr;}stringProvisionInterface::getMasterUser(const string& userName)throw (VException&){ string retStr; string dRead = _interface.readItem(VALIASES, userName); if (dRead.size()) { VXmlParser parser(dRead); xmlNode *theNode = parser.findNode(NULL, "userAlias"); retStr = parser.getAttribute(theNode, "masterUser"); } else { cpLog(LOG_ALERT, "Failed to access user account."); throw VMissingDataException("Failed to access user account", __FILE__, __LINE__, 0); } return retStr;}boolProvisionInterface::isAccount(const string& userName){ try { string dRead = _interface.readItem(VACCOUNTS, userName); return true; } catch (VMissingDataException) { return false; }}voidProvisionInterface::getAliases(const string& userName, list < string > &retVal)throw (VException&){ retVal.clear(); string dRead = _interface.readItem(VACCOUNTS, userName); if (dRead.size()) { VXmlParser parser(dRead); xmlNode *theNode = parser.findNode(NULL, "user"); list < xmlNodePtr > listOfAliases; parser.findNode(theNode, "alias", listOfAliases); for (list < xmlNodePtr > ::iterator itr = listOfAliases.begin(); itr != listOfAliases.end(); itr++) { xmlNodePtr aliasNode = (*itr); // get value attribute from node string val = parser.getAttribute(aliasNode, "value"); retVal.push_back(val); } } else { cpLog(LOG_ALERT, "Failed to access user account."); throw VMissingDataException("Failed to access user account", __FILE__, __LINE__, 0); } return ;}boolProvisionInterface::getTermContactList(const string& userName, list < string > &retVal)throw (VException&){ retVal.clear(); string dRead = _interface.readItem(VACCOUNTS, userName); if (dRead.size()) { VXmlParser parser(dRead); xmlNode *theNode = parser.findNode(NULL, "staticRegistration"); string retStr = parser.getAttribute(theNode, "value"); if (retStr == "true") { theNode = parser.findNode(NULL, "user"); list < xmlNodePtr > listOfContacts; parser.findNode(theNode, "contact", listOfContacts); for (list < xmlNodePtr > ::iterator itr = listOfContacts.begin(); itr != listOfContacts.end(); itr++) { xmlNodePtr aliasNode = (*itr); // get value attribute from node string val = parser.getAttribute(aliasNode, "value"); retVal.push_back(val); } return true; } else { // no list return false; } } else { cpLog(LOG_ALERT, "Failed to access user account."); throw VMissingDataException("Failed to access user account", __FILE__, __LINE__, 0); } return false;}voidProvisionInterface::getSubscribers(vector < Data > & retList)throw (VException &){ _interface.getList(VACCOUNTS, retList);}voidProvisionInterface::getAllAliases(vector < Data > & retList)throw (VException&){ _interface.getList(VALIASES, retList);}voidProvisionInterface::deleteSubscriber(const string& subscriberName)throw (VException&){ _interface.deleteSubscriber(subscriberName);}voidProvisionInterface::getCalledList(const string&, int, const string& acctName, vector < Data > & retData)throw (VException&){ // Read user data from the PS string dRead = _interface.readItem(VCALLEDLIST, acctName); VXmlParser parser(dRead); list < string > contents; parser.getContent("contact", "host", contents); for (list < string > ::iterator itr = contents.begin(); itr != contents.end(); itr++) { retData.push_back(*itr); }}voidProvisionInterface::getCallingList(const string&, int, const string& acctName, vector < Data > & retData)throw (VException&){ // Read user data from the PS string dRead = _interface.readItem(VCALLINGLIST, acctName); VXmlParser parser(dRead); list < string > contents; parser.getContent("contact", "host", contents); for (list < string > ::iterator itr = contents.begin(); itr != contents.end(); itr++) { retData.push_back(*itr); }}voidProvisionInterface::getCalledFeatureScripts(const string& hostName, int port, vector < Data > & retList)throw (VException&){ char buf[256]; sprintf(buf, "%s_%s_%d_Called", VFEATURES, hostName.c_str(), port); _interface.getList(buf, retList);}voidProvisionInterface::getCallingFeatureScripts(const string& hostName, int port, vector < Data > & retList)throw (VException&){ char buf[256]; sprintf(buf, "%s_%s_%d_Calling", VFEATURES, hostName.c_str(), port); _interface.getList(buf, retList);}voidProvisionInterface::getDialPlan(const string& name, vector < VPlanElement > & retData)throw (VException &){ cpLog(LOG_DEBUG, "getPhoneDialPlan: %s", name.c_str()); string xmlData = _interface.readItem(VSYS_CONF, name); if (!xmlData.size()) { throw VMissingDataException("No dialplan data to parse", __FILE__, __LINE__, 0); } VXmlParser parser(xmlData); list < xmlNodePtr > listOfKeys;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -