I don't understand what are you trying to achieve with this code. You 
use the same sip proxy for both sipxtapi instances, you just create 
lines with different SIP URIs.

The important thing to realize when developing with sipxtapi is that 
sipxtapi lines are real relephone lines, unlike lines in other clients 
like x-lite. In x-lite having 2 lines just means you can make up to 2 
calls on the same real line. In sipxtapi a line can have lots of 
concurrent calls on it, and you can have lots of active lines. So you 
can have 1 instance of sipxtapi, register 100 lines with it, and each 
line can have lots of calls (there might be limits in #defines 
somewhere, so you need to check that if you want really high number of 
lines and calls).

Jaroslav Libak

Alexey Trizno wrote:
> Multiple instances, events (I got CAUSE_NO_RESPONSE for call2):
>
>
> source code (maybe someone help me?):
>
> #include "tapi/sipXtapi.h"
> #include "tapi/sipXtapiEvents.h"
>
> #include <windows.h>
>
> bool EventCallBack1(SIPX_EVENT_CATEGORY category, void* pInfo, void* 
> pUserData)
> {
>       char cBuf[1024] ;
>       printf("INST1: %s\n", sipxEventToString(category, pInfo, cBuf, 
> sizeof(cBuf)));    
>
>       if (category == EVENT_CATEGORY_CALLSTATE)
>       {
>               SIPX_CALLSTATE_INFO* pCallInfo = 
> static_cast<SIPX_CALLSTATE_INFO*>(pInfo);
>               printf("    hCall=%d, hAssociatedCall=%d\n", pCallInfo->hCall, 
> pCallInfo->hAssociatedCall);
>       }
>       return true;
> }
>
> bool EventCallBack2(SIPX_EVENT_CATEGORY category, void* pInfo, void* 
> pUserData)
> {
>       char cBuf[1024] ;
>       printf("INST2: %s\n", sipxEventToString(category, pInfo, cBuf, 
> sizeof(cBuf)));    
>
>       if (category == EVENT_CATEGORY_CALLSTATE)
>       {
>               SIPX_CALLSTATE_INFO* pCallInfo = 
> static_cast<SIPX_CALLSTATE_INFO*>(pInfo);
>               printf("    hCall=%d, hAssociatedCall=%d\n", pCallInfo->hCall, 
> pCallInfo->hAssociatedCall);
>       }
>       return true;
> }
>
> int _tmain(int argc, _TCHAR* argv[])
> {
>       sipxConfigSetLogLevel(LOG_LEVEL_DEBUG) ;
>       sipxConfigSetLogFile("sipXtapi_test.log");
>
>       SIPX_INST hInst1 = NULL, hInst2 = NULL;
>       SIPX_LINE hLine1 = 0, hLine2 = 0;    
>       SIPX_CALL hCall1 = 0, hCall2 = 0;    
>
>       printf("Initialize inst1...\n");
>
>       sipxInitialize(&hInst1, 5060, 5060, -1, 9000);
>       sipxEventListenerAdd(hInst1, EventCallBack1, NULL);
>
>         sipxConfigSetOutboundProxy(hInst1, "192.168.0.88");
>
>       sipxLineAdd(hInst1, "sip:[EMAIL PROTECTED]", &hLine1);
>       sipxLineAddCredential(hLine1, "201", "201", "asterisk");
>
>       sipxCallCreate(hInst1, hLine1, &hCall1);
>       sipxCallConnect(hCall1, "sip:[EMAIL PROTECTED]");
>
>       Sleep(2000);
>
>       printf("Initialize inst2...\n");
>
>       sipxInitialize(&hInst2, 6060, 6060, -1, 10000);
>       sipxEventListenerAdd(hInst2, EventCallBack2, NULL);
>
>         sipxConfigSetOutboundProxy(hInst2, "192.168.0.88");
>
>       sipxLineAdd(hInst2, "sip:[EMAIL PROTECTED]", &hLine2);
>       sipxLineAddCredential(hLine2, "202", "202", "asterisk");
>
>       sipxCallCreate(hInst2, hLine2, &hCall2);
>       sipxCallConnect(hCall2, "sip:[EMAIL PROTECTED]");
>
>       Sleep(2000);
>
>       printf("Destroy call1...\n");
>       sipxCallDestroy(hCall1);
>       Sleep(1000);
>
>       printf("Finalize inst1...\n");
>       sipxEventListenerRemove(hInst1, EventCallBack1, NULL);
>       sipxUnInitialize(hInst1);
>
>       printf("Destroy call2...\n");
>       sipxCallDestroy(hCall2);
>       Sleep(1000);
>
>       printf("Finalize inst2...\n");
>       sipxEventListenerRemove(hInst2, EventCallBack2, NULL);
>       sipxUnInitialize(hInst2);
>
>       return 0;
> }
>
> --
> Best regards, 
> Alexey [ [EMAIL PROTECTED] ]
>
> _______________________________________________
> sipxtapi-dev mailing list
> [email protected]
> List Archive: http://list.sipfoundry.org/archive/sipxtapi-dev/
>
>   

_______________________________________________
sipxtapi-dev mailing list
[email protected]
List Archive: http://list.sipfoundry.org/archive/sipxtapi-dev/

Reply via email to