Hi Daniel,
It worked awesomely. The link errors went away after I manually added those files.
I am now trying to run my application, and I have hit a road block here.
I am trying to register my SIP extension to asterisk and I get the LINESTATE_PROVISIONED and LINESTATE_REGISTERING messages, but followed by LINESTATE_REGISTER_FAILED::LINESTATE_REGISTER_TIMEOUT.
I have done a network trace using ethereal and below are the request/responses sent from/to my machine:
REGISTER sip:172.28.43.120 SIP/2.0
Call-Id: 233853b38c580267c7cdf9a3e359fc15
Cseq: 101 REGISTER
Expires: 180
Date: Fri, 17 Aug 2012 07:20:48 GMT
Max-Forwards: 70
User-Agent: BhaSIP (WinNT)
Supported: replaces
Via: SIP/2.0/UDP 172.28.43.62;branch=z9hG4bK-b26b7f995d39
Content-Length: 0
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 172.28.43.62;branch=z9hG4bK-b26b7f995d39;received=172.28.43.62;rport=63777
Call-ID: 233853b38c580267c7cdf9a3e359fc15
CSeq: 101 REGISTER
Server: Asterisk PBX 1.8.13.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="239b08ec"
Content-Length: 0
REGISTER sip:172.28.43.120 SIP/2.0
Call-Id: 233853b38c580267c7cdf9a3e359fc15
Cseq: 101 REGISTER
Expires: 180
Date: Fri, 17 Aug 2012 07:20:48 GMT
Max-Forwards: 70
User-Agent: BhaSIP (WinNT)
Supported: replaces
Via: SIP/2.0/UDP 172.28.43.62;branch=z9hG4bK-b26b7f995d39
Content-Length: 0
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 172.28.43.62;branch=z9hG4bK-b26b7f995d39;received=172.28.43.62;rport=49880
Call-ID: 233853b38c580267c7cdf9a3e359fc15
CSeq: 101 REGISTER
Server: Asterisk PBX 1.8.13.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="239b08ec"
Content-Length: 0
REGISTER sip:172.28.43.120 SIP/2.0
Call-Id: 233853b38c580267c7cdf9a3e359fc15
Cseq: 101 REGISTER
Expires: 180
Date: Fri, 17 Aug 2012 07:20:48 GMT
Max-Forwards: 70
User-Agent: BhaSIP (WinNT)
Supported: replaces
Via: SIP/2.0/UDP 172.28.43.62;branch=z9hG4bK-b26b7f995d39
Content-Length: 0
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 172.28.43.62;branch=z9hG4bK-b26b7f995d39;received=172.28.43.62;rport=49881
Call-ID: 233853b38c580267c7cdf9a3e359fc15
CSeq: 101 REGISTER
Server: Asterisk PBX 1.8.13.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="239b08ec"
Content-Length: 0
REGISTER sip:172.28.43.120 SIP/2.0
Call-Id: 233853b38c580267c7cdf9a3e359fc15
Cseq: 101 REGISTER
Expires: 180
Date: Fri, 17 Aug 2012 07:20:48 GMT
Max-Forwards: 70
User-Agent: BhaSIP (WinNT)
Supported: replaces
Via: SIP/2.0/UDP 172.28.43.62;branch=z9hG4bK-b26b7f995d39
Content-Length: 0
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 172.28.43.62;branch=z9hG4bK-b26b7f995d39;received=172.28.43.62;rport=49882
Call-ID: 233853b38c580267c7cdf9a3e359fc15
CSeq: 101 REGISTER
Server: Asterisk PBX 1.8.13.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="239b08ec"
Content-Length: 0
Below is the code I have in place:
void SipXConnector::Initialize(char * outboundProxy)
{
//This mehtod returns values of type SIPX_RESULT
//TODO: Check the return value and update.
SIPX_RESULT sipXresult = sipxInitialize(&sipXinstance,
DEFAULT_UDP_PORT,
DEFAULT_TCP_PORT,
DEFAULT_TLS_PORT,
DEFAULT_RTP_START_PORT,
DEFAULT_CONNECTIONS,
DEFAULT_IDENTITY,
DEFAULT_BIND_ADDRESS,
0);
sipxConfigSetUserAgentName(sipXinstance, "BhaSIP", true);
sipxEventListenerAdd(sipXinstance, SipCallbackProc, this);
sipxConfigSetOutboundProxy(sipXinstance, outboundProxy);
sipxConfigSetRegisterExpiration(sipXinstance, 180);
}
void SipXConnector::Register(char * sipUri, char * userName, char * password, char * realm)
{
if(sipXinstance != NULL)
{
//All of these mehtods returns values of type SIPX_RESULT
//TODO: Check the return value and update.
sipxLineAdd(sipXinstance, sipUri, &sipXline);
sipxLineAddCredential(sipXline, userName, password, realm);
sipxLineRegister(sipXline, true);
}
}
void SipXConnector::InitUnRegister()
{
sipxLineRegister(sipXline, false);
}
void SipXConnector::UnRegister()
{
sipxLineRemove(sipXline);
sipXline = 0;
if(sipxUnInitialize(sipXinstance)!= SIPX_RESULT_SUCCESS)
{
sipxUnInitialize(sipXinstance, true);
}
sipXinstance = 0;
}
bool SipXConnector::SipCallbackProc(SIPX_EVENT_CATEGORY eventCategory, void* pInfo, void* pUserData)
{
switch (eventCategory)
{
case EVENT_CATEGORY_LINESTATE:
return SipXConnector::getInstance()->HandleLineStateEvent(pInfo);
break;
case EVENT_CATEGORY_CALLSTATE:
return SipXConnector::getInstance()->HandleCallStateEvent(pInfo);
break;
default:
return false;
}
return true;
}
bool SipXConnector::HandleLineStateEvent(void* pInfo)
{
SIPX_LINESTATE_INFO *pLineInfo = (SIPX_LINESTATE_INFO *)pInfo;
char szEventDesc[128];
sipxEventToString(EVENT_CATEGORY_LINESTATE, pInfo, szEventDesc, sizeof(szEventDesc));
cout<<"\n\n"<<szEventDesc<<"\n\n";
switch(pLineInfo->event)
{
case LINESTATE_UNKNOWN:
cout<<"Line State Unknown.....!\n\n";
break;
case LINESTATE_REGISTERING:
cout<<"Line State Registering.....!\n\n";
break;
case LINESTATE_REGISTERED:
cout<<"Line State Registered.....!\n\n";
break;
case LINESTATE_UNREGISTERING:
cout<<"Line State Unregistering...\n\n";
break;
case LINESTATE_UNREGISTERED:
cout<<"Line State Unregistered....!\n\n";
UnRegister();
break;
case LINESTATE_REGISTER_FAILED:
cout<<"Line State Register Failed......!\n\n";
break;
case LINESTATE_UNREGISTER_FAILED:
cout<<"Line State Unregister Failed.......!\n\n";
break;
case LINESTATE_PROVISIONED:
cout<<"Line State Provisioned.......!\n\n";
break;
}
return true;
}
Thanks for your time and effort! I really appreciate your help on this.
-Bhaskar