<commit_before>/**
 * @author <NAME>
 * @since v1
 */

function Originate(sipProvider, headerFactory, messageFactory, addressFactory, contextStorage, config) {
    const LogManager = Packages.org.apache.logging.log4j.LogManager
    const LOG = LogManager.getLogger()
    const SipUtils = Packages.gov.nist.javax.sip.Utils
    const Request = Packages.javax.sip.message.Request

    var cseq = 0

    this.call = (from, to, contact) => {
        const transport = 'udp'
        const port = sipProvider.getListeningPoint(transport).getPort()

        try {
            cseq++;

            const current_process = cseq + ' ' + Request.INVITE
            let viaHeaders = []
            const viaHeader = headerFactory.createViaHeader(config.ip, port, transport, null)
            viaHeaders.push(viaHeader)

            // The "Max-Forwards" header.
            const maxForwardsHeader = headerFactory.createMaxForwardsHeader(70)
            // The "Call-Id" header.
            const callIdHeader = sipProvider.getNewCallId()
            // The "CSeq" header.
            const cSeqHeader = headerFactory.createCSeqHeader(cseq, Request.INVITE)
            const fromAddress = addressFactory.createAddress(from)
            const toAddress = addressFactory.createAddress(to)
            const fromHeader = headerFactory.createFromHeader(fromAddress, new SipUtils().generateTag())
            // The "To" header.
            const toHeader = headerFactory.createToHeader(toAddress, null)
            const contentLength = headerFactory.createContentLengthHeader(300)
            const contentType = headerFactory.createContentTypeHeader('application', 'sdp')
            const contactAddress = addressFactory.createAddress(contact)
            const contactHeader = headerFactory.createContactHeader(contactAddress)

            const sdpData  = 'v=0\n' +
            'o=- 3698187739 3698187740 IN IP4 127.0.0.1\n' +
            's=pjmedia\n' +
            'b=AS:117\n' +
            't=0 0\n' +
            'a=X-nat:0\n' +
            'm=audio 4000 RTP/AVP 103 101\n' +
            'c=IN IP4 127.0.0.1\n' +
            'b=TIAS:96000\n' +
            'a=rtcp:4001 IN IP4 10.0.0.8\n' +
            'a=sendrecv\n' +
            'a=rtpmap:103 speex/16000\n' +
            'a=rtpmap:101 telephone-event/8000\n' +
            'a=fmtp:101 0-16\n';
<commit_msg>Added discriminator for api calls<commit_after>/**
 * @author <NAME>
 * @since v1
 */

function Originate(sipProvider, headerFactory, messageFactory, addressFactory, contextStorage, config) {
    const LogManager = Packages.org.apache.logging.log4j.LogManager
    const LOG = LogManager.getLogger()
    const SipUtils = Packages.gov.nist.javax.sip.Utils
    const Request = Packages.javax.sip.message.Request

    var cseq = 0

    this.call = (from, to, contact) => {
        const transport = 'udp'
        const port = sipProvider.getListeningPoint(transport).getPort()

        try {
            cseq++;

            const current_process = cseq + ' ' + Request.INVITE
            let viaHeaders = []
            const viaHeader = headerFactory.createViaHeader(config.ip, port, transport, null)
            viaHeaders.push(viaHeader)

            // The "Max-Forwards" header.
            const maxForwardsHeader = headerFactory.createMaxForwardsHeader(70)
            // The "Call-Id" header.
            const callIdHeader = sipProvider.getNewCallId()
            // The "CSeq" header.
            const cSeqHeader = headerFactory.createCSeqHeader(cseq, Request.INVITE)
            const fromAddress = addressFactory.createAddress(from)
            const toAddress = addressFactory.createAddress(to)
            const fromHeader = headerFactory.createFromHeader(fromAddress, new SipUtils().generateTag())
            fromHeader.setParameter('origin', 'api')
            // The "To" header.
            const toHeader = headerFactory.createToHeader(toAddress, null)
            const contentLength = headerFactory.createContentLengthHeader(300)
            const contentType = headerFactory.createContentTypeHeader('application', 'sdp')
            const contactAddress = addressFactory.createAddress(contact)
            const contactHeader = headerFactory.createContactHeader(contactAddress)

            const sdpData  = 'v=0\n' +
            'o=- 3698187739 3698187740 IN IP4 127.0.0.1\n' +
            's=pjmedia\n' +
            'b=AS:117\n' +
            't=0 0\n' +
            'a=X-nat:0\n' +
            'm=audio 4000 RTP/AVP 103 101\n' +
            'c=IN IP4 127.0.0.1\n' +
            'b=TIAS:96000\n' +
            'a=rtcp:4001 IN IP4 10.0.0.8\n' +
            'a=sendrecv\n' +
            'a=rtpmap:103 speex/16000\n' +
            'a=rtpmap:101 telephone-event/8000\n' +
            'a=fmtp:101 0-16\n';

{'fraction_non_alphanumeric': 0.11094829390831065, 'fraction_numerical': 0.039773916684111364, 'mean_word_length': 2.202412868632708, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, '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': '4700345', 'n_tokens_mistral': 1555, 'n_tokens_neox': 1426, 'n_words': 278}