<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Dear Ivan,<br>
    SubscriberRegistration code tries to provide the latest id in the
    response, selecting record from the kamailio.location where contact
    is <a class="moz-txt-link-rfc2396E" href="mailto:sip:myTrunkName@77.77.77.77:5060">"sip:myTrunkName@77.77.77.77:5060"</a> and aor =
    subscriber[12].username@subscriber[12].domain.<br>
    <br>
    Before create new record, SubscriberRegistration requests deletion
    of the existent.<br>
    <br>
    Could you please send the result of the query: <br>
    <div class="moz-cite-prefix"><br>
      select * from kamailio.location where contact
      =<a class="moz-txt-link-rfc2396E" href="mailto:sip:myTrunkName@77.77.77.77:5060">"sip:myTrunkName@77.77.77.77:5060"</a>;<br>
      <br>
      ?<br>
      <br>
      Also /var/log/ngcp/api.log file may be useful to understand what
      happened. Could you please share it too?<br>
      <br>
      Best regards,<br>
      Irina Peshinskaya<br>
      <br>
      <br>
      On 27.03.2017 20:41, Иван Иванов wrote:<br>
    </div>
    <blockquote cite="mid:498151490636517@web33g.yandex.ru" type="cite">
      <div>
        <div>
          <div>I got two bugs running API on Sipwise v4.5.3</div>
          <div> </div>
          <div>On creating subscriberregistrations/  (POST request)  the
            API doesn't return me registrations/ ID as it expected, it
            returns</div>
          <div>smallest subscriber registration ID existed in DB
            regardless subscriber ID.</div>
          <div> </div>
          <div>More details</div>
          <div> </div>
          <div>BUG #1.</div>
          <div>I send POST request to create subscriber registrations at
            <a class="moz-txt-link-freetext" href="https://myVoipServer:1443/api/subscriberregistrations/">https://myVoipServer:1443/api/subscriberregistrations/</a>  </div>
          <div>with following data:</div>
          <div>{"subscriber_id":12,"contact":<a class="moz-txt-link-rfc2396E" href="mailto:sip:myTrunkName@77.77.77.77:5060">"sip:myTrunkName@77.77.77.77:5060"</a>,"q":1,"expires":"1969-12-31
            19:00:00"}</div>
          <div>On gettting the request API creates subscriber
            registrations with id 31 (it'c correct) but in API response
            header indicates ID 5.</div>
          <div>Here is the row (part of responded header): Location:
            /api/subscriberregistrations/5 </div>
          <div>All next API calls (to create subscriber registrations)
            will  return same ID equal to 5. So these is no way to get
            actual ID for</div>
          <div>the new  subscriber registration record. This ID is
            required for further record manipulation.</div>
          <div> </div>
          <div>BUG #2. </div>
          <div>If I know the subscriber registration ID and if I need to
            modify it (for example to change IP address) I do calling
            API with</div>
          <div>following PATCH request:</div>
          <div><a class="moz-txt-link-freetext" href="https://myVoipServer:1443/api/subscriberregistrations/31">https://myVoipServer:1443/api/subscriberregistrations/31</a>
            , where 31 is subscriber registration ID (Now I can get it
            with HTML</div>
          <div>interface only) data I send:
[{"op":"replace","path":"/contact","value":<a class="moz-txt-link-rfc2396E" href="mailto:sip:myTrunkName@77.77.77.88:5060">"sip:myTrunkName@77.77.77.88:5060"</a>}]</div>
          <div> </div>
          <div>I expected this will update subscriber registration
            record with new IP but in fact this replace registration
            record with new ID</div>
          <div>(32). This method assigns new ID to subscriber
            registration but it doesn't return it (it's same as in Bug
            #1).</div>
          <div> </div>
          <div>Is there any advises how to resolve these bugs?</div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Spce-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Spce-user@lists.sipwise.com">Spce-user@lists.sipwise.com</a>
<a class="moz-txt-link-freetext" href="https://lists.sipwise.com/listinfo/spce-user">https://lists.sipwise.com/listinfo/spce-user</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>