SIP.js icon indicating copy to clipboard operation
SIP.js copied to clipboard

RFC8599 support

Open ahmedfayoub opened this issue 3 years ago • 6 comments

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>

ahmedfayoub avatar Oct 24 '21 16:10 ahmedfayoub

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

etamme avatar Oct 24 '21 23:10 etamme

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.

ahmedfayoub avatar Oct 27 '21 10:10 ahmedfayoub

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; }`

ahmedfayoub avatar Oct 27 '21 11:10 ahmedfayoub

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.

firestation avatar Feb 02 '22 14:02 firestation

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

MarwaAbuEssa avatar Apr 13 '22 09:04 MarwaAbuEssa

adding contactparams for useragent

Hi, thanks for advice will check it out and inform if it works.

firestation avatar Apr 13 '22 09:04 firestation

As noted, setting contactParams should work.

john-e-riordan avatar Sep 29 '22 21:09 john-e-riordan