onsip / SIP.js

A simple, intuitive, and powerful JavaScript signaling library
https://sipjs.com
MIT License
1.88k stars 700 forks source link

Custom Call-ID on Outgoing Invite #1083

Closed austinkottke closed 3 months ago

austinkottke commented 3 months ago

It'd be great if we can specify a custom call-id instead of SIP.js generating a random string.

I put this request in over 5 years ago and since have had to hack in this feature into every release and Id really like to stop hacking in this feature.

Sometimes we want to track custom call-ids based on a distributed back-end generating the ids and a client-side library generating the ids is not gonna cut it.

Any thoughts?

austinkottke commented 3 months ago
// Create a user agent client to establish a session
        const inviter = new Inviter(userAgent, target, {
          sessionDescriptionHandlerOptions: {
            constraints: { audio: true, video: false },
            remote: { audio: this.getAudioElement(this.audioId) },
          }
          ,
          params : {
            callId: customCallId,
          },
        });

Solved with this code.