<commit_before>{% extends "::base.html.twig" %}
{% trans_default_domain 'ListsContactBundle' %}
{% block title %}{% trans %}Show contacts{% endtrans %} {% endblock %}
{% block page_breadcrumbs %}
    <ul class="page-breadcrumb breadcrumb">
        <li>
            <i class="fa fa-home"></i>
            <a href="{{ path('sd_dashboard_homepage') }}" title="{% trans %}Dashboard{% endtrans %}">{% trans %}Dashboard{% endtrans %}</a>
            <i class="fa fa-angle-right"></i>
        </li>
        <li><a href="{{ path('lists_' ~ baseRoutePrefix ~ '_contact_index') }}" title="{% trans %}My Contacts{% endtrans %}">{% trans %}My Contacts{% endtrans %}</a></li>
    </ul>
{% endblock %}
{% block page_title %}
    <h3 class="page-title">
        {% trans %}My Contacts <small>show contacts</small>{% endtrans %}
    </h3>
{% endblock %}

{% block css_page_level_plugin %}
    {{ parent() }}
    <link rel="stylesheet" type="text/css" href="{{ asset('metronic/assets/global/plugins/select2/select2.css')}} " />
    <link rel="stylesheet" type="text/css" href="{{ asset('metronic/assets/global/plugins/bootstrap-editable/bootstrap-editable/css/bootstrap-editable.css')}} " />
    <link rel="stylesheet" type="text/css" href="{{ asset('metronic/assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.css')}} " />
    <link rel="stylesheet" type="text/css" href="{{ asset('metronic/assets/global/plugins/bootstrap-datetimepicker/css/datetimepicker.css')}}" />
    <link rel="stylesheet" type="text/css" href="{{ asset('metronic/assets/global/plugins/bootstrap-switch/static/stylesheets/bootstrap-switch-metro.css')}}" />
{% endblock %}

{% block js_page_level_plugins %}
    {{ parent() }}
    <script type="text/javascript" src="{{ asset('metronic/assets/global/plugins/select2/select2.min.js') }}"></script>
    <script type="text/javascript" src="{{ asset('metronic/assets/global/plugins/bootstrap-editable/bootstrap-editable/js/bootstrap-editable.min.js') }}"></script>
    <script type="text/javascript" src="{{ asset('metronic/assets/global/plugins/datatables/media/js/jquery.dataTables.js') }}"></script>
    <script type="text/javascript" src="{{ asset('metronic/assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.js') }}"></script>
    <script type="text/javascript" src="{{ asset('metronic/assets/global/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js')}} "></script>
    <script type="text/javascript" src="{{ asset('metronic/assets/global/plugins/bootstrap-datepicker/js/locales/bootstrap-datepicker.ru.js')}} "></script>
    <script type="text/javascript" src="{{ asset('metronic/assets/global/plugins/bootstrap-switch/static/js/bootstrap-switch.min.js')}} "></script>
    <script type="text/javascript" src="{{ asset('templates/core/plugins/jquery-tmpl/jquery.tmpl.min.js')}} "></script>
    <script type="text/javascript" src="{{ asset('templates/sipml/sipml-api.js')}} "></script>
{% endblock %}
{% block body %}

<script type="text/javascript">
    var callSession;

    $(document).ready(function(){
        SIPml.init(
                function(e){
                    var stack =  new SIPml.Stack({
                        realm: '172.16.31.10',
                        impi: '8005',
                        impu: 'sip:8005@172.16.31.10',
                        password: '<PASSWORD>',
                        websocket_proxy_url: 'ws://172.16.31.10:10060/ws', // optional
                        outbound_proxy_url: 'udp://172.16.31.10:5060', // optional
                        enable_rtcweb_breaker: true, // optional
                        events_listener: { events: 'started', listener: function(e){
                            callSession = stack.newSession('call-audiovideo', {
                                video_local: document.getElementById('video-local'),
                                video_remote: document.getElementById('video-remote'),
                                audio_remote: document.getElementById('audio-remote')
                            });

                        }
                        }
                    });
                    stack.start();
                }
        );

        $('.call-btn').live('click', function(e) {
            e.preventDefault();
            var phone = $(this).data('phone');
            var pattern = new RegExp("(?:\([2-9]\d{2}\)\ ?|[2-9]\d{2}(?:\-?|\ ?))[2-9]\d{2}[- ]?\d{4}");

            callSession.call('0636821588');

            /*if (pattern.test(phone.trim())) {

                //callSession.call(phone.trim());
            }*/
        });
    });
</script>
<div class="row">
    <div class="col-md-12">
        <p>{% trans %}Contacts on contacts{% endtrans %}</p>
        <div class="table-toolbar">
            <div class="btn-group">
                <a id="managers_list_new" class="btn green ajax-form"
                   data-toggle="modal"
                   href="#form_modal_contact"
                   data-target_holder="modelContactFormTpl"
                   data-form_name="modelContactOrganizationEditForm"
                   data-post_function="updateList"
                   data-post_target_id="contact_list"
                        >
                    {% trans %}Add New{% endtrans %} <i class="fa fa-plus"></i>
                </a>
            </div>
        </div>


        <script type="text/javascript">
            $(document).ready(function(){
                $.fn.modal.Constructor.prototype.enforceFocus = function() {};
            });
        </script>

        <div id="form_modal_contact" class="modal fade" role="basic" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                        <h4 class="modal-title">{% trans from 'ListsContactBundle' %}New Contact{% endtrans %}</h4>
                    </div>
                    <div class="modal-body">
                        <div id="modelContactFormTpl" data-text="{% trans from 'ListsContactBundle' %}Loading data. Please wait{% endtrans %}">
                        </div>
                    </div>
                </div>
                <!-- /.modal-content -->
            </div>
        </div>

        <div id="contact_list"
             data-url="{{ path('lists_' ~ baseRoutePrefix ~ '_contact_ajax_organization', {
                    organizationId: 0
                 }) }}"
             data-params='{"organizationId":0'
        >
            {{ render(controller('ListsContactBundle:' ~ baseTemplate ~ ':Organization', {
                organizationId: 0,
                baseRoutePrefix: baseRoutePrefix
            })) }}
        </div>
    </div>
</div>
    <audio id="audio_remote" autoplay="autoplay" />
    <video id="video_remote" class="video" height="100%" width="100%" style="opacity: 0; background-color: #000000; -webkit-transition-property: opacity; -webkit-transition-duration: 2s;" autoplay="autoplay"> </video>
    <video id="video_local" class="video" height="72px" width="88px" style="opacity: 0; margin-top: -80px; margin-left: 5px; background-color: #000000; -webkit-transition-property: opacity; -webkit-transition-duration: 2s;" muted="true" autoplay="autoplay"> </video>
{% endblock body %}<commit_msg>#call-btn<commit_after>{% extends "::base.html.twig" %}
{% trans_default_domain 'ListsContactBundle' %}
{% block title %}{% trans %}Show contacts{% endtrans %} {% endblock %}
{% block page_breadcrumbs %}
    <ul class="page-breadcrumb breadcrumb">
        <li>
            <i class="fa fa-home"></i>
            <a href="{{ path('sd_dashboard_homepage') }}" title="{% trans %}Dashboard{% endtrans %}">{% trans %}Dashboard{% endtrans %}</a>
            <i class="fa fa-angle-right"></i>
        </li>
        <li><a href="{{ path('lists_' ~ baseRoutePrefix ~ '_contact_index') }}" title="{% trans %}My Contacts{% endtrans %}">{% trans %}My Contacts{% endtrans %}</a></li>
    </ul>
{% endblock %}
{% block page_title %}
    <h3 class="page-title">
        {% trans %}My Contacts <small>show contacts</small>{% endtrans %}
    </h3>
{% endblock %}

{% block css_page_level_plugin %}
    {{ parent() }}
    <link rel="stylesheet" type="text/css" href="{{ asset('metronic/assets/global/plugins/select2/select2.css')}} " />
    <link rel="stylesheet" type="text/css" href="{{ asset('metronic/assets/global/plugins/bootstrap-editable/bootstrap-editable/css/bootstrap-editable.css')}} " />
    <link rel="stylesheet" type="text/css" href="{{ asset('metronic/assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.css')}} " />
    <link rel="stylesheet" type="text/css" href="{{ asset('metronic/assets/global/plugins/bootstrap-datetimepicker/css/datetimepicker.css')}}" />
    <link rel="stylesheet" type="text/css" href="{{ asset('metronic/assets/global/plugins/bootstrap-switch/static/stylesheets/bootstrap-switch-metro.css')}}" />
{% endblock %}

{% block js_page_level_plugins %}
    {{ parent() }}
    <script type="text/javascript" src="{{ asset('metronic/assets/global/plugins/select2/select2.min.js') }}"></script>
    <script type="text/javascript" src="{{ asset('metronic/assets/global/plugins/bootstrap-editable/bootstrap-editable/js/bootstrap-editable.min.js') }}"></script>
    <script type="text/javascript" src="{{ asset('metronic/assets/global/plugins/datatables/media/js/jquery.dataTables.js') }}"></script>
    <script type="text/javascript" src="{{ asset('metronic/assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.js') }}"></script>
    <script type="text/javascript" src="{{ asset('metronic/assets/global/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js')}} "></script>
    <script type="text/javascript" src="{{ asset('metronic/assets/global/plugins/bootstrap-datepicker/js/locales/bootstrap-datepicker.ru.js')}} "></script>
    <script type="text/javascript" src="{{ asset('metronic/assets/global/plugins/bootstrap-switch/static/js/bootstrap-switch.min.js')}} "></script>
    <script type="text/javascript" src="{{ asset('templates/core/plugins/jquery-tmpl/jquery.tmpl.min.js')}} "></script>
    <script type="text/javascript" src="{{ asset('templates/sipml/sipml-api.js')}} "></script>
{% endblock %}
{% block body %}

<script type="text/javascript">


    $(document).ready(function(){

        var callSession;
        var stack;

        var ringtone = document.getElementById('ringtone');

        function stopRingTone() {
            try { ringtone.pause(); }
            catch (e) { }
        }

        function startRingTone() {
            try {  }
            catch (e) {
                console.log(e.message);
            }
        }

        onEventFired = function(e){

            console.log(e.type);

            switch (e.type) {
                case "started" :
                    callSession = stack.newSession('call-audio', {
                        video_local: document.getElementById('video-local'),
                        video_remote: document.getElementById('video-remote'),
                        audio_remote: document.getElementById('audio-remote')
                    });
                    break;
                case "m_permission_accepted":
                    //stopRingTone();
                    break;
            }
        }

        SIPml.init(
                function(e){
                    stack =  new SIPml.Stack({
                        realm: '172.16.31.10',
                        impi: '8005',
                        impu: 'sip:8005@172.16.31.10',
                        password: '<PASSWORD>',
                        websocket_proxy_url: 'ws://172.16.31.10:10060/ws', // optional
                        outbound_proxy_url: 'udp://172.16.31.10:5060', // optional
                        enable_rtcweb_breaker: true, // optional
                        sip_caps: [
                            { name: '+g.oma.sip-im' },
                            { name: '+sip.ice' },
                            { name: 'language', value: '\"en,fr\"' }
                        ],
                        ice_servers: [{"url":"stun:172.16.31.10:3478"},{"url":"stun:172.16.58.3:3478"},{"url":"stun:172.16.31.10:3478"},{"url":"stun:192.168.3.11:19302"}], // optional
                        events_listener: { events: '*', listener: onEventFired }
                    });
                    stack.start();
                }
        );



        $('.call-btn').live('click', function(e) {
            e.preventDefault();
            var phone = $(this).data('phone');
            var pattern = new RegExp("(?:\([2-9]\d{2}\)\ ?|[2-9]\d{2}(?:\-?|\ ?))[2-9]\d{2}[- ]?\d{4}");

            //startRingTone();

            if (confirm('Are you sure you want to call to ' + phone.replace(/ /g, "").replace(/-/g, ""))) {
                callSession.call(phone.replace(/ /g, "").replace(/-/g, ""));
            }

            //$("#ringtone").play();

            /*if (pattern.test(phone.trim())) {

                //callSession.call(phone.trim());
            }*/
        });
    });
</script>
<div class="row">
    <div class="col-md-12">
        <p>{% trans %}Contacts on contacts{% endtrans %}</p>
        <div class="table-toolbar">
            <div class="btn-group">
                <a id="managers_list_new" class="btn green ajax-form"
                   data-toggle="modal"
                   href="#form_modal_contact"
                   data-target_holder="modelContactFormTpl"
                   data-form_name="modelContactOrganizationEditForm"
                   data-post_function="updateList"
                   data-post_target_id="contact_list"
                        >
                    {% trans %}Add New{% endtrans %} <i class="fa fa-plus"></i>
                </a>
            </div>
        </div>


        <script type="text/javascript">
            $(document).ready(function(){
                $.fn.modal.Constructor.prototype.enforceFocus = function() {};
            });
        </script>

        <div id="form_modal_contact" class="modal fade" role="basic" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
                        <h4 class="modal-title">{% trans from 'ListsContactBundle' %}New Contact{% endtrans %}</h4>
                    </div>
                    <div class="modal-body">
                        <div id="modelContactFormTpl" data-text="{% trans from 'ListsContactBundle' %}Loading data. Please wait{% endtrans %}">
                        </div>
                    </div>
                </div>
                <!-- /.modal-content -->
            </div>
        </div>

        <div id="contact_list"
             data-url="{{ path('lists_' ~ baseRoutePrefix ~ '_contact_ajax_organization', {
                    organizationId: 0
                 }) }}"
             data-params='{"organizationId":0'
        >
            {{ render(controller('ListsContactBundle:' ~ baseTemplate ~ ':Organization', {
                organizationId: 0,
                baseRoutePrefix: baseRoutePrefix
            })) }}
        </div>
    </div>
</div>
    <audio id="audio_remote" autoplay="autoplay" />
    <audio id="ringtone" loop src="{{ asset('templates/sipml/sounds/ringtone.wav')}}" />
    <audio id="ringbacktone" loop src="{{ asset('templates/sipml/sounds/ringbacktone.wav')}}" />
    <audio id="dtmfTone" src="{{ asset('templates/sipml/sounds/dtmf.wav')}}" />

    <video id="video_remote" class="video" height="100%" width="100%" style="opacity: 0; background-color: #000000; -webkit-transition-property: opacity; -webkit-transition-duration: 2s;" autoplay="autoplay"> </video>
    <video id="video_local" class="video" height="72px" width="88px" style="opacity: 0; margin-top: -80px; margin-left: 5px; background-color: #000000; -webkit-transition-property: opacity; -webkit-transition-duration: 2s;" muted="true" autoplay="autoplay"> </video>
{% endblock body %}
{'fraction_non_alphanumeric': 0.17779421737254178, 'fraction_numerical': 0.016768386659268848, 'mean_word_length': 2.190794649881983, 'pattern_counts': {'":': 9, '<': 174, '<?xml version=': 0, '>': 174, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 12, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '416086', 'n_tokens_mistral': 5003, 'n_tokens_neox': 4567, 'n_words': 773}