Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Callerid name on Conference view #48

Open
vlad-dc opened this issue Jun 26, 2019 · 1 comment
Open

Callerid name on Conference view #48

vlad-dc opened this issue Jun 26, 2019 · 1 comment

Comments

@vlad-dc
Copy link

vlad-dc commented Jun 26, 2019

How to set callerid name to participants buttom on conference view?

@greemag
Copy link

greemag commented Jun 27, 2019

Hello, you can update view.py:


@asterisk.route('/online_participants.json/<int:conf_number>')
def online_participants_json(conf_number):
    if not asterisk_is_authenticated():
        return 'NOTAUTH'

    conf = Conference.query.filter_by(number=conf_number).first()

    if not conf:
        return 'NOCONF'

    ret = []

    ret2 = confbridge_list_participants(conf_number)

    online_participants = [
        k['callerid'] for k in ret2]

    partici = [
        k.phone for k in conf.participants]


    for p in conf.participants:
                if (p.phone in online_participants):
                        online = True
                        for i in ret2:
                                if (i['callerid'] == p.phone):
                                        flag = i['flags']
                                        channel = i['channel']
                else:
                        online = False
                        flag = ''
                        channel = ''
                ret.append({
                'id': p.id,
                'name': p.name,
                'phone': p.phone,
                'callerid': p.phone,
                'is_invited': p.is_invited,
                'flags': flag,
                'channel': channel,
                'is_online': online
                }
                )

    for i in ret2:
        if (i['callerid'] not in partici):
                contac = Contact.query.filter_by(phone=i['callerid']).first()
                if ( contac ):
                    name=contac.name
                else:
                    name=''
                ret.append ({
                'id': '',
                'name': name,
                'phone': i['callerid'],
                'callerid': i['callerid'],
                'is_invited': False,
                'flags': i['flags'],
                'channel': i['channel'],
                'is_online': True
                }
                )


    return Response(response=json.dumps(ret),
                    status=200, mimetype='application/json')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants