templates_people_modules_DATA = \
src/templates/people/modules/accounts-list.html \
src/templates/people/modules/accounts-new.html \
+ src/templates/people/modules/agent.html \
src/templates/people/modules/cdr.html \
src/templates/people/modules/channels.html \
src/templates/people/modules/mos.html \
def sip_url(self):
return "%s@ipfire.org" % self.sip_id
+ @lazy_property
+ def agent_status(self):
+ return self.backend.talk.freeswitch.get_agent_status(self)
+
def uses_sip_forwarding(self):
if self.sip_routing_address:
return True
return conferences
+ def get_agent_status(self, account):
+ res = self.db.get("SELECT status FROM agents \
+ WHERE name = %s", account.sip_url)
+
+ if res:
+ return res.status
class SIPRegistration(object):
def __init__(self, freeswitch, data):
--- /dev/null
+{% set status = account.agent_status %}
+
+{% if status %}
+ <div class="card mb-3">
+ <div class="card-body ">
+ <h6 class="card-title">{{ _("Agent Status") }}</h6>
+
+ <p class="card-text">
+ {% if status == "Available" or status == "Available (On Demand)" %}
+ <span class="text-success">
+ <i class="fas fa-phone"></i>
+ {{ _("This agent is currently available") }}
+ </span>
+ {% elif status == "Logged Out" %}
+ <span class="text-danger">
+ <i class="fas fa-phone-slash"></i>
+ {{ _("This agent is currently logged out") }}
+ </span>
+ {% elif status == "On Break" %}
+ <span class="text-warning">
+ <i class="fas fa-coffee"></i>
+ {{ _("This agent is currently on a break") }}
+ </span>
+ {% else %}
+ {{ _("Unknown status: %s") % status }}
+ {% end %}
+ </p>
+ </div>
+ </div>
+{% end %}
{% module Channels(account) %}
+ {% module Agent(account) %}
+
{% module Registrations(account) %}
{% if account.uses_sip_forwarding() %}
# People
"AccountsList" : people.AccountsListModule,
+ "Agent" : people.AgentModule,
"CDR" : people.CDRModule,
"Channels" : people.ChannelsModule,
"MOS" : people.MOSModule,
return self.render_string("people/modules/accounts-list.html", accounts=accounts)
+class AgentModule(ui_modules.UIModule):
+ def render(self, account):
+ return self.render_string("people/modules/agent.html", account=account)
+
+
class CDRModule(ui_modules.UIModule):
def render(self, account, date=None, limit=None):
cdr = account.get_cdr(date=date, limit=limit)