Hi,

This is a lot cleaner fix and avoids the crash. However I still have problems 
using it on a LAN, I'm not sure if it's a problem of OnDO or otherwise.

Around line number 1830 in SipUserAgent.cpp I added the following lines:

// If we have a request for this incoming response
// Forward it on to interested applications
if (   request
 && (shouldDispatch || delayedDispatchMessage))  
{
   UtlString method;
   request->getRequestMethod(&method);
   if(method.compareTo ("MESSAGE") == 0) //Check added by logan
   {
       break;
   }
...
}

Thanks,
Hitesh

  ----- Original Message ----- 
  From: logan 
  To: Andrzej Ciarkowski 
  Cc: [email protected] 
  Sent: Thursday, February 22, 2007 12:45 AM
  Subject: Re: [sipxtapi-dev] Problems in using SipPimClient (SIPSIMPLEmessage)


  Hi,

  Andrzej, thanks a ton for looking into the matter :).

  I added the following checks to line number 1821 in SipUserAgent.cpp:

  if (   request
         && (shouldDispatch || delayedDispatchMessage)
         && delayedResponseCode != 404
         && delayedResponseCode != 415 
         && delayedResponseCode != 407 
         && delayedResponseCode != -1)          
  {
  ...
  }

  Sure, it's a pathetic hack :(, but it seems to avoid the crash. And now I'm 
able to send/receive messages across freeworlddialup.com and other servers (I 
still have problems when I try this against Brekeke on a LAN). I guess till a 
proper solution is found I will have to persist with this only.

  Thanks,
  Hitesh
    ----- Original Message ----- 
    From: Andrzej Ciarkowski 
    To: logan 
    Cc: [email protected] 
    Sent: Wednesday, February 21, 2007 1:30 PM
    Subject: Re[2]: [sipxtapi-dev] Problems in using SipPimClient (SIPSIMPLE 
message)


    Hello,

    I see is SipPimClient code, that sendPagerMessage() creates its own message 
queue which is used for receiving the response. It seems that after receiving 
some response which triggers completion of sendPagerMessage() and destruction 
of the message queue, SipUserAgent receives some message which it "thinks" is 
another response to your MESSAGE. I wonder if this is related somehow to the 
fact that both the sent and received MESSAGE have the same Call-Id? 




    Regards,

    Andrzej Ciarkowski




          >
         Hi,



          I'm able to recieve messages but when I try sending one then the 
application crashes at the following line:



          if (!mbShuttingDown)

          {

           responseQ->send(eventMsg); //<---Crashes here, line 1851, 
SipUserAgent.cpp

          }



          Below is the call stack:



          sipXtapid.dll!SipUserAgent::dispatch(SipMessage * message=0x01c5ead8, 
int messageType=0, SIPX_TRANSPORT_DATA * pTransport=0x00000000)  Line 1851 + 
0x14 C++

          sipXtapid.dll!SipClient::run(void * runArg=0x00000000)  Line 468 + 
0x27 C++

          sipXtapid.dll!OsTaskWnt::threadEntry(void * arg=0x01c5e3f8)  Line 587 
+ 0x22 C++






          The value of responseQ is shown to be:




          - responseQ 0x0359f124 {mGuard={mMutexImp=??? } mEmpty={mSemImp=??? } 
mFull={mSemImp=??? } ...} OsMsgQShared *

          + OsMsgQBase {DEF_MAX_MSGS=100 DEF_MAX_MSG_LEN=32 
MSGQ_PREFIX={TYPE=0x1037c16c "UtlString" ssNull=0x10375710 "" 
UTLSTRING_NOT_FOUND=4294967295 ...} ...} OsMsgQBase

          + mGuard {mMutexImp=??? } OsMutexWnt

          + mEmpty {mSemImp=??? } OsCSemWnt

          + mFull {mSemImp=??? } OsCSemWnt

          + mDlist {TYPE=0x1037e014 "UtlDList" } UtlDList

           mOptions CXX0030: Error: expression cannot be evaluated int

           mHighCnt CXX0030: Error: expression cannot be evaluated int



          I have attached the Ethereal trace and the log file. The code that 
I'm using is shown below.



          Please help.



          Thanks,

          Hitesh






          class SipPimClientManager

          {

          private:

           SipPimClientManager ()

           {

           }



           static SipPimClient *m_pSipPimClient;



          public:

           static SipPimClient *GetInstance (SipUserAgent &sipUserAgent, Url 
urlFromAddress)

           {

            if (m_pSipPimClient == NULL)

            {

             m_pSipPimClient = new SipPimClient (sipUserAgent, urlFromAddress);

             m_pSipPimClient->start ();



             OsSysLog::add(FAC_SIPXTAPI, PRI_INFO,

              "SipPimClient::GetInstance ()");

            }

            return m_pSipPimClient;

           }

          };

          SipPimClient *SipPimClientManager::m_pSipPimClient = NULL;



          SIPXTAPI_API SIPX_RESULT sipxSendMessage (const SIPX_INST hInst,

                   const char* pszMessageText,

                   const char* pszYourAddress,

                   const char* pszAddressToSend)

          {

               OsSysLog::add(FAC_SIPXTAPI, PRI_INFO,

                      "ENTER sipxSendMessage hInst=%p pszMessageText=%s 
pszYourAddress=%s pszAddressToSend=%s",

                      hInst, pszMessageText, pszYourAddress, pszAddressToSend);



           SIPX_INSTANCE_DATA* pInst = (SIPX_INSTANCE_DATA*) hInst ;



           if (pInst == NULL)

           {

            return SIPX_RESULT_FAILURE;

           }



           int nResponseCode = -1;

           UtlString ustrResponseCodeText;



           SIPX_RESULT rc;



           if (SipPimClientManager::GetInstance (*(pInst->pSipUserAgent), Url 
(pszYourAddress))

            ->sendPagerMessage (Url (pszAddressToSend), pszMessageText, 
"Subject", nResponseCode, ustrResponseCodeText))

           {

            rc = SIPX_RESULT_SUCCESS;

           }

           else

           {

            rc = SIPX_RESULT_FAILURE;

           }



               OsSysLog::add(FAC_SIPXTAPI, PRI_INFO,

                      "EXIT sipxSendMessage nResponseCode=%d 
ustrResponseCodeText=%s",

                      nResponseCode, ustrResponseCodeText.data ());



           return rc;

          }



          SIPXTAPI_API SIPX_RESULT sipxMessageListenerAdd (const SIPX_INST 
hInst,

                 const char* pszFromAddress,

                 void (*textHandler)(const char* pszFromAddress,

                   const char* textMessage,

                   int textLength))

          {

               OsSysLog::add(FAC_SIPXTAPI, PRI_INFO,

                      "ENTER sipxMessageListenerAdd");



           SIPX_RESULT rc = SIPX_RESULT_SUCCESS;



           SIPX_INSTANCE_DATA* pInst = (SIPX_INSTANCE_DATA*) hInst ;



           if (pInst == NULL)

           {

            return SIPX_RESULT_FAILURE;

           }



           SipPimClientManager::GetInstance (*(pInst->pSipUserAgent), Url 
(pszFromAddress))->

            setIncomingImTextHandler (textHandler);



               OsSysLog::add(FAC_SIPXTAPI, PRI_INFO,

            "EXIT sipxMessageListenerAdd");

           return rc;

          }
         















------------------------------------------------------------------------------


  _______________________________________________
  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