sipxUninitialize does not unregister

20 views
Skip to first unread message

Bhaskar Raghavendran

unread,
Aug 8, 2012, 8:18:06 AM8/8/12
to si...@googlegroups.com

Hi,

I am playing around with the sample apps, both sipXezphone and wxCommunicator. In both the apps, on Application exit calls sipxUninitialize() method. But when this is called, the sip extension is not unregistered from the server (I am using Asterisk).

Can anybody throw some light on this?

Thanks!

Daniel Petrie

unread,
Aug 8, 2012, 11:03:10 AM8/8/12
to si...@googlegroups.com, bhaskar.ra...@gmail.com

Hi Bhaskar:
That is a great question. The way that you unregister a line is by calling:
sipxLineRegister(lineHandle, false)
The application then should wait for the

Sent from my Android Xoom

Daniel Petrie

unread,
Aug 8, 2012, 11:15:16 AM8/8/12
to si...@googlegroups.com, bhaskar.ra...@gmail.com
Sorry, sent before completing my response ...

The way that you unregister a line is by calling:
sipxLineRegister(lineHandle, false)
The application then should wait for the LINESTATE_UNREGISTERED or LINESTATE_UNREGISTER_FAILED events before calling sipxUninitialize.

The unregister is not implicitly done in the sipxUninitialize as this could potentially block for up to a SIP transaction time out (30+ seconds) while the unREGISTER messages are sent, resent and the transaction times out.  That can seem like a really long time to the user waiting for the application to shutdown.  Also in some cases the application may not want the lines to be unregistered.  By using the separate sipxLineRegister method, the application can decide how long it wants to wait before shutting down.

Cheers,
Dan


From: Daniel Petrie <dpe...@sipez.com>
To: "si...@googlegroups.com" <si...@googlegroups.com>; "bhaskar.ra...@gmail.com" <bhaskar.ra...@gmail.com>
Sent: Wednesday, August 8, 2012 11:03 AM
Subject: Re: [sipX UA] sipxUninitialize does not unregister

Bhaskar Raghavendran

unread,
Aug 10, 2012, 2:05:53 AM8/10/12
to Daniel Petrie, si...@googlegroups.com
Hi Daniel,

I did try to wait for LINESTATE_UNREGISTERED / LINESTATE_UNREGISTER_FAILED, but every time  sipxLineRegister(lineHandle, false)  is called, I keep getting LINESTATE_UNREGISTERING immediately followed by LINESTATE_REGISTERING and LINESTATE_REGISTERED.

I am putting my application to sleep for about a minute to see if I receive  LINESTATE_UNREGISTERED  /  LINESTATE_UNREGISTER_FAILED, but unable to see any.

Please shed light on this!
Thanks!

SipXRookie

unread,
Aug 14, 2012, 3:19:57 AM8/14/12
to si...@googlegroups.com, Daniel Petrie, si...@googlegroups.com
Hello,

Can somebody throw any light on this?

Thanks!


On Friday, August 10, 2012 11:35:53 AM UTC+5:30, SipXRookie wrote:
Hi Daniel,

I did try to wait for LINESTATE_UNREGISTERED / LINESTATE_UNREGISTER_FAILED, but every time  sipxLineRegister(lineHandle, false)  is called, I keep getting LINESTATE_UNREGISTERING immediately followed by LINESTATE_REGISTERING and LINESTATE_REGISTERED.

I am putting my application to sleep for about a minute to see if I receive  LINESTATE_UNREGISTERED  /  LINESTATE_UNREGISTER_FAILED, but unable to see any.

Please shed light on this!
Thanks!

On Wed, Aug 8, 2012 at 8:45 PM, Daniel Petrie <dpe...@sipez.com> wrote:
Sorry, sent before completing my response ...

The way that you unregister a line is by calling:
sipxLineRegister(lineHandle, false)
The application then should wait for the LINESTATE_UNREGISTERED or LINESTATE_UNREGISTER_FAILED events before calling sipxUninitialize.

The unregister is not implicitly done in the sipxUninitialize as this could potentially block for up to a SIP transaction time out (30+ seconds) while the unREGISTER messages are sent, resent and the transaction times out.  That can seem like a really long time to the user waiting for the application to shutdown.  Also in some cases the application may not want the lines to be unregistered.  By using the separate sipxLineRegister method, the application can decide how long it wants to wait before shutting down.

Cheers,
Dan


From: Daniel Petrie <dpe...@sipez.com>
Sent: Wednesday, August 8, 2012 11:03 AM
Subject: Re: [sipX UA] sipxUninitialize does not unregister

Daniel Petrie

unread,
Aug 14, 2012, 9:35:20 AM8/14/12
to si...@googlegroups.com, bhaskar.ra...@gmail.com, si...@googlegroups.com

What subversion branch (URL e.g. svn info) are you using? This sounds like a bug unless something else is also calling sipxLineRegister(lineHandle,true)

Cheers,
Dan

Sent from my Droid 3

From: SipXRookie ;
To: ;
Cc: Daniel Petrie ; ;
Subject: Re: [sipX UA] sipxUninitialize does not unregister
Sent: Tue, Aug 14, 2012 7:19:57 AM

Hello,

Can somebody throw any light on this?

Thanks!

On Friday, August 10, 2012 11:35:53 AM UTC+5:30, SipXRookie wrote:

Hi Daniel,

I did try to wait for LINESTATE_UNREGISTERED / LINESTATE_UNREGISTER_FAILED, but every time  sipxLineRegister(lineHandle, false)  is called, I keep getting LINESTATE_UNREGISTERING immediately followed by LINESTATE_REGISTERING and LINESTATE_REGISTERED.

I am putting my application to sleep for about a minute to see if I receive  LINESTATE_UNREGISTERED  /  LINESTATE_UNREGISTER_FAILED, but unable to see any.

Please shed light on this!

Thanks!

On Wed, Aug 8, 2012 at 8:45 PM, Daniel Petrie wrote:

Sorry, sent before completing my response ...

The way that you unregister a line is by calling:

sipxLineRegister(lineHandle, false)

The application then should wait for the LINESTATE_UNREGISTERED or LINESTATE_UNREGISTER_FAILED events before calling sipxUninitialize.

The unregister is not implicitly done in the sipxUninitialize as this could potentially block for up to a SIP transaction time out (30+ seconds) while the unREGISTER messages are sent, resent and the transaction times out.  That can seem like a really long time to the user waiting for the application to shutdown.  Also in some cases the application may not want the lines to be unregistered.  By using the separate sipxLineRegister method, the application can decide how long it wants to wait before shutting down.

Cheers,

Dan

Bhaskar Raghavendran

unread,
Aug 14, 2012, 9:42:31 AM8/14/12
to si...@googlegroups.com
Hi,

I am using the code base from the Google code:  http://sipxtapi.googlecode.com/svn/trunk/  

The version of sipxtapi is 3.2.

Does the sipxConfigSetRegisterExpiration(sipXinstance, 60) implicitly call sipxLineRegister? But then, it should only call it after 60 secs, shouldn't it?

The LINESTATE_REGISTERING and LINESTATE_REGISTERED is called immediately after LINESTATE_UNREGISTERING. Its bothering a little since I am unable to Logout!

Thanks!

Daniel Petrie

unread,
Aug 15, 2012, 11:51:38 AM8/15/12
to si...@googlegroups.com
Sorry, SIPez only maintains the original branch of the sipX code:

The svn repo you are using was forked off many years ago.  I do not know who if anyone still maintains it.  sipxConfigSetRegisterExpiration should not implicitly start registrations, but I do not know what that fork of the code does or how it has changed.

I recommend you try checking out http://scm.sipfoundry.org/rep/sipX/main/

Cheers,
Dan



From: Bhaskar Raghavendran <bhaskar.ra...@gmail.com>
To: si...@googlegroups.com
Sent: Tuesday, August 14, 2012 9:42 AM

Bhaskar Raghavendran

unread,
Aug 16, 2012, 4:10:12 AM8/16/12
to si...@googlegroups.com
Hi,

I have tried to compile the code checked out from the http://scm.sipfoundry.org/rep/sipX/main/. I have also followed the build instructions from this link http://sipxtapi.sipfoundry.org/wiki/SipXtapi_Windows_Build_Environment.

However, I seem to be getting the following errors. I am not sure how to get them fixed.

Error 27 error C3861: 'atoll': identifier not found c:\DDrive\Asterisk\SipXTapi\sipXtackLib\src\net\SdpBody.cpp 2983

Error 52 error C2668: 'log' : ambiguous call to overloaded function c:\DDrive\Asterisk\SipXTapi\sipXcallLib\src\cp\CpPeerCall.cpp 2705

Error 58 error C2065: 'MpAudioWaveFileRead' : undeclared identifier c:\DDrive\Asterisk\SipXTapi\sipXmediaLib\src\mp\MpAudioUtils.cpp 411

Error 59 error C2146: syntax error : missing ';' before identifier 'reader' c:\DDrive\Asterisk\SipXTapi\sipXmediaLib\src\mp\MpAudioUtils.cpp 411

Error 60 error C3861: 'reader': identifier not found c:\DDrive\Asterisk\SipXTapi\sipXmediaLib\src\mp\MpAudioUtils.cpp 411

Error 61 error C2228: left of '.getDecompressionType' must have class/struct/union c:\DDrive\Asterisk\SipXTapi\sipXmediaLib\src\mp\MpAudioUtils.cpp 412

Error 62 error C2228: left of '.readBytes' must have class/struct/union c:\DDrive\Asterisk\SipXTapi\sipXmediaLib\src\mp\MpAudioUtils.cpp 427

Error 63 fatal error LNK1181: cannot open input file '.\debug\sipxcalllib.lib' sipXtapi


In need of guidance.

Thanks!

Bhaskar Raghavendran

unread,
Aug 16, 2012, 8:40:14 AM8/16/12
to si...@googlegroups.com
I tried to edit a line or two in couple of header files. The error messages went away. But I got link errors while building the sipxtapi project. All the libraries are being generated except for the sipxtapi.dll. Below are the linker errors:

Error 2 error LNK2019: unresolved external symbol "public: void __thiscall MiStringNotf::getValue(class UtlString &)const " (?getValue@MiStringNotf@@QBEXAAVUtlString@@@Z) referenced in function "protected: virtual int __thiscall CpPeerCall::handleMiNotificationMessage(class MiNotification &)" (?handleMiNotificationMessage@CpPeerCall@@MAEHAAVMiNotification@@@Z) sipxcalllib.lib

Error 3 error LNK2001: unresolved external symbol "public: virtual __thiscall UtlCopyableContainable::~UtlCopyableContainable(void)" (??1UtlCopyableContainable@@UAE@XZ) sipxportlib.lib

Error 4 error LNK2001: unresolved external symbol "public: virtual __thiscall UtlCopyableContainable::~UtlCopyableContainable(void)" (??1UtlCopyableContainable@@UAE@XZ) sipxsdplib.lib

Error 5 error LNK2001: unresolved external symbol "public: virtual __thiscall UtlCopyableContainable::~UtlCopyableContainable(void)" (??1UtlCopyableContainable@@UAE@XZ) sipxsdplib.lib

Error 6 error LNK2001: unresolved external symbol "public: virtual __thiscall UtlCopyableContainable::~UtlCopyableContainable(void)" (??1UtlCopyableContainable@@UAE@XZ) sipxportlib.lib

Error 7 error LNK2001: unresolved external symbol "public: virtual __thiscall UtlCopyableContainable::~UtlCopyableContainable(void)" (??1UtlCopyableContainable@@UAE@XZ) sipxportlib.lib

Error 8 error LNK2019: unresolved external symbol "public: virtual __thiscall UtlCopyableContainable::~UtlCopyableContainable(void)" (??1UtlCopyableContainable@@UAE@XZ) referenced in function __unwindfunclet$??0SdpConnection@SdpMediaLine@@QAE@W4SdpNetType@Sdp@@W4SdpAddressType@3@PBDII@Z$0 sipxtacklib.lib

Error 9 error LNK2001: unresolved external symbol "public: virtual __thiscall UtlCopyableContainable::~UtlCopyableContainable(void)" (??1UtlCopyableContainable@@UAE@XZ) sipxtacklib.lib

Error 10 error LNK2001: unresolved external symbol "public: virtual __thiscall UtlCopyableContainable::~UtlCopyableContainable(void)" (??1UtlCopyableContainable@@UAE@XZ) sipxsdplib.lib

Error 11 error LNK2001: unresolved external symbol "public: virtual __thiscall UtlCopyableContainable::~UtlCopyableContainable(void)" (??1UtlCopyableContainable@@UAE@XZ) sipxsdplib.lib

Error 12 error LNK2001: unresolved external symbol "public: __thiscall UtlCopyableContainable::UtlCopyableContainable(void)" (??0UtlCopyableContainable@@QAE@XZ) sipxportlib.lib

Error 13 error LNK2001: unresolved external symbol "public: __thiscall UtlCopyableContainable::UtlCopyableContainable(void)" (??0UtlCopyableContainable@@QAE@XZ) sipxsdplib.lib

Error 14 error LNK2001: unresolved external symbol "public: __thiscall UtlCopyableContainable::UtlCopyableContainable(void)" (??0UtlCopyableContainable@@QAE@XZ) sipxsdplib.lib

Error 15 error LNK2001: unresolved external symbol "public: __thiscall UtlCopyableContainable::UtlCopyableContainable(void)" (??0UtlCopyableContainable@@QAE@XZ) sipxportlib.lib

Error 16 error LNK2001: unresolved external symbol "public: __thiscall UtlCopyableContainable::UtlCopyableContainable(void)" (??0UtlCopyableContainable@@QAE@XZ) sipxportlib.lib

Error 17 error LNK2019: unresolved external symbol "public: __thiscall UtlCopyableContainable::UtlCopyableContainable(void)" (??0UtlCopyableContainable@@QAE@XZ) referenced in function "public: __thiscall SdpMediaLine::SdpConnection::SdpConnection(enum Sdp::SdpNetType,enum Sdp::SdpAddressType,char const *,unsigned int,unsigned int)" (??0SdpConnection@SdpMediaLine@@QAE@W4SdpNetType@Sdp@@W4SdpAddressType@3@PBDII@Z) sipxtacklib.lib

Error 18 error LNK2001: unresolved external symbol "public: __thiscall UtlCopyableContainable::UtlCopyableContainable(void)" (??0UtlCopyableContainable@@QAE@XZ) sipxtacklib.lib

Error 19 error LNK2001: unresolved external symbol "public: __thiscall UtlCopyableContainable::UtlCopyableContainable(void)" (??0UtlCopyableContainable@@QAE@XZ) sipxsdplib.lib

Error 20 error LNK2001: unresolved external symbol "public: __thiscall UtlCopyableContainable::UtlCopyableContainable(void)" (??0UtlCopyableContainable@@QAE@XZ) sipxsdplib.lib

Error 21 error LNK2001: unresolved external symbol "public: virtual int __thiscall UtlCopyableContainable::isInstanceOf(char const * const)const " (?isInstanceOf@UtlCopyableContainable@@UBEHQBD@Z) sipxportlib.lib

Error 22 error LNK2001: unresolved external symbol "public: virtual int __thiscall UtlCopyableContainable::isInstanceOf(char const * const)const " (?isInstanceOf@UtlCopyableContainable@@UBEHQBD@Z) sipxsdplib.lib

Error 23 error LNK2001: unresolved external symbol "public: virtual int __thiscall UtlCopyableContainable::isInstanceOf(char const * const)const " (?isInstanceOf@UtlCopyableContainable@@UBEHQBD@Z) sipxsdplib.lib

Error 24 error LNK2001: unresolved external symbol "public: virtual int __thiscall UtlCopyableContainable::isInstanceOf(char const * const)const " (?isInstanceOf@UtlCopyableContainable@@UBEHQBD@Z) sipxportlib.lib

Error 25 error LNK2001: unresolved external symbol "public: virtual int __thiscall UtlCopyableContainable::isInstanceOf(char const * const)const " (?isInstanceOf@UtlCopyableContainable@@UBEHQBD@Z) sipxportlib.lib

Error 26 error LNK2001: unresolved external symbol "public: virtual int __thiscall UtlCopyableContainable::isInstanceOf(char const * const)const " (?isInstanceOf@UtlCopyableContainable@@UBEHQBD@Z) sipxtacklib.lib

Error 27 error LNK2001: unresolved external symbol "public: virtual int __thiscall UtlCopyableContainable::isInstanceOf(char const * const)const " (?isInstanceOf@UtlCopyableContainable@@UBEHQBD@Z) sipxtacklib.lib

Error 28 error LNK2001: unresolved external symbol "public: virtual int __thiscall UtlCopyableContainable::isInstanceOf(char const * const)const " (?isInstanceOf@UtlCopyableContainable@@UBEHQBD@Z) sipxsdplib.lib

Error 29 error LNK2001: unresolved external symbol "public: virtual int __thiscall UtlCopyableContainable::isInstanceOf(char const * const)const " (?isInstanceOf@UtlCopyableContainable@@UBEHQBD@Z) sipxsdplib.lib

Error 30 error LNK2001: unresolved external symbol "public: static char const * const UtlCopyableContainable::TYPE" (?TYPE@UtlCopyableContainable@@2QBDB) sipxportlib.lib

Error 31 error LNK2019: unresolved external symbol "public: virtual __thiscall MiStringNotf::~MiStringNotf(void)" (??1MiStringNotf@@UAE@XZ) referenced in function "public: virtual enum OsStatus __thiscall MaNotfTranslatorDispatcher::post(class OsMsg const &)" (?post@MaNotfTranslatorDispatcher@@UAE?AW4OsStatus@@ABVOsMsg@@@Z) sipxmediaadapterlib.lib

Error 32 error LNK2019: unresolved external symbol "public: __thiscall MiStringNotf::MiStringNotf(enum MiNotification::NotfType,class UtlString const &,class UtlString const &,int,int)" (??0MiStringNotf@@QAE@W4NotfType@MiNotification@@ABVUtlString@@1HH@Z) referenced in function "public: virtual enum OsStatus __thiscall MaNotfTranslatorDispatcher::post(class OsMsg const &)" (?post@MaNotfTranslatorDispatcher@@UAE?AW4OsStatus@@ABVOsMsg@@@Z) sipxmediaadapterlib.lib

Error 33 error LNK2019: unresolved external symbol "public: void __thiscall MprnStringMsg::getValue(class UtlString &)const " (?getValue@MprnStringMsg@@QBEXAAVUtlString@@@Z) referenced in function "public: virtual enum OsStatus __thiscall MaNotfTranslatorDispatcher::post(class OsMsg const &)" (?post@MaNotfTranslatorDispatcher@@UAE?AW4OsStatus@@ABVOsMsg@@@Z) sipxmediaadapterlib.lib

Error 34 fatal error LNK1120: 8 unresolved externals bin\sipXtapid.dll

Phew!!! I am not sure what is it that I am missing/doing wrong. Need help urgently.

Thanks!

Daniel Petrie

unread,
Aug 16, 2012, 5:19:37 PM8/16/12
to si...@googlegroups.com, Bhaskar Raghavendran
Hi Bhaskar:
It looks like some of the WIndows MSVC project files have not been updated to include a few new files.

interface/MiStringNotf.cpp needs to be added to sipXmediaAdapterLib-msvc8.vcproj 

src/utl/UtlCopyableContainable.cpp needs to be added to sipXportLib-msvc8.vcproj

src/mp/MprnStringMsg.cpp needs to be added to sipXmediaLib-msvc8.vcproj

This should resolve most if not all of the undefines you are getting.

Cheers,
Dan


From: Bhaskar Raghavendran <bhaskar.ra...@gmail.com>
To: si...@googlegroups.com
Sent: Thursday, August 16, 2012 8:40 AM

Daniel Petrie

unread,
Aug 16, 2012, 5:47:04 PM8/16/12
to si...@googlegroups.com, Bhaskar Raghavendran
I just checked in fixes to those MSVC8 project files.  You should be able to just do an svn update to get the fixes.

Cheers,
Dan

Cc: Bhaskar Raghavendran <bhaskar.ra...@gmail.com>
Sent: Thursday, August 16, 2012 5:19 PM

Bhaskar Raghavendran

unread,
Aug 17, 2012, 3:27:58 AM8/17/12
to si...@googlegroups.com
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
From: sip:20...@172.28.43.120;tag=5a9f5fe9
Call-Id: 233853b38c580267c7cdf9a3e359fc15
Cseq: 101 REGISTER
Contact: <sip:20...@172.28.43.62;LINEID=5ff461bc24dc>
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
From: sip:20...@172.28.43.120;tag=5a9f5fe9
To: sip:20...@172.28.43.120;tag=as506ef665
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
From: sip:20...@172.28.43.120;tag=5a9f5fe9
Call-Id: 233853b38c580267c7cdf9a3e359fc15
Cseq: 101 REGISTER
Contact: <sip:20...@172.28.43.62;LINEID=5ff461bc24dc>
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
From: sip:20...@172.28.43.120;tag=5a9f5fe9
To: sip:20...@172.28.43.120;tag=as506ef665
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
From: sip:20...@172.28.43.120;tag=5a9f5fe9
Call-Id: 233853b38c580267c7cdf9a3e359fc15
Cseq: 101 REGISTER
Contact: <sip:20...@172.28.43.62;LINEID=5ff461bc24dc>
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
From: sip:20...@172.28.43.120;tag=5a9f5fe9
To: sip:20...@172.28.43.120;tag=as506ef665
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
From: sip:20...@172.28.43.120;tag=5a9f5fe9
Call-Id: 233853b38c580267c7cdf9a3e359fc15
Cseq: 101 REGISTER
Contact: <sip:20...@172.28.43.62;LINEID=5ff461bc24dc>
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
From: sip:20...@172.28.43.120;tag=5a9f5fe9
To: sip:20...@172.28.43.120;tag=as506ef665
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

Daniel Petrie

unread,
Aug 17, 2012, 10:03:53 AM8/17/12
to si...@googlegroups.com, bhaskar.ra...@gmail.com

Hi Bhaskar:
It looks like sipX never gets the REGISTER response. The odd thing that I see in the response is that the via contains an rport parameter. Asterisk should not do this unless there is an rport parameter in the request. I am going to guess that Asterisk is also sending the response to the wrong port 6377. It should be sending the REGISTER response to port 5060 per the request via. Can you confirm in your ethereal capture?

You may be able to work around this Asterisk problem in sipX by turning on symmetric signalling.

Cheers,
Dan


Sent from my Droid 3


From: Bhaskar Raghavendran <bhaskar.ra...@gmail.com>;
Subject: Re: [sipX UA] sipxUninitialize does not unregister
Sent: Fri, Aug 17, 2012 7:27:58 AM
Reply all
Reply to author
Forward
0 new messages