Objective to achieve : To clear sip setting (realm,
identity,password etc), then initialize back with new sip
setting so that user doesnt have to stop and rerun the
program.
Been away for few days. Sorry for the late reply. Right now,
i'm developing my own code as i wanted to change the ezphone
layout. Since all the layouts in ezphone are hardcoded, so i
have to start fresh.
Somehow i cannot use the function in sipXmgr.cpp. Based on
the code in sipXmgr, I executed
(1.) //Uninitializing sip
setting----------------------------------------------------------------------------------------
sipxEventListenerRemove(g_hInst, EventCallBack, NULL)
;
sipxLineRemove(g_hLine);
//g_hLine = 0;
if(sipxUnInitialize(g_hInst) != SIPX_RESULT_SUCCESS)
{
sipxUnInitialize(g_hInst, true);
}
-once code is executed, if i try to make call, it prompted
assertion failure related to phLine!=NULL
(2.) // initialize sipx TAPI-like
API------------------------------------------------------------------------------------------------
sipxInitialize(&g_hInst, 5060, 5060, 0,80000,1);
sipxEventListenerAdd(g_hInst, EventCallBack, NULL) ;
sipxLineAdd(g_hInst,m_Identity2, &g_hLine);
sipxLineAddCredential(g_hLine, m_Username, m_Password2,
m_RealmServer2) ;
sipxLineRegister(g_hLine, true);
-once the code is executed right after i executed code in
(1.), when i tried to make a call, nothing happen. i checked
at ethereal result. when call is made after executing item
(2.), the response that i got is 401 unauthorized error.
Hope you can help me in rectifying this problem. I'm new to
telephony stuff, sorry for any inconveniences caused :)
Regards,
Zamielia
------------------------------------------------------------------------------------------------------------------------------------------------
Hi,
No, sipxuninitialize does not call sipxinitialize. This
method tears down the basic SIP stack and media process
resources.
To clear up your sip settings, you have to remove any
existing line you added and registered, hence, the function
sipxRemoveLine().
If you are using sipxezphone I suggest that you use the
Uninitialize() function in sipXmgr.cpp instead of calling
sipxUnInitialize directly.
Here's the UnInitialize function as defined in sipXmgr.cpp:
void sipXmgr::UnInitialize()
{
wxStaticText* ST =
(wxStaticText*)FindWindowById(ID_STATDISP,NULL);
if (sipXmgr::spSipXmgr)
{
sipxEventListenerRemove(sipXmgr::spSipXmgr->m_hInst,
SipCallbackProc, NULL);
sipxLineRemove(sipXmgr::spSipXmgr->m_hLine);
sipXmgr::spSipXmgr->m_hLine = 0;
// We need to wait for lines to unregister / calls
to drop
if (sipxUnInitialize(sipXmgr::spSipXmgr->m_hInst) !=
SIPX_RESULT_SUCCESS)
{
sipxUnInitialize(sipXmgr::spSipXmgr->m_hInst,
true);//true for forced shutdown
}
sipXmgr::spSipXmgr->m_hInst = NULL;
}
}
To call this function, include sipXmgr.h (in the source file
where you execute unititialize) and execute the following
code.
sipXmgr::getInstance().UnInitialize();
//add this function as well
sipXmgr::release();
Hope this helps. :)
Regards,
Joseph
_______________________________________________
sipxtapi-dev mailing list
[email protected]
List Archive: http://list.sipfoundry.org/archive/sipxtapi-dev/