Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert an Audio Call to Video Call (Update SDP / Re-invite) #1075

Open
MuneebAhmed568 opened this issue Mar 18, 2024 · 1 comment
Open

Convert an Audio Call to Video Call (Update SDP / Re-invite) #1075

MuneebAhmed568 opened this issue Mar 18, 2024 · 1 comment

Comments

@MuneebAhmed568
Copy link

Hey, I hope you are doing good.

I am trying to Convert an already Established Audio call to Video Call but getting error on Ice-Candicate
I am using SIPJS : 0.21.2

Error
Screenshot 2024-03-18 at 1 58 39 PM

I can't identify why it's not working.
I also tried Simple Audio Call , Audio and Video call and even screen share they are working Just fine, error occurs when I try to update SDP.

CODE

userAgentOptions = {
  authorizationPassword: userPassword.value,
  authorizationUsername: userID.value,
  transportOptions : transportOptionss,
  uri: uriUserAgent,
  delegate: userDelegate,
  contactName: userID.value,
  displayName: userID.value,
  viaHost: viaHost,
  userAgentString: userID.value,
  sessionDescriptionHandlerFactoryOptions: {
    iceCheckingTimeout : 50,
    peerConnectionConfiguration : {
      iceServers: [
        // { 
        //   urls: "stun:stun.l.google.com:19302" 
        // },
        {
          urls: "stun:stun.relay.metered.ca:80",
        }
      ], 
      // iceTransportPolicy : "all",
      // bundlePolicy : "max-compat"
      alwaysAcquireMediaFirst : true,
      
      iceCandidatePoolSize:0,
    },
    constraints: {
      audio: true,
      video: true
    },
  },
  logLevel: 'debug'
};

userAgent = new UserAgent(userAgentOptions);
inviter = new Inviter(userAgent, destination, {
  sessionDescriptionHandlerOptions: {
    constraints: { audio: true, video: false }
  }
});
outgoingSession = inviter;
outgoingSession.invite({requestDelegate : OutgoingRequestDelegate})
//FOR Re-Invite after call state. = Established
outgoingSession.invite({
    sessionDescriptionHandlerOptions: {
      constraints: { 
        // audio: true, 
        video: true 
      }
    },
    requestDelegate: OutgoingRequestDelegate
  })
@MuneebAhmed568
Copy link
Author

MuneebAhmed568 commented Mar 20, 2024

Nevermind Solved it myself, Just needed to add offerOptions.iceRestart : true.
This option is not available by default so I have to manually add it

export interface SessionDescriptionHandlerOptions {
  constraints?: object;
  offerOptions?: RTCOfferOptions;  // added this manually 
  
}

sessionDescriptionHandlerOptions: {
        constraints: { 
          audio: true, 
          video: true 
        },
        offerOptions : {
          iceRestart : true
        }
      },

Rest of code is same as above mentioned in question

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant