Parsing expires from REGISTER reply

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi again,

Have done the debugging.  Here is the fix but remember I'm very new to this code so please scrutinise carefully.   Comments for clarity only, please amend per your normal standards.

The value of expires= on the end of a Contact: header is indeed parsed correctly and placed in the  pjsip_contact_hdr structure.  The problem is in sip_reg.c toward the end of this function where it is discarded and not passed to the callback handler.   This change assumes that any SIP servers that exhibit this behaviour are only going to do so when returning a single Contact: header.  You may know different.

static void tsx_callback(void *token, pjsip_event *event)
{
                :
      :
      :
      V

      }

      /* Increment busy flag temporarily to prevent regc from
       * being destroyed.
       */
      ++regc->busy;

      /* Call callback. */

      /* Change to cope with old SER implementations that append */
      /* expires= to Contact: and do not create Expires: header  */
      /* 20080504 BEGIN -----------------------------------------*/

      /* if (expiration == NOEXP) expiration = -1;               */

      if (expiration == NOEXP)
        expiration = -1;
      else if (expiration == 0 && contact_cnt == 1 && contact[0]->expires > 0)
        expiration = contact[0]->expires;

      /* 20080504 END -------------------------------------------*/

      call_callback(regc, PJ_SUCCESS, tsx->status_code,
                    (rdata ? &rdata->msg_info.msg->line.status.reason
                           : pjsip_get_status_text(tsx->status_code)),
                    rdata, expiration,
                    contact_cnt, contact);

      /* Decrement busy flag */
      --regc->busy;
    }

    /* Delete the record if user destroy regc during the callback. */
    if (regc->_delete_flag && regc->busy==0) {
      pjsip_regc_destroy(regc);
    }
}

Please let me know if you think this will screw up other implementations.

Best Regards,
Alan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20080504/d8a462dd/attachment.html 


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux