src/js/bg/plugins/calls/call/sip.js
/**
    * Pass the name and number of the caller from the Remote-Party-ID header.
    * @param {String} header - The raw RPID header string.
    * @returns {Object} - displayName and number properties that map to state.
    */
Pass the name and number of the caller from the Remote-Party-ID header.
@param {String} header - The raw RPID header string.
@returns {Object} - displayName and number properties that map to state.
Pass the name and number of the caller from the Remote - Party - ID header . @param { String } header - The raw RPID header string . @returns { Object } - displayName and number properties that map to state .
_parseRpid(header) {
        let rpid = {displayName: '', number: 'unknown'}
        const numberMatch = (/<(.*)>/g).exec(header)
        const nameMatch = (/"(.*?)"/g).exec(header)
        if (numberMatch) {
            try {
                rpid.number = numberMatch[1].split('@')[0].replace('sip:', '')
            } catch (err) {
                this.app.logger.warn(`${this}failed to parse rpid header ${header}`)
                rpid.number = numberMatch[0]
            }
        }
        if (nameMatch) {
            rpid.displayName = nameMatch[1]
        }
        return rpid
    }
_parseRpid ( header ) { let rpid = { displayName : '' , number : 'unknown' } const numberMatch = ( / <(.*)> / g ) . exec ( header ) const nameMatch = ( / "(.*?)" / g ) . exec ( header ) if ( numberMatch ) { try { rpid . number = numberMatch [ 1 ] . split ( '@' ) [ 0 ] . replace ( 'sip:' , '' ) } catch ( err ) { this . app . logger . warn ( ` ${ this } ${ header } ` ) rpid . number = numberMatch [ 0 ] } } if ( nameMatch ) { rpid . displayName = nameMatch [ 1 ] } return rpid }
Pass the name and number of the caller from the Remote-Party-ID header.
Pass the name and number of the caller from the Remote - Party - ID header .