Adding custom SIP headers using RTC, in CE 6.0 R2 release.

Adding custom SIP headers using RTC, in CE 6.0 R2 release.

 

In CE 6.0 R2, RTC now supports the capability of adding custom headers to outgoing REQUEST messages, for RTC sessions and RTC subscriptions. Here is how once can do it.

After CE 6.0 R2 release, IRTCSession interface and IRTCSubscription can now be queried for the interface: IRTCSIPObject. This interface supports the following 2 functions:

    HRESULT SetAdditionalHeaderValues(

        [in] BSTR bstrHeaderValuePairs

        );

    HRESULT GetAdditionalHeaderValues(

        [out] BSTR* pbstrHeaderValuePairs

        );

SetAdditionalHeaderValues function can be used to add additional custom headers to outgoing REQUEST style messages, of the IRTCSession and IRTCSubscription, on which it gets called.

So, in case of IRTCSession, those messages would be:

INVITE, PRACK(in case PRACK is supported) and final ACK during session setup or mid –session(for cases like Hold).

CANCEL or BYE message when the session is cancelled or terminated.

In case of IRTCSubscription, the message will be SUBCRIBE.

To stop sending custom headers, SetAdditionalHeaderValues can be called again with a NULL value.

GetAdditionalHeaderValues API can be used to get back the header pair value string that is set by the SetAdditionalHeaderValues API.

Note: These APIs give direct control in modifying outgoing SIP messages and hence should be used with “extreme” caution. RTC does not validate the contents of the custom headers added, nor does it check the format of these custom headers. Adding improper custom header values can cause the remote side of the RTC session or subscription to reject SIP messages, which can lead to unexpected application behavior.