<div>Hello,</div><div>The of query you asked me about returns nothing. I mean there are no records in <span style="color:rgb(0,0,0);font-family:Arial,sans-serif;font-size:15px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-transform:none;white-space:normal;background-color:rgb(255,255,255);display:inline !important;float:none;">kamailio.location </span> for the subscriber. There are records for other subscribers and and the create query returns existing id (ot other subscriber) . For current test I created record in <span style="color:rgb(0,0,0);font-family:Arial,sans-serif;font-size:15px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-transform:none;white-space:normal;background-color:rgb(255,255,255);display:inline !important;float:none;">kamailio.location </span>with ID 124 (I cheked it ddirectly id DB) but API returned ID 119, it belongs to other subscriber.</div><div> </div><div>The API log looks as following:</div><div><div>Mar 28 14:44:02 stest ngcp-panel: INFO: IP=77.77.77.77 CALLED=API[POST]/api/subscriberregistrations/ TX=14B01FFB707D8200 USER=administrator DATA={} MSG="" LOG="{"subscriber_id":43,"contact":"sip:myTrunkName@77.77.99.99:5060","q":1,"expires":"1969-12-31 19:00:00"}"</div><div> </div><div>Thank you</div><div> </div></div><div><br /></div><div><br /></div><div>28.03.2017, 21:10, "Irina Peshinskaya" <ipeshinskaya@sipwise.com>:</div><blockquote type="cite">
<div 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 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><br />
select * from kamailio.location where contact
=<a 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 href="https://myVoipServer:1443/api/subscriberregistrations/">https://myVoipServer:1443/api/subscriberregistrations/</a> </div>
<div>with following data:</div>
<div>{"subscriber_id":12,"contact":<a href="mailto:sip:myTrunkName@77.77.77.77:5060">"sip:myTrunkName@77.77.77.77:5060"</a>,"q":1,"expires":"<span>1969-12-31</span>
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 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 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></fieldset>
<br />
<pre wrap="">_______________________________________________
Spce-user mailing list
<a href="mailto:Spce-user@lists.sipwise.com">Spce-user@lists.sipwise.com</a>
<a href="https://lists.sipwise.com/listinfo/spce-user">https://lists.sipwise.com/listinfo/spce-user</a>
</pre>
</blockquote>
<br />
</div>
</blockquote>