<commit_before>
var session;

var endButton = document.getElementById('callEndButton');

endButton.addEventListener("click", function () {
    session.bye();  
}, false);


var host = '192.168.1.37';

var config = {
    uri: '1060@' + host,
    wsServers: 'ws://'+ host +':8088/ws',
    authorizationUser: '1060',
    password: 'password',
    hackIpInContact: true
};


var userAgent = new SIP.UA(config);

var options = {
    media: {
        constraints: {
            audio: true,
            video: false,
        },
        render: {
            remote: {
                audio: document.getElementById('localAudio'),
            },
            local: {
                audio: document.getElementById('localAudio'),
            }
        }
    },
};


userAgent.on('invite', function (incomingSession) {
    session = incomingSession;
    if(confirm('ok?')){
        session.accept();   
    }
});


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

callStartButton.addEventListener("click", function () {
    var number = $('#inputNumber').val();
    session = userAgent.invite('sip:'+ number + '@' + host, options);
}, false);



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

muteButton.addEventListener("click", function () {
    session.mute();
}, false);

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

unmuteButton.addEventListener("click", function () {
    session.unmute();
}, false);<commit_msg>add session events<commit_after>
var session;

var endButton = document.getElementById('callEndButton');

endButton.addEventListener("click", function () {
    session.bye();  
}, false);


var host = '192.168.1.37';

var config = {
    uri: '1060@' + host,
    wsServers: 'ws://'+ host +':8088/ws',
    authorizationUser: '1060',
    password: 'password',
    hackIpInContact: true,
    log:{
        builtinEnabled: false,
    }
};


var userAgent = new SIP.UA(config);

var options = {
    media: {
        constraints: {
            audio: true,
            video: false,
        },
        render: {
            remote: {
                audio: document.getElementById('localAudio'),
            },
            local: {
                audio: document.getElementById('localAudio'),
            }
        }
    },
};


userAgent.on('invite', function (incomingSession) {
    session = incomingSession;
    console.log(session.data);
    if(confirm('ok?')){
        session.accept();   
    }else{
        session.reject();
    }
});


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

callStartButton.addEventListener("click", function () {
    var number = $('#inputNumber').val();
    session = userAgent.invite('sip:'+ number + '@' + host, options);
    console.log('call start');
    
    session.on('progress', function(response){
        console.log('progress');
        console.log(response);
    });

    session.on('accepted', function(data){
        console.log('accepted');
        console.log(data);
    });

    session.on('rejected', function(data){
        console.log('rejected');
        console.log(data);
    });

    session.on('connecting', function () {
        console.log('connecting');
    });

    session.on('cancel', function(data){
        console.log('cancel');
        console.log(data);
    });

    session.on('bye', function(data){
        console.log('bye');
        console.log(data);
    });

}, false);



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

muteButton.addEventListener("click", function () {
    session.mute();
}, false);

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

unmuteButton.addEventListener("click", function () {
    session.unmute();
}, false);

{'fraction_non_alphanumeric': 0.1622132253711201, 'fraction_numerical': 0.011336032388663968, 'mean_word_length': 2.6986027944111775, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '5782641', 'n_tokens_mistral': 1109, 'n_tokens_neox': 1067, 'n_words': 196}