voip integration

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • BarkydogYawl
    Junior Member
    • Feb 2026
    • 1

    #1

    voip integration

    I want to call an api from phone button click and i have managed it successfully.
    But I want to take the agent / assignedUser phone number also to pass for sending with api.
    Kindly help on this. I have done as follows,
    client/res/templates/fields/phone/detail.tpl
    i have changed <a data-phone-number="{{valueForLink}}" id="custom_api_call" data-action="api_call">

    and in html/main.html

    <script>

    $(document).on("click","#custom_api_call",f unction() {

    try{
    var phone = $(this).attr("data-phone-number");
    and then call api

    Somehow i want to take the phone number of the assighnd user and to make it available on the script page abovementioned. I am doing this to avoid voip integration and handle it via API, kindly help regarding this
    Thanks
    Arun
    919496381412
  • item
    Active Community Member
    • Mar 2017
    • 1566

    #2
    Hi,

    just 2 files to add :
    You have all your request sample

    client/custom/src/views/fields/phone.js

    PHP Code:
    define('custom:views/fields/phone', ['views/fields/phone'], (ViewFieldPhone) => class extends ViewFieldPhone {
        setup() {
            super.setup();
            this.events['click [data-action="dial"]'] = (e) => this.actionDial(e);
        }
    
        afterRender() {
            super.afterRender();
        }
    
        async actionDial(e) {
            e.preventDefault();
            if (!this.getUser().get('ext')) {
                return Espo.Ui.notify(this.translate('Complete Extension', 'messages'), 'danger', 4000);
            }
            const elem = e.currentTarget;
            Espo.Ui.notify(this.translate('Loading...'));
            const phoneNumber = $(elem).attr('data-phone-number');
            const response = await Espo.Ajax.postRequest('Cisco/:phoneNumber', {
                user: this.getUser(),
                ext: this.getUser().get('ext'),
                phoneNumber,
            });
            if (response['status'] == true) {
                Espo.Ui.notify(response['message'], 'success', 8000);
            }
            else {
                Espo.Ui.notify(response['message'], 'danger', 2000);
            }
        }
    }); 
    
    And

    custom/Espo/Custom/Resources/metadata/fields/phone.json

    {
    "view": "custom:views/fields/phone"
    }
    If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

    Comment

    Working...