extraHeaders not being sent on INVITE

715 views
Skip to first unread message

nuno.p...@everdelta.com

unread,
Aug 5, 2020, 11:48:16 AM8/5/20
to SIP.js

Hi,

i'm struggling with trying to add some extra headers to the invite messages but i'm not having any luck.

i'm using si...@0.17.1

my code looks like this:

const devStun = [{ urls: "stun:stun.l.google.com:19302" }]
const uri = UserAgent.makeURI("sip:" + config.sipuser + "@" + config.wsdomain)
if (!uri) throw new Error("Failed to create user agent URI.")

const peerConnectionOptions = {
   rtcConfiguration: {
      iceServers: devStun
   }
}

const userAgentOptions: UserAgentOptions = {
    uri: uri,
    authorizationUsername: config.sipuser,
    authorizationPassword: config.sippass,
    transportOptions: {
       server: "wss://" + config.wsdomain + ":" + config.wsport,
       traceSip: true,
    },
    logLevel: "debug",
    sessionDescriptionHandlerFactoryOptions: {
       peerConnectionOptions: peerConnectionOptions,
       alwaysAcquireMediaFirst: false,
    },
}

const ua = new UserAgent(userAgentOptions)
const registerer = new Registerer(ua)
registerer.register()

ua.start()
.then(() => {
    const target = UserAgent.makeURI("sip:" + config.destinations + "@" + config.wsdomain)
    if (!target) throw new Error("Failed to create target URI.")

    const inviter = new Inviter(ua, target)
    const inviterOptions: InviterInviteOptions = {
       requestOptions: {
          extraHeaders: ["X-TEST: 123"]
       },
    }
    inviter.invite(inviterOptions)
})


And here is the respective invite message


Wed Aug 05 2020 16:40:16 GMT+0100 (Western European Summer Time) | sip.Transport | Sending WebSocket message:

INVITE sip:6000@telephony.staging.va.everdelta.net SIP/2.0
Via: SIP/2.0/WSS nrcd8cjletn9.invalid;branch=z9hG4bK4995441
To: <sip:6000@telephony.staging.va.everdelta.net>
From: <sip:7000.jWGMGsWzIEGuSbpqrlgVFyIsDEsRLpvxCZkThqXQ@telephony.staging.va.everdelta.net>;tag=4qm3h758ea
CSeq: 1 INVITE
Call-ID: pap1k9l2htc6c24pmuqa
Max-Forwards: 70
Contact: <sip:3k72393h@nrcd8cjletn9.invalid;transport=ws;ob>
Allow: ACK,CANCEL,INVITE,MESSAGE,BYE,OPTIONS,INFO,NOTIFY,REFER
Supported: outbound
User-Agent: SIP.js/0.17.1
Content-Type: application/sdp
Content-Length: 1494


v=0
o=mozilla...THIS_IS_SDPARTA-78.0.2 4458288293093790769 0 IN IP4 0.0.0.0
s=-
t=0 0
a=sendrecv
a=fingerprint:sha-256 2C:49:C7:8E:5F:7E:78:5E:64:13:C0:84:E3:39:3E:91:CF:E3:B6:22:E0:98:B5:1E:80:14:BA:6E:89:4C:66:19
a=group:BUNDLE 0
a=ice-options:trickle
a=msid-semantic:WMS *
m=audio 53567 UDP/TLS/RTP/SAVPF 109 9 0 8 101
c=IN IP4 95.92.188.159
a=candidate:0 1 UDP 2122252543 192.168.1.7 53567 typ host
a=candidate:2 1 TCP 2105524479 192.168.1.7 9 typ host tcptype active
a=candidate:0 2 UDP 2122252542 192.168.1.7 63118 typ host
a=candidate:2 2 TCP 2105524478 192.168.1.7 9 typ host tcptype active
a=candidate:1 1 UDP 1686052863 95.92.188.159 53567 typ srflx raddr 192.168.1.7 rport 53567
a=candidate:1 2 UDP 1686052862 95.92.188.159 63118 typ srflx raddr 192.168.1.7 rport 63118
a=sendrecv
a=end-of-candidates
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:2/recvonly urn:ietf:params:rtp-hdrext:csrc-audio-level
a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid
a=fmtp:109 maxplaybackrate=48000;stereo=1;useinbandfec=1
a=fmtp:101 0-15
a=ice-pwd:04b710327b514e55a3125178b2f4b1c5
a=ice-ufrag:a67ca0e0
a=mid:0
a=msid:{3c7d0638-3bcc-1446-9fda-ab4d9a681fad} {072d6e40-3b4c-f54f-a56c-d1476db7d273}
a=rtcp:63118 IN IP4 95.92.188.159
a=rtcp-mux
a=rtpmap:109 opus/48000/2
a=rtpmap:9 G722/8000/1
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=setup:actpass
a=ssrc:2570800251 cname:{bff82f48-969b-be44-8c8d-3d96779060ae}

the only way i was successful in adding the extra headers was using the old version 0.14.8 .
I've tried almost all versions up to the latest and none of them worked
my old 0.14.8 invite code was something like this:

session = userAgent.invite(destination + "@" + this.props.config.wsdomain, { extraHeaders: ["X-vadisplayname: " + displayName], })

Is it no longer possible to add the extra headers? Am i doing something wrong? Thank you

Eric Green

unread,
Aug 6, 2020, 6:27:24 AM8/6/20
to SIP.js
Looks like a bug on our end. The headers are being passed into SIP.js correctly, we are just not doing anything with them in Inviter.invite(). We will get this patched.
Message has been deleted

John Riordan

unread,
Aug 11, 2020, 4:51:54 PM8/11/20
to SIP.js
While we patch it, you can set extra headers by passing a 3rd optional argument to the `Inviter` constructor...

Asad Abbas

unread,
Mar 26, 2021, 9:05:06 AM3/26/21
to SIP.js
Did you guys fixed this bug ? I am using version 0.19.0 and still unable to pass extra header to invite. I want to implement barge functionality and I am unable to send X-App-Command header on invite. 

Slavik Bialik

unread,
Mar 26, 2021, 1:54:33 PM3/26/21
to SIP.js
Just pass your `extraHeaders` when creating the Inviter object in the 3rd parameter (type InviterOptions).
Like that:

var inviteOptions = {
extraHeaders: [
'X-App-Command: barge'
]
}

inviter = new Inviter(userAgent, target, inviterOptions);
inviter.invite();

Asad Abbas

unread,
Mar 26, 2021, 1:55:41 PM3/26/21
to sip...@googlegroups.com
Thanks. This works for me. 

--
You received this message because you are subscribed to a topic in the Google Groups "SIP.js" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sip_js/kxzD0nl-RAg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sip_js+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sip_js/427ac9ee-8b1c-4d76-9db0-284c7fe14a5dn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages