diff --git a/gui/dsiprouter.py b/gui/dsiprouter.py index dd38a187..9d513cdd 100755 --- a/gui/dsiprouter.py +++ b/gui/dsiprouter.py @@ -757,6 +757,7 @@ def displayInboundMapping(): if len(settings.FLOWROUTE_ACCESS_KEY) > 0 and len(settings.FLOWROUTE_SECRET_KEY) > 0: try: dids = numbers_api.getNumbers() + # print("The did's returned: {}".format(dids)) except http_exceptions.HTTPException as ex: debugException(ex) return showError(type="http", code=ex.code, msg="Flowroute Credentials Not Valid") diff --git a/gui/modules/flowroute/__init__.py b/gui/modules/flowroute/__init__.py index 521f0143..808d7d4d 100644 --- a/gui/modules/flowroute/__init__.py +++ b/gui/modules/flowroute/__init__.py @@ -16,7 +16,7 @@ def __del__(self): self.auth = None self.api_url = None - def getNumbers(self, starts_with=None, contains=None, ends_with=None, limit=1000000, offset=None): + def getNumbers(self, starts_with=None, contains=None, ends_with=None, limit=1000000, offset=None, alias=None): """ Get flowroute DID's associated with accnt @@ -33,8 +33,23 @@ def getNumbers(self, starts_with=None, contains=None, ends_with=None, limit=1000 'contains': contains, 'ends_with': ends_with, 'limit': limit, - 'offset': offset + 'offset': offset, } + + # Default is to show unassigned numbers by setting alias to None + if alias is not None: + # Search for a particular alias + if len(alias) > 0: + payload['alias'] = alias + # Show all numbers + if alias == " " or alias == "": + pass + resp = requests.get(self.api_url, auth=self.auth, params=payload) resp.raise_for_status() - return [num['attributes']['value'] for num in resp.json()['data']] + if alias == None: # Show unassigned numbers + print("look for empty space") + return [num['attributes']['value'] for num in resp.json()['data'] if num['attributes']['alias'] == None] + else: + return [num['attributes']['value'] for num in resp.json()['data']] + \ No newline at end of file diff --git a/gui/static/js/inboundmapping.js b/gui/static/js/inboundmapping.js index 105a3ec8..5dcf4333 100644 --- a/gui/static/js/inboundmapping.js +++ b/gui/static/js/inboundmapping.js @@ -5,13 +5,13 @@ * @global window scope * @namespace aria */ - var aria = aria || {}; + /* var aria = aria || {}; */ /** * @global script scope * @type {Array} */ - var DID_LIST = DID_LIST || []; + /*var DID_LIST = DID_LIST || []; */ /** * Search DID_LIST for search_string diff --git a/gui/templates/inboundmapping.html b/gui/templates/inboundmapping.html index 260d871d..d74aee48 100644 --- a/gui/templates/inboundmapping.html +++ b/gui/templates/inboundmapping.html @@ -487,8 +487,9 @@