<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <font size="-1">Hi,<br>
      <br>
      I've been trying to set up Kamailio 4.0.5 as a P-CSCF, I-CSCF and
      S-CSCF today, and hit a few issues which I've fixed.
      <a class="moz-txt-link-freetext" href="http://sip-router.org/contribute/">http://sip-router.org/contribute/</a> suggests that patches should be
      submitted to this list, so here I am.<br>
      <br>
      The first issue I hit was the sem_post issue that has been
      reported from time to time
      (<a class="moz-txt-link-freetext" href="http://lists.kamailio.org/pipermail/sr-users/2013-January/076554.html">http://lists.kamailio.org/pipermail/sr-users/2013-January/076554.html</a>)
      - it looks as though sem_post is only included in -lpthread on
      Ubuntu 12.04, not -lrt
      (<a class="moz-txt-link-freetext" href="https://bugs.launchpad.net/ubuntu/+source/manpages/+bug/874418">https://bugs.launchpad.net/ubuntu/+source/manpages/+bug/874418</a>),
      so I've updated some Makefiles to reflect that.<br>
      <br>
      I subsequently hit a segfault when calling pcscf_save: I've
      tracked this down to a while loop that was missing curly braces,
      and so tried to dereference a null pointer. I think there's
      another bug in this piece of code - because h is NULL at the end
      of the first while loop, we never go round the second loop, and so
      never call free_rr. It looks like even if we did, h->parsed has
      been set to 0 before we try and free it, so nothing would happen.
      I wasn't sure how the memory management here works, though, and so
      haven't tried to change this.<br>
      <br>
      I also found that the ims_auth module didn't handle standard SIP
      Digest authentication on the MAR interface, only AKA and
      Digest-MD5 (which seems to be specific to OpenIMSCore HSS, and not
      mentioned in the IMS specs). Most of the code to allow SIP Digest
      authentication was already there, so I just hooked the last piece
      in to get it to work. I'm not sure whether this counts as a new
      feature or a bugfix - it's not clear whether this was meant to be
      supported but just missing a piece, or not meant to be supported
      but very easy to add in.<br>
      <br>
      Finally, I was working from the 4.0 nightlies Debian repository,
      and the examples/scsf/kamailio.cfg file for 4.0.x seems to skip
      authentication. It looks like this section has been reworked
      heavily in 4.1.0, so this may be less important - but I put
      together a different kamailio.cfg based on a mailing list post
      (<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/pipermail/sr-users/2013-March/077142.html">http://lists.sip-router.org/pipermail/sr-users/2013-March/077142.html</a>),
      and it might make sense to use that as the default file for 4.0.x.<br>
      <br>
      The attached patches are against the 4.0 branch in Git
      (specifically, commit 1b98961522fd8a7eb73ecc7d1772541f8b81aabc).
      I'm happy to apply any feedback which more knowledgeable
      contributors have.<br>
      <br>
      Best regards,<br>
      Rob<br>
    </font>
  </body>
</html>