コード例 #1
0
int main(int argc, char* argv[])
{
    parseArgs(argc, argv);
    initLogger(argv);

    UtlString urlString = "https://" + UtlString(xmlrpcServer);
    Url url(urlString);
    url.setHostPort(HttpPort);

    // Delay for 5 minutes
//    printf("Wating for start of memcheck ...\n");
//    OsTask::delay(600000);
//    printf("Starting memcheck ...\n");

    // Test run
    // while (1)
    for (int i = 0; i < 10; i++)
    {
        XmlRpcRequest* request = new XmlRpcRequest(url, "addExtension");

        UtlString groupName("*****@*****.**");
        request->addParam(&groupName);

        UtlString extension("*****@*****.**");
        request->addParam(&extension);

        printf("Sending %d ...", i);
        XmlRpcResponse response;
        if (!request->execute(response))
        {
           UtlString reason;
           int code;
           response.getFault(&code,reason);
           printf(" failed\n   %d %s\n", code, reason.data() );
        }
        else
        {
           printf(" ok\n");
        }

        delete request;
        request = NULL;

//        OsTask::delay(2000);
    }
//    printf("Done with memcheck ...\n");

//    while (1)
//    {
//        OsTask::delay(60000);
//    }

    return(1);
}
コード例 #2
0
ファイル: configrpc.cpp プロジェクト: mranga/sipxecs
void requestGet(Url& url, UtlSList& names)
{
    XmlRpcRequest* request;
    XmlRpcResponse response;
    
    request = new XmlRpcRequest(url, "configurationParameter.get");
    request->addParam(&DataSet);        

    if (!names.isEmpty())
    {
        request->addParam(&names);
    }
      
    if (!request->execute(response/*, &pSocket*/))
    {
        exitFault(response);
    }
    else
    {
        UtlContainable* value;
        if (response.getResponse(value))
        {
            UtlHashMap* paramList = dynamic_cast<UtlHashMap*>(value);
            if (paramList)
            {
                UtlHashMapIterator params(*paramList);
                UtlString* name;
                while ((name = dynamic_cast<UtlString*>(params())))
                {
                    UtlString* value = dynamic_cast<UtlString*>(paramList->findValue(name));
                    printf("%s : %s\n", name->data(), value->data());
                }
            }
            else
            {
                fprintf(stderr, "Incorrect type returned.\n");
                exit(1);
            }
        }
        else
        {
            fprintf(stderr, "No value returned.\n");
            exit(1);
        }
    }    
    delete request;
    request = NULL;
}
コード例 #3
0
ファイル: configrpc.cpp プロジェクト: mranga/sipxecs
void requestDelete(Url& url, UtlSList& names)
{
    XmlRpcRequest* request;
    XmlRpcResponse response;
    
    request = new XmlRpcRequest(url, "configurationParameter.delete");
    request->addParam(&DataSet); 
        
    if (!names.isEmpty())
    {
        request->addParam(&names);
    }
      
    if (!request->execute(response/*, &pSocket*/))
    {
        exitFault(response);
    }
    else
    {
        UtlContainable* value;
        if (response.getResponse(value))
        {
            UtlInt* deletedCount = dynamic_cast<UtlInt*>(value);
            if (deletedCount)
            {
                if (Verbose == Feedback)
                {
                   printf("deleted %d parameters.\n", (int)deletedCount->getValue());
                }
            }
            else
            {
                fprintf(stderr, "Incorrect type returned.\n");
                exit(1);
            }
        }
        else
        {
            fprintf(stderr, "No value returned.\n");
            exit(1);
        }
    }    
    delete request;
    request = NULL;
}
コード例 #4
0
ファイル: configrpc.cpp プロジェクト: mranga/sipxecs
void requestSet(Url& url, UtlHashMap& parameters)
{
    XmlRpcRequest* request;
    XmlRpcResponse response;
    
    request = new XmlRpcRequest(url, "configurationParameter.set");
    request->addParam(&DataSet); 
    request->addParam(&parameters);
     
    if (request->execute(response /*, &pSocket*/))
    {
        UtlContainable* value;
        if (response.getResponse(value))
        {
            UtlInt* numberSet = dynamic_cast<UtlInt*>(value);
            if (numberSet)
            {
                if (Verbose == Feedback)
                {
                    printf("set %d name/value pairs.\n", (int)numberSet->getValue());
                }
            }
            else
            {
                fprintf(stderr, "Incorrect type returned.\n");
                exit(1);
            }
        }
        else
        {
            fprintf(stderr, "No value returned.\n");
            exit(1);
         }
    }
    else
    {
        exitFault(response);
    }
    delete request;
    request = NULL;
}
コード例 #5
0
ファイル: configrpc.cpp プロジェクト: mranga/sipxecs
void requestVersion(Url& url)
{
    XmlRpcRequest* request;
    XmlRpcResponse response;
    
    request = new XmlRpcRequest(url, "configurationParameter.version");
    request->addParam(&DataSet);    
    
    if (!request->execute(response/*, &pSocket*/))
    {
        exitFault(response);
    }
    else
    {
        UtlContainable* value;
        if (response.getResponse(value))
        {
            UtlString* versionId = dynamic_cast<UtlString*>(value);
            if (versionId)
            {
                printf("%s\n", versionId->data());
            }
            else
            {
                fprintf(stderr, "Incorrect type returned.\n");
                exit(1);
            }
        }
        else
        {
            fprintf(stderr, "No value returned.\n");
        }
    }    
    delete request;
    request = NULL;
}