本文整理汇总了C++中AmArg::get方法的典型用法代码示例。如果您正苦于以下问题:C++ AmArg::get方法的具体用法?C++ AmArg::get怎么用?C++ AmArg::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AmArg
的用法示例。
在下文中一共展示了AmArg::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadDSMWithPaths
void DSMFactory::loadDSMWithPaths(const AmArg& args, AmArg& ret) {
string dsm_name = args.get(0).asCStr();
string diag_path = args.get(1).asCStr();
string mod_path = args.get(2).asCStr();
string res = "OK";
ScriptConfigs_mut.lock();
try {
if (MainScriptConfig.diags->hasDiagram(dsm_name)) {
ret.push(400);
ret.push("DSM named '" + dsm_name + "' already loaded (use reloadDSMs to reload all)");
} else {
if (!MainScriptConfig.diags->loadFile(diag_path+dsm_name+".dsm", dsm_name, mod_path, DebugDSM)) {
ret.push(500);
ret.push("error loading "+dsm_name+" from "+ diag_path+dsm_name+".dsm");
} else {
ret.push(200);
ret.push("loaded "+dsm_name+" from "+ diag_path+dsm_name+".dsm");
}
}
} catch(...) {
ScriptConfigs_mut.unlock();
throw;
}
ScriptConfigs_mut.unlock();
}
示例2: registerApplication
void DSMFactory::registerApplication(const AmArg& args, AmArg& ret) {
string diag_name = args.get(0).asCStr();
string conf_name;
if (args.size()>1 && isArgCStr(args.get(1)))
conf_name = args.get(1).asCStr();
bool has_diag;
ScriptConfigs_mut.lock();
try {
has_diag = hasDSM(diag_name, conf_name);
} catch(...) {
ScriptConfigs_mut.unlock();
throw;
}
ScriptConfigs_mut.unlock();
if (!has_diag) {
ret.push(400);
ret.push("unknown application (DSM)");
return;
}
bool res = AmPlugIn::instance()->registerFactory4App(diag_name,this);
if(res) {
INFO("DSM state machine registered: %s.\n",diag_name.c_str());
ret.push(200);
ret.push("registered DSM application");
} else {
ret.push(500);
ret.push("Error registering DSM application (already registered?)");
}
}
示例3: listDSMs
void DSMFactory::listDSMs(const AmArg& args, AmArg& ret) {
vector<string> names;
ScriptConfigs_mut.lock();
try {
if (isArgUndef(args) || !args.size())
names = MainScriptConfig.diags->getDiagramNames();
else {
if (isArgCStr(args.get(0))) {
map<string, DSMScriptConfig>::iterator i=
ScriptConfigs.find(args.get(0).asCStr());
if (i!= ScriptConfigs.end())
names = i->second.diags->getDiagramNames();
}
}
} catch (...) {
ScriptConfigs_mut.unlock();
throw;
}
ScriptConfigs_mut.unlock();
for (vector<string>::iterator it=
names.begin(); it != names.end(); it++) {
ret.push(*it);
}
}
示例4: roomCreate
void WebConferenceFactory::roomCreate(const AmArg& args, AmArg& ret) {
assertArgCStr(args.get(0));
string room = args.get(0).asCStr();
rooms_mut.lock();
// sweep rooms (if necessary)
sweepRooms();
map<string, ConferenceRoom>::iterator it = rooms.find(room);
if (it == rooms.end()) {
rooms[room] = ConferenceRoom();
rooms[room].adminpin = getRandomPin();
ret.push(0);
ret.push("OK");
ret.push(rooms[room].adminpin.c_str());
} else {
if (rooms[room].adminpin.empty()) {
rooms[room].adminpin = getRandomPin();
ret.push(0);
ret.push("OK");
ret.push(rooms[room].adminpin.c_str());
} else {
ret.push(1);
ret.push("room already opened");
ret.push("");
}
}
rooms_mut.unlock();
}
示例5: invoke
void DIDial::invoke(const string& method, const AmArg& args, AmArg& ret)
{
if(method == "dial"){
ret.push(dialout(args.get(0).asCStr(),
args.get(1).asCStr(),
args.get(2).asCStr(),
args.get(3).asCStr()).c_str());
} else if(method == "dial_auth"){
ret.push(dialout_auth(args.get(0).asCStr(),
args.get(1).asCStr(),
args.get(2).asCStr(),
args.get(3).asCStr(),
args.get(4).asCStr(),
args.get(5).asCStr(),
args.get(6).asCStr()
).c_str());
} else if(method == "dial_pin"){
ret.push(dialout_pin(args.get(0).asCStr(),
args.get(1).asCStr(),
args.get(2).asCStr(),
args.get(3).asCStr()
).c_str());
} else if(method == "help"){
ret.push("dial <application> <user> <from> <to>");
ret.push("dial_auth <application> <user> <from> <to> <realm> <auth_user> <auth_pwd>");
ret.push("dial_pin <application> <dialout pin> <local_user> <to_user>");
} else if(method == "_list"){
ret.push(AmArg("dial"));
ret.push(AmArg("dial_auth"));
ret.push(AmArg("dial_pin"));
ret.push(AmArg("help"));
} else
throw AmDynInvoke::NotImplemented(method);
}
示例6: invoke
void UACAuthFactory::invoke(const string& method, const AmArg& args, AmArg& ret)
{
if (method == "getHandler") {
CredentialHolder* c = dynamic_cast<CredentialHolder*>(args.get(0).asObject());
DialogControl* cc = dynamic_cast<DialogControl*>(args.get(1).asObject());
if ((c!=NULL)&&(cc!=NULL)) {
AmArg handler;
handler.setBorrowedPointer(getHandler(cc->getDlg(), c));
ret.push(handler);
} else {
ERROR("wrong types in call to getHandler. (c=%ld, cc= %ld)\n",
(unsigned long)c, (unsigned long)cc);
}
} else if (method == "checkAuth") {
// params: Request realm user pwd
if (args.size() < 4) {
ERROR("missing arguments to uac_auth checkAuth function, expected Request realm user pwd\n");
throw AmArg::TypeMismatchException();
}
AmSipRequest* req = dynamic_cast<AmSipRequest*>(args.get(0).asObject());
if (NULL == req)
throw AmArg::TypeMismatchException();
UACAuth::checkAuthentication(req, args.get(1).asCStr(),
args.get(2).asCStr(),
args.get(3).asCStr(), ret);
} else
throw AmDynInvoke::NotImplemented(method);
}
示例7: postConfEvent
void WebConferenceFactory::postConfEvent(const AmArg& args, AmArg& ret,
int id, int mute) {
for (int i=0;i<2;i++)
assertArgCStr(args.get(1));
string room = args.get(0).asCStr();
string adminpin = args.get(1).asCStr();
string call_tag = args.get(2).asCStr();
// check adminpin
rooms_mut.lock();
ConferenceRoom* r = getRoom(room, adminpin);
if (NULL == r) {
ret.push(1);
ret.push("wrong adminpin");
rooms_mut.unlock();
return;
}
bool p_exists = r->hasParticipant(call_tag);
if (p_exists && (mute >= 0))
r->setMuted(call_tag, mute);
rooms_mut.unlock();
if (p_exists) {
AmSessionContainer::instance()->postEvent(call_tag,
new WebConferenceEvent(id));
ret.push(0);
ret.push("OK");
} else {
ret.push(2);
ret.push("call does not exist");
}
}
示例8: invoke
void DSMFactory::invoke(const string& method, const AmArg& args,
AmArg& ret)
{
if (method == "postDSMEvent"){
assertArgCStr(args.get(0))
DSMEvent* ev = new DSMEvent();
for (size_t i=0;i<args[1].size();i++)
ev->params[args[1][i][0].asCStr()] = args[1][i][1].asCStr();
if (AmSessionContainer::instance()->postEvent(args.get(0).asCStr(), ev)) {
ret.push(AmArg(200));
ret.push(AmArg("OK"));
} else {
ret.push(AmArg(404));
ret.push(AmArg("Session not found"));
}
} else if (method == "reloadDSMs"){
reloadDSMs(args,ret);
} else if (method == "loadDSM"){
args.assertArrayFmt("s");
loadDSM(args,ret);
} else if (method == "loadDSMWithPath"){
args.assertArrayFmt("sss");
loadDSMWithPaths(args,ret);
} else if (method == "preloadModules"){
preloadModules(args,ret);
} else if (method == "preloadModule"){
args.assertArrayFmt("ss");
preloadModule(args,ret);
} else if (method == "hasDSM"){
args.assertArrayFmt("s");
hasDSM(args,ret);
} else if (method == "listDSMs"){
listDSMs(args,ret);
} else if (method == "registerApplication"){
args.assertArrayFmt("s");
registerApplication(args,ret);
} else if (method == "loadConfig"){
args.assertArrayFmt("ss");
loadConfig(args,ret);
} else if(method == "_list"){
ret.push(AmArg("postDSMEvent"));
ret.push(AmArg("reloadDSMs"));
ret.push(AmArg("loadDSM"));
ret.push(AmArg("loadDSMWithPaths"));
ret.push(AmArg("preloadModules"));
ret.push(AmArg("preloadModule"));
ret.push(AmArg("loadConfig"));
ret.push(AmArg("hasDSM"));
ret.push(AmArg("listDSMs"));
ret.push(AmArg("registerApplication"));
} else
throw AmDynInvoke::NotImplemented(method);
}
示例9: dialout
void WebConferenceFactory::dialout(const AmArg& args, AmArg& ret) {
for (int i=0;i<6;i++)
assertArgCStr(args.get(1));
string room = args.get(0).asCStr();
string adminpin = args.get(1).asCStr();
string callee = args.get(2).asCStr();
string from_user = args.get(3).asCStr();
string domain = args.get(4).asCStr();
string auth_user = args.get(5).asCStr();
string auth_pwd = args.get(6).asCStr();
string from = "sip:" + from_user + "@" + domain;
string to = "sip:" + callee + "@" + domain;
// check adminpin
rooms_mut.lock();
ConferenceRoom* r = getRoom(room, adminpin);
rooms_mut.unlock();
if (NULL == r) {
ret.push(1);
ret.push("wrong adminpin");
ret.push("");
return;
}
DBG("dialout webconference room '%s', from '%s', to '%s'",
room.c_str(), from.c_str(), to.c_str());
AmArg* a = new AmArg();
a->setBorrowedPointer(new UACAuthCred("", auth_user, auth_pwd));
AmSession* s = AmUAC::dialout(room.c_str(), APP_NAME, to,
"<" + from + ">", from, "<" + to + ">",
string(""), // local tag
string(""), // hdrs
a);
if (s) {
string localtag = s->getLocalTag();
ret.push(0);
ret.push("OK");
ret.push(localtag.c_str());
newParticipant(room, localtag, to);
updateStatus(room, localtag,
ConferenceRoomParticipant::Connecting,
"INVITE");
}
else {
ret.push(1);
ret.push("internal error");
ret.push("");
}
}
示例10: invoke
void MWI::invoke(const string& method, const AmArg& args, AmArg& ret)
{
if (method == "publish") {
string user, domain;
user = args.get(1).asCStr();
domain = args.get(0).asCStr();
publish(user, domain);
ret.push(0);
}
else
throw AmDynInvoke::NotImplemented(method);
};
示例11: DBG
void XMLRPC2DI::newConnection(const AmArg& args, AmArg& ret) {
string app_name = args.get(0).asCStr();
string server_name = args.get(1).asCStr();
int port = args.get(2).asInt();
string uri = args.get(3).asCStr();
DBG("adding XMLRPC server http://%s:%d%s for application '%s'\n",
server_name.c_str(), port, uri.c_str(), app_name.c_str());
XMLRPCServerEntry* sc = new XMLRPCServerEntry(server_name, port, uri);
server_mut.lock();
servers.insert(std::make_pair(app_name, sc));
server_mut.unlock();
}
示例12: listRooms
void WebConferenceFactory::listRooms(const AmArg& args, AmArg& ret) {
string pwd = args.get(0).asCStr();
if ((!MasterPassword.length()) ||
pwd != MasterPassword) {
ret.push(407);
AmArg res;
res.push("Wrong Master Password.\n");
ret.push(res);
return;
}
AmArg room_list;
rooms_mut.lock();
for (map<string, ConferenceRoom>::iterator it =
rooms.begin(); it != rooms.end(); it++) {
room_list.push(it->first.c_str());
}
rooms_mut.unlock();
ret.push(200);
ret.push(room_list);
}
示例13: vqRoomFeedback
void WebConferenceFactory::vqRoomFeedback(const AmArg& args, AmArg& ret) {
assertArgCStr(args.get(0));
assertArgCStr(args.get(1));
assertArgInt(args.get(2));
string room = args.get(0).asCStr();
string adminpin = args.get(1).asCStr();
int opinion = args.get(2).asInt();
saveFeedback(string("RO "+ room + "|||" + adminpin + "|||" +
int2str(opinion) + "|||" + int2str(time(NULL)) + "|||\n"));
ret.push(0);
ret.push("OK");
}
示例14: hasDSM
void DSMFactory::hasDSM(const AmArg& args, AmArg& ret) {
string conf_name;
if (args.size()>1 && isArgCStr(args.get(1)))
conf_name = args.get(1).asCStr();
bool res;
ScriptConfigs_mut.lock();
try {
res = hasDSM(args.get(0).asCStr(), conf_name);
} catch(...) {
ScriptConfigs_mut.unlock();
throw;
}
ScriptConfigs_mut.unlock();
if (res)
ret.push("1");
else
ret.push("0");
}
示例15: invoke
void DILog::invoke(const string& method, const AmArg& args, AmArg& ret) {
if(method == "dumplog") {
ret.push(dumpLog().c_str());
} else if(method == "dumplogtodisk") {
dumpLog(args.get(0).asCStr());
ret.push("dumped to disk.\n");
} else if(method == "help") {
ret.push("dumplog\n"
"dumplogtodisk <path>\n"
);
} else throw AmDynInvoke::NotImplemented(method);
}