本文整理汇总了C++中AmArg::setBorrowedPointer方法的典型用法代码示例。如果您正苦于以下问题:C++ AmArg::setBorrowedPointer方法的具体用法?C++ AmArg::setBorrowedPointer怎么用?C++ AmArg::setBorrowedPointer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AmArg
的用法示例。
在下文中一共展示了AmArg::setBorrowedPointer方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onNewRegistration
void SIPRegistrarClient::onNewRegistration(SIPNewRegistrationEvent* new_reg) {
SIPRegistration* reg = new SIPRegistration(new_reg->handle, new_reg->info,
new_reg->sess_link);
if (uac_auth_i != NULL) {
DBG("enabling UAC Auth for new registration.\n");
// get a sessionEventHandler from uac_auth
AmArg di_args,ret;
AmArg a;
a.setBorrowedPointer(reg);
di_args.push(a);
di_args.push(a);
DBG("arg type is %d\n", a.getType());
uac_auth_i->invoke("getHandler", di_args, ret);
if (!ret.size()) {
ERROR("Can not add auth handler to new registration!\n");
} else {
ArgObject* p = ret.get(0).asObject();
if (p != NULL) {
AmSessionEventHandler* h = dynamic_cast<AmSessionEventHandler*>(p);
if (h != NULL)
reg->setSessionEventHandler(h);
}
}
}
add_reg(new_reg->handle, reg);
reg->doRegistration();
}
示例2: 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);
}
示例3: dialout_pin
string DIDial::dialout_pin(const string& application,
const string& pin,
const string& user,
const string& to_user
) {
DBG("dialout application '%s', user '%s', to_user '%s', pin '%s'",
application.c_str(), user.c_str(), to_user.c_str(), pin.c_str());
// find pin
map<string, DIDialoutInfo>::iterator it = DIDialFactory::dialout_pins.find(pin);
if (it != DIDialFactory::dialout_pins.end()) {
AmArg* a = new AmArg();
a->setBorrowedPointer(new UACAuthCred(it->second.realm,
it->second.user,
it->second.pwd));
AmSession* s = AmUAC::dialout(user.c_str(), application,
"sip:"+to_user+"@"+it->second.realm,
"<sip:" + it->second.user+"@"+it->second.realm + ">",
"sip:"+it->second.user+"@"+it->second.realm,
"<sip:" + to_user+"@"+it->second.realm + ">",
string(""), // callid
a);
if (s)
return s->getLocalTag();
else
return "<failed>\n";
} else
return "incorrect dialout pin.\n";
}
示例4: 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("");
}
}
示例5: 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);
}
示例6: createCall
void CallBackFactory::createCall(const string& number) {
AmArg* a = new AmArg();
a->setBorrowedPointer(new UACAuthCred("", auth_user, auth_pwd));
string luser = "cb";
string to = "sip:"+ number + "@" + gw_domain;
string from = "sip:"+ gw_user + "@" + gw_domain;
AmUAC::dialout(luser,
MOD_NAME,
to,
"<" + from + ">", from,
"<" + to + ">",
string(""), // local tag
string("X-Extra: fancy\r\n"), // hdrs
a);
}
示例7: saveBox
void AnswerMachineDialog::saveBox(FILE* fp) {
string msg_name = email_dict["ts"] + MSG_SEPARATOR +
email_dict["sender"] + ".wav";
DBG("message name is '%s'\n", msg_name.c_str());
AmArg di_args,ret;
di_args.push(email_dict["domain"].c_str()); // domain
di_args.push(email_dict["user"].c_str()); // user
di_args.push(msg_name.c_str()); // message name
AmArg df;
MessageDataFile df_arg(fp);
df.setBorrowedPointer(&df_arg);
di_args.push(df);
msg_storage->invoke("msg_new",di_args,ret);
// TODO: evaluate ret return value
if (fp)
fclose(fp);
}
示例8: saveMessage
void AnnRecorderDialog::saveMessage(FILE* fp) {
string msg_name = params["type"]+".wav";
DBG("message name is '%s'\n", msg_name.c_str());
AmArg di_args,ret;
di_args.push((params["domain"]+DOMAIN_PROMPT_SUFFIX).c_str()); // domain
di_args.push(params["user"].c_str()); // user
di_args.push(msg_name.c_str()); // message name
AmArg df;
MessageDataFile df_arg(fp);
df.setBorrowedPointer(&df_arg);
di_args.push(df);
try {
msg_storage->invoke("msg_new",di_args,ret);
} catch(string& s) {
ERROR("invoking msg_new: '%s'\n", s.c_str());
} catch(...) {
ERROR("invoking msg_new.\n");
}
// TODO: evaluate ret return value
}
示例9: dialout_auth
string DIDial::dialout_auth(const string& application,
const string& user,
const string& from,
const string& to,
const string& a_realm,
const string& a_user,
const string& a_pwd
) {
DBG("dialout application '%s', user '%s', from '%s', to '%s'",
application.c_str(), user.c_str(), from.c_str(), to.c_str());
AmArg* a = new AmArg();
a->setBorrowedPointer(new UACAuthCred(a_realm, a_user, a_pwd));
AmSession* s = AmUAC::dialout(user.c_str(), application, to,
"<" + from + ">", from, "<" + to + ">",
string(""), // callid
a);
if (s)
return s->getLocalTag();
else
return "<failed>\n";
}
示例10: dialout
void WebConferenceFactory::dialout(const AmArg& args, AmArg& ret) {
for (int i=0;i<6;i++)
assertArgCStr(args.get(i));
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 callee_domain;
string headers;
try {
assertArgCStr(args.get(7));
headers = args.get(7).asCStr();
int i, len;
len = headers.length();
for (i = 0; i < len; i++) {
if (headers[i] == '|') headers[i] = '\n';
}
if (headers[len - 1] != '\n') {
headers += '\n';
}
}
catch (AmArg::OutOfBoundsException &e) {
headers = "";
}
try {
assertArgCStr(args.get(8));
callee_domain = args.get(8).asCStr();
}
catch (AmArg::OutOfBoundsException &e) {
callee_domain = domain;
}
string from = "sip:" + from_user + "@" + domain;
string to = "sip:" + callee + "@" + callee_domain;
// check adminpin
rooms_mut.lock();
// sweep rooms (if necessary)
sweepRooms();
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(""), // callid
headers, // headers
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("");
}
}