コード例 #1
0
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);
  
}
コード例 #2
0
ファイル: JsonRPC.cpp プロジェクト: Chocolatbuddha/sems
void JsonRPCServerModule::invoke(const string& method, 
				 const AmArg& args, AmArg& ret) {
  if (method == "execRpc"){

    // todo: add connection id
    args.assertArrayFmt("sssisis");   // evq_link, notificationReceiver, requestReceiver, 
                                      // flags(i), host, port (i), method, [params]
    if (args.size() > 7)  {
      if (!isArgArray(args.get(7)) && !isArgStruct(args.get(7))) {
	ERROR("internal error: params to JSON-RPC must be struct or array\n");
	throw AmArg::TypeMismatchException();
      }
    }
    execRpc(args, ret);
    // sendRequestList(args, ret);
  } else if (method == "sendMessage"){
    args.assertArrayFmt("sisss");          // conn_id, type, method, id, reply_sink, [params]
    if (args.size() > 5) {
      if (!isArgArray(args.get(5)) && !isArgStruct(args.get(5))) {
	ERROR("internal error: params to JSON-RPC must be struct or array\n");
	throw AmArg::TypeMismatchException();
      }
    }
    sendMessage(args, ret);
  } else if (method == "execServerFunction"){ 
    args.assertArrayFmt("ss");          // method, id, params
    JsonRpcServer::execRpc(args.get(0).asCStr(), args.get(1).asCStr(), args.get(2), ret);
    // JsonRpcServer::execRpc(args, ret);
  } else if (method == "getServerPort"){
    ret.push(port);
  } else if(method == "_list"){ 
    ret.push(AmArg("execRpc"));
    ret.push(AmArg("sendMessage"));
    ret.push(AmArg("getServerPort"));
    ret.push(AmArg("execServerFunction"));
    // ret.push(AmArg("newConnection"));
    // ret.push(AmArg("sendRequest"));
    // ret.push(AmArg("sendRequestList"));
  }  else
    throw AmDynInvoke::NotImplemented(method);  
}
コード例 #3
0
ファイル: DSM.cpp プロジェクト: BackupTheBerlios/sems-svn
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);
}
コード例 #4
0
ファイル: SBC.cpp プロジェクト: Chocolatbuddha/sems
void SBCFactory::invoke(const string& method, const AmArg& args, 
				AmArg& ret)
{
  if (method == "listProfiles"){
    listProfiles(args, ret);
  } else if (method == "reloadProfiles"){
    reloadProfiles(args,ret);
  } else if (method == "loadProfile"){
    args.assertArrayFmt("u");
    loadProfile(args,ret);
  } else if (method == "reloadProfile"){
    args.assertArrayFmt("u");
    reloadProfile(args,ret);
  } else if (method == "getActiveProfile"){
    getActiveProfile(args,ret);
  } else if (method == "setActiveProfile"){
    args.assertArrayFmt("u");
    setActiveProfile(args,ret);
  } else if (method == "getRegexMapNames"){
    getRegexMapNames(args,ret);
  } else if (method == "setRegexMap"){
    args.assertArrayFmt("u");
    setRegexMap(args,ret);
  } else if (method == "loadCallcontrolModules"){
    args.assertArrayFmt("s");
    loadCallcontrolModules(args,ret);
  } else if (method == "postControlCmd"){
    args.assertArrayFmt("ss"); // at least call-ltag, cmd
    postControlCmd(args,ret);
  } else if(method == "_list"){ 
    ret.push(AmArg("listProfiles"));
    ret.push(AmArg("reloadProfiles"));
    ret.push(AmArg("reloadProfile"));
    ret.push(AmArg("loadProfile"));
    ret.push(AmArg("getActiveProfile"));
    ret.push(AmArg("setActiveProfile"));
    ret.push(AmArg("getRegexMapNames"));
    ret.push(AmArg("setRegexMap"));
    ret.push(AmArg("loadCallcontrolModules"));
    ret.push(AmArg("postControlCmd"));
    ret.push(AmArg("printCallStats"));
  } else if(method == "printCallStats"){ 
    B2BMediaStatistics::instance()->getReport(args, ret);
  }  else
    throw AmDynInvoke::NotImplemented(method);
}
コード例 #5
0
void WebConferenceFactory::invoke(const string& method, 
				  const AmArg& args, 
				  AmArg& ret)
{
  

  if(method == "roomCreate"){
    roomCreate(args, ret);
    ret.push(getServerInfoString().c_str());
  } else if(method == "roomInfo"){
    roomInfo(args, ret);
    ret.push(getServerInfoString().c_str());
  } else if(method == "dialout"){
    dialout(args, ret);
    ret.push(getServerInfoString().c_str());
  } else if(method == "mute"){
    mute(args, ret);
    ret.push(getServerInfoString().c_str());
  } else if(method == "unmute"){
    unmute(args, ret);
    ret.push(getServerInfoString().c_str());
  } else if(method == "kickout"){
    kickout(args, ret);
    ret.push(getServerInfoString().c_str());
  } else if(method == "serverInfo"){
    serverInfo(args, ret);		
    ret.push(getServerInfoString().c_str());    
  } else if(method == "vqRoomFeedback"){
    vqRoomFeedback(args, ret);		
    ret.push(getServerInfoString().c_str());    
  } else if(method == "vqCallFeedback"){
    vqCallFeedback(args, ret);		
    ret.push(getServerInfoString().c_str());    
  } else if(method == "vqConferenceFeedback"){
    vqConferenceFeedback(args, ret);		
    ret.push(getServerInfoString().c_str());    
  } else if(method == "help"){
    ret.push("help text goes here");
    ret.push(getServerInfoString().c_str());
  } else if(method == "resetFeedback"){
    resetFeedback(args, ret);		
    ret.push(getServerInfoString().c_str());    
  } else if(method == "flushFeedback"){
    flushFeedback(args, ret);		
    ret.push(getServerInfoString().c_str());    
  } else if(method == "getRoomPassword"){
    args.assertArrayFmt("ss");
    getRoomPassword(args, ret);
    ret.push(getServerInfoString().c_str());    
  } else if(method == "listRooms"){
    args.assertArrayFmt("s");
    listRooms(args, ret);
    ret.push(getServerInfoString().c_str());    
  } else if(method == "_list"){
    ret.push("roomCreate");
    ret.push("roomInfo");
    ret.push("dialout");
    ret.push("mute");
    ret.push("unmute");
    ret.push("kickout");
    ret.push("serverInfo");
    ret.push("vqConferenceFeedback");
    ret.push("vqCallFeedback");
    ret.push("vqRoomFeedback");
    ret.push("getRoomPassword");
    ret.push("listRooms");
  } else
    throw AmDynInvoke::NotImplemented(method);
}