Invalid description, no ice-ufrag attribute at level 0 Error

Discussão em 'Angular' iniciado por SOORAJ SR, Outubro 8, 2024.

  1. SOORAJ SR

    SOORAJ SR Guest

    I was trying to implement a sipjs session.

    initializeSip() {
    const uri = UserAgent.makeURI('sip:test@192.168.1.10'); // Replace with your SIP URI
    if (!uri) {
    throw new Error('Failed to create URI');
    }

    const userAgentOptions: UserAgentOptions = {
    uri,
    transportOptions: {
    server: 'ws://127.0.0.1:9090',
    },

    delegate: {
    onInvite: (invitation: Invitation) => {
    return this.handleIncomingCall(invitation);
    },
    },
    };

    this.userAgent = new UserAgent(userAgentOptions);

    const registererOptions: RegistererOptions = {
    // Customize registererOptions as needed
    };
    this.registerer = new Registerer(this.userAgent, registererOptions);

    this.userAgent.start().then(() => {
    this.registerer.register();
    })}


    this is how defined accept call in handleIncomingCall function

    const acceptCall = () => {
    const constraints = {
    audio: true,
    video: false,
    };

    navigator.mediaDevices
    .getUserMedia(constraints)
    .then((localStream) => {
    // Attach local stream to an audio element if needed
    const localAudio = document.getElementById(
    'localAudio'
    ) as HTMLAudioElement;
    if (localAudio) {
    localAudio.srcObject = localStream;
    }
    })
    .catch((error) => {
    console.error('Error getting user media:', error);
    });

    const peerConnectionConfig = {
    iceServers: [
    {
    urls: ['stun:stun.l.google.com:19302'],

    },
    ],
    iceTransportPolicy: 'all',
    bundlePolicy: 'balanced' as RTCBundlePolicy,
    rtcpMuxPolicy: 'require' as RTCRtcpMuxPolicy,
    };

    const options = {
    sessionDescriptionHandlerOptions: {
    constraints,
    peerConnectionConfiguration: peerConnectionConfig,
    peerConnectionOptions: {
    rtcConfiguration: peerConnectionConfig,
    iceGatheringTimeout: 5000,
    },
    },
    };

    // Accept the call
    // Adding the listener for state changes

    invitation
    .accept(options)
    .then(() => {
    console.log('Call accepted successfully');
    })
    .catch((error) => {
    console.error('Failed to accept call:', error);
    });
    };


    I configured discription and pass that to an argument while accepting the invitation. but even after i am passing i an getting below error. i tried to solve in many ways, but nothing seems working.is there any mistakes while i passing the ice flags ?

    sip.SessionDescriptionHandler | SessionDescriptionHandler.setDescription failed - InvalidAccessError: Invalid description, no ice-ufrag attribute at level 0

    Continue reading...

Compartilhe esta Página