SIP.js
SIP.js copied to clipboard
RFC8599 support
Hi,
I'm just wondering if we have support for RFC8599 support or having it on the development road map ? I'd like to be able to add these new variables in the contact sip header.
Contact: <sip:[email protected]; pn-provider=acme; pn-param=acme-param; pn-prid=ZTY4ZDJlMzODE1NmUgKi0K>
You should be able to set extra contact header params on registration:
https://github.com/onsip/SIP.js/blob/5555a9811f33df1f1461c9094a59b82307b25405/docs/api/sip.js.registereroptions.extracontactheaderparams.md
interface defined here:
https://github.com/onsip/SIP.js/blob/5555a9811f33df1f1461c9094a59b82307b25405/src/api/registerer-options.ts
Thanks I tried something like
registererOptions.extraContactHeaderParams.push('pn-provider:fcm'); registererOptions.extraContactHeaderParams.push('pn-param:test-firebase-54ca5'); registererOptions.extraContactHeaderParams.push('pn-prid:xxxyyyzzz');
but the output REGISTER request is not valid like the following
Contact: <sip:[email protected];transport=ws>;pn-provider:fcm;pn-param:test-firebase-54ca5;pn-prid:xxxyyyzzz;
The contact header ending after transport=ws with the > and these extra parameters should be inside not like this.
After further investigation found in sip.js\lib\api\registerer.js found this.userAgent.contact.toString() having transport=ws and ending with > so all these parameters were added after the closure which causes the problem and our quick fix was something like
`generateContactHeader(expires) {
// let contact = this.userAgent.contact.toString(); let contact = this.userAgent.contact.toString().replace('>', ''); if (this.options.regId && this.options.instanceId) { contact += ";reg-id=" + this.options.regId; contact += ';+sip.instance="<urn:uuid:' + this.options.instanceId ;//+ '>"'; } if (this.options.extraContactHeaderParams) { this.options.extraContactHeaderParams.forEach((header) => { contact += ";" + header; }); } // contact += ";expires=" + expires; contact += ">;expires=" + expires; return contact; }`
Hi, we have the same problem, i want to use PUSH but Sip.js does not include params into uri part of Contact header.(or i am little bit blind to find this way) is it possible to have fix for 0.20 version or have some new feature like contactParams but contactUriParams for example? Thanks.
Hi,
adding contactparams for useragent options should solve this issue like :
this.userAgent = new UserAgent({ contactParams:{ ws_address: environment.sip.url, ws_port:"9568" } })
and the result is
Contact: <sip:[email protected];ws_address=127.0.0.1;ws_port=9568>;expires=600
Thanks
adding contactparams for useragent
Hi, thanks for advice will check it out and inform if it works.
As noted, setting contactParams
should work.