< Previous by Date Date Index Next by Date >
  Thread Index Next in Thread >

[reSIProcate] Register crash after the third time login?


Hi all,

I'm writing a soft phone using resiprocate as a sip stack. I have a problem with register:
If i login three times in a row resiprocate crashes on the third time at line 775 in dialogset.cxx

AppDialog* appDialog = mAppDialogSet->createAppDialog(msg);

Do you have any solution for that issue?
Thank you very much.

DBQ.
PS: Bellow is my login function( before calling Register function I have called a function called InitResiprocate to initialize sipstack, sipdum, ...):

void Csipmmc::Register(char* struser, char* strpasswd, char* strrealm)
{
    try {
        bool first = true;
        string from(struser);
        if (from.find("sip:",0) != 0)
            from.insert(0, "sip:");
        Data tmp_data(from);
        Uri tmp_uri(tmp_data);
        uac.myUri = tmp_uri;

        string user(str_get_username(struser));
        string passwd(strpasswd);
        string realm(strrealm);

        // sip logic
        clientDum->getMasterProfile()->setDefaultRegistrationTime(70);       
       
        /////
        NameAddr naFrom(from.c_str());
        clientDum->getMasterProfile()->setDefaultFrom(naFrom);
        clientDum->getMasterProfile()->setDigestCredential( realm.c_str(), user.c_str(), passwd.c_str());

        SharedPtr<SipMessage> regMessage = clientDum->makeRegistration(naFrom);

        clientDum->send( regMessage );
    }
    catch (BaseException& e) {}

int Csipmmc::InitResiprocate(char* outboundProxy, int port)
{
    clientDum = new DialogUsageManager(clientStack);
    stackThread = new StackThread(clientStack);
    SharedPtr<MasterProfile> profile(new MasterProfile);   
    profile->addSupportedMethod(REFER);
    profile->addSupportedMethod(NOTIFY);
    profile->addSupportedMethod(SUBSCRIBE);
    profile->addSupportedMethod(MESSAGE);

    profile->validateAcceptEnabled() = false;
    profile->validateContentEnabled() = false;

    profile->addSupportedMimeType(NOTIFY, Pidf::getStaticType());
    profile->addSupportedMimeType(NOTIFY,Mime("application", "simple-message-summary"));
    profile->addSupportedMimeType(MESSAGE, Mime("text", "plain"));
    Uri outboundproxy;
    int proxy_port;
    if (outboundProxy != NULL)
    {
        string input_sipaddress(outboundProxy);
        outboundproxy.host() = Data(str_get_outboundproxy(input_sipaddress, proxy_port));
        outboundproxy.port() = proxy_port;
        profile->setOutboundProxy(outboundproxy);
    }

    clientDum->addTransport(UDP, port);
    clientDum->setMasterProfile(profile);

    auto_ptr<ClientAuthManager> clientAuth(new ClientAuthManager());   
    clientDum->setClientAuthManager(clientAuth);
    clientDum->setClientRegistrationHandler(&uac);
    clientDum->addClientSubscriptionHandler("presence",&uac);
    clientDum->addServerSubscriptionHandler("presence",&uac);
    clientDum->setInviteSessionHandler(&uac);
    clientDum->addOutOfDialogHandler(OPTIONS, &uac);
    clientDum->setClientPagerMessageHandler(&uac);
    clientDum->setServerPagerMessageHandler(&uac);

    dumThread= 0;
    dumThread = new DumThread(*clientDum);
    stackThread->run();
    if (dumThread)
    {
       dumThread->run();
    }
    return 0;
}