1.0.0-rc.6 • Published 8 years ago

@salvob/sipclient v1.0.0-rc.6

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

SipClient

=========

SipClient is an open-source nodejs SIP library, compliant with the IETF RFC3261 specification.

Description

SipClient is a nodejs module compatible with the
following specifications:
- RFC 3261 (SIP),
- RFC 2617 (Digest Authentication)
You should easilly retrieve those specifications on internet with
your favorite search engine.

Installation

npm install @salvob/sipclient

Usage

    let sipClient = require('@salvob/sipclient').SipClient;

    let connection = {
        serverHost: 'sip.prov.com', // SIP server address
        serverPort: 5060,           // SIP server port
        username: 'sipusername',    // SIP username
        password: 'sippassword',    // SIP password
        ipNat: '192.168.10.61',     // Local Ip Address
        sessionTime: 2 * 60         // Refresh session every 2 minutes
    }

    let client = sipClient(connection);

    //On incoming call
    client.on('INVITE', (fromNumber, ringing, busy, message) => {
        console.log(`Incoming: ${fromNumber}`);

        if(fromNumber === '012223334455'){
            ringing(() => { 
                console.log('Ringing');
                //Execute  script...
                //...
                //...
                //End Script
                //busy(() => { console.log('End'); })
            })
        }
        else{
            busy(() => { console.log('End'); })
        }
    });

    client.on('CANCEL', (message) => {
        console.log('Closed');
    });

    client.start((error, message) => {
        if(error){
            console.log(error, message);
            process.exit(1);
        }else{
            console.log('Logged.');
        }
    });

Tests

npm test

1.0.0-rc.6

8 years ago

1.0.0-rc.5

8 years ago

1.0.0-rc.4

8 years ago

1.0.0-rc.3

8 years ago

1.0.0-rc.2

8 years ago

1.0.0-rc.1

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago