RestComm / Restcomm-Connect

The Open Source Cloud Communications Platform
http://www.restcomm.com/
GNU Affero General Public License v3.0
244 stars 215 forks source link

IncomingNumbers listing filtered by applicationSid #2608

Open otsakir opened 7 years ago

otsakir commented 7 years ago

Enhance IncomingPhoneNumbers endpoint so that it returns only numbers that are bound to an applicationSid. A new query parameter named 'applicationSid' will be added.

For example, while this will retrieve numbers for account X:

http:/.../Accounts/X/IncomingPhoneNumbers.json

the following will narrow down the results to the numbers that contain a reference to application AP81cf45088cba4abcac1261385916d582 in any of the fields voiceApplicationSid, smsApplicationSid, ussdApplicationSid or referApplicationSid.

http:/.../Accounts/X/IncomingPhoneNumbers.json?applicationSid=X

Implementation

IncomingPhoneNumbersEndpoint.java

Parse applicationSid query parameter and populate IncomingPhoneNumberFilter.

IncomingPhoneNumberFilter.java

Introduce 'applicationSid' member variable

incoming-phone-numbers.xml

Enhance mybatis getIncomingPhoneNumbersByFriendlyName select query to include 'applicationSid' filter attribute in the WHERE clause. Existing query already joins numbers with application tables so changes should minimal there.

jaimecasero commented 7 years ago

since a number and app is a dynamic bidirectional association, it makes sense to provide this as suggested. The implemenation would be obvious anyway.