本文整理汇总了C++中AmArg::push方法的典型用法代码示例。如果您正苦于以下问题:C++ AmArg::push方法的具体用法?C++ AmArg::push怎么用?C++ AmArg::push使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AmArg
的用法示例。
在下文中一共展示了AmArg::push方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: reloadProfiles
void SBCFactory::reloadProfiles(const AmArg& args, AmArg& ret) {
std::map<string, SBCCallProfile> new_call_profiles;
bool failed = false;
string res = "OK";
AmArg profile_list;
profiles_mut.lock();
for (std::map<string, SBCCallProfile>::iterator it=
call_profiles.begin(); it != call_profiles.end(); it++) {
new_call_profiles[it->first] = SBCCallProfile();
if (!new_call_profiles[it->first].readFromConfiguration(it->first,
it->second.profile_file)) {
ERROR("reading call profile file '%s'\n", it->second.profile_file.c_str());
res = "Error reading call profile for "+it->first+" from "+it->second.profile_file+
+"; no profiles reloaded";
failed = true;
break;
}
AmArg p;
p["name"] = it->first;
p["md5"] = it->second.md5hash;
p["path"] = it->second.profile_file;
profile_list.push(p);
}
if (!failed) {
call_profiles = new_call_profiles;
ret.push(200);
} else {
ret.push(500);
}
ret.push(res);
ret.push(profile_list);
profiles_mut.unlock();
}
示例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: getRegexMapNames
void SBCFactory::getRegexMapNames(const AmArg& args, AmArg& ret) {
AmArg p;
vector<string> reg_names = regex_mappings.getNames();
for (vector<string>::iterator it=reg_names.begin();
it != reg_names.end(); it++) {
p["regex_maps"].push(*it);
}
ret.push(200);
ret.push("OK");
ret.push(p);
}
示例6: getActiveProfile
void SBCFactory::getActiveProfile(const AmArg& args, AmArg& ret) {
profiles_mut.lock();
AmArg p;
for (vector<string>::iterator it=active_profile.begin();
it != active_profile.end(); it++) {
p["active_profile"].push(*it);
}
profiles_mut.unlock();
ret.push(200);
ret.push("OK");
ret.push(p);
}
示例7: loadConfig
// DI interface function
void DSMFactory::loadConfig(const AmArg& args, AmArg& ret) {
string file_name = args.get(0).asCStr();
string diag_name = args.get(1).asCStr();
if (loadConfig(file_name, diag_name, true, NULL)) {
ret.push(200);
ret.push("OK");
} else {
ret.push(500);
ret.push("reload config failed");
}
}
示例8: 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);
}
示例9: switch
void XMLRPC2DIServer::xmlrpcval2amarg(XmlRpcValue& v, AmArg& a,
unsigned int start_index) {
if (v.valid()) {
for (int i=start_index; i<v.size();i++) {
switch (v[i].getType()) {
case XmlRpcValue::TypeInt: { a.push(AmArg((int)v[i])); } break;
case XmlRpcValue::TypeDouble:{ a.push(AmArg((double)v[i])); } break;
case XmlRpcValue::TypeString:{ a.push(AmArg(((string)v[i]).c_str())); } break;
// TODO: support more types (datetime, struct, ...)
default: throw XmlRpcException("unsupported parameter type", 400);
};
}
}
}
示例10: setActiveProfile
void SBCFactory::setActiveProfile(const AmArg& args, AmArg& ret) {
if (!args[0].hasMember("active_profile")) {
ret.push(400);
ret.push("Parameters error: expected ['active_profile': <active_profile list>] ");
return;
}
profiles_mut.lock();
active_profile = explode(args[0]["active_profile"].asCStr(), ",");
profiles_mut.unlock();
ret.push(200);
ret.push("OK");
AmArg p;
p["active_profile"] = args[0]["active_profile"];
ret.push(p);
}
示例11: postControlCmd
void SBCFactory::postControlCmd(const AmArg& args, AmArg& ret) {
SBCControlEvent* evt;
if (args.size()<3) {
evt = new SBCControlEvent(args[1].asCStr());
} else {
evt = new SBCControlEvent(args[1].asCStr(), args[2]);
}
if (!AmSessionContainer::instance()->postEvent(args[0].asCStr(), evt)) {
ret.push(404);
ret.push("Not found");
} else {
ret.push(202);
ret.push("Accepted");
}
}
示例12: msg_get
void MsgStorage::msg_get(string domain, string user,
string msg_name, AmArg& ret) {
string fname = msg_dir + "/" + domain + "/" + user + "/"+ msg_name;
DBG("looking for '%s'\n", fname.c_str());
FILE* fp = fopen(fname.c_str(), "r");
if (!fp)
ret.push(MSG_EMSGNOTFOUND);
else
ret.push(MSG_OK);
AmArg af;
af.setBorrowedPointer(new MessageDataFile(fp));
ret.push(af);
}
示例13: 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("");
}
}
示例14: NotImplemented
void XMLRPC2DI::invoke(const string& method,
const AmArg& args, AmArg& ret) {
if(method == "newConnection"){
args.assertArrayFmt("ssis"); // app, server, port, uri
newConnection(args, ret);
} else if(method == "sendRequest"){
args.assertArrayFmt("ssa"); // app, method, args
sendRequest(args, ret);
} else if(method == "_list"){
ret.push(AmArg("newConnection"));
ret.push(AmArg("sendRequest"));
} else
throw AmDynInvoke::NotImplemented(method);
}
示例15: 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);
}