Enhancement for Blind Transfer with Bad Media ?

Skip to first unread message


Jun 12, 2014, 2:10:47 PM6/12/14
to sip...@googlegroups.com
I am attempting to use SIP.js in an environment where I need to do a blind transfer request from a non webRTC endpoint that initiates the request with and SDP describing a g711 voice codec.

When I do this, SIP.js _correctly_ rejects the session as a 'bad media'.... however, in this call flow, I am not actually sending any media; and the call flow works well if I ignore the check for bad media.

After downloading and building from source the devel version of SIP.js, I made the following modification to comment out the check and just fire the new session in function fireNewSession()  starting from line 5609:

       * onSuccess
       * SDP Offer is valid. Fire UA newRTCSession
       * onFailure
       * Bad media description
      function(e) {
        self.logger.warn('invalid SDP');

Every time I download from source, I am making this modification to support my needed call flow.  I wanted to see if you would consider an enhancement to SIP.js (maybe even a stack configuration option) to ignore the check for the bad media.
Thanks for your consideration.

Joseph Frazier

Jun 12, 2014, 4:10:47 PM6/12/14
to sip...@googlegroups.com
It's not documented very well yet, but SIP.js allows applications to provide custom media handling at runtime, by passing a mediaHandlerFactory option to the UA constructor. For this case, it sounds like you should be able to provide a factory that creates a SIP.WebRTC.MediaHandler, then overrides its setDescription method to always succeed:

var ua = new SIP.UA({
  mediaHandlerFactory: function (session, options) { 
    var handler = new SIP.WebRTC.MediaHandler(session, options);
    handler.setDescription = function (sdp, onSuccess, onFailure) { 
      console.log("we're just gonna pretend this worked");
    return handler; 

Give this a shot on the master branch (I recently pushed a commit that allows overriding WebRTC.MediaHandler methods) and let me know how it goes.



Jul 23, 2014, 8:41:50 AM7/23/14
to sip...@googlegroups.com
Thanks Joseph
Unfortunately, this didnt work for me.
I do receive the console message:
   console.log("we're just gonna pretend this worked");
However the call does not proceed.   I am trying this with the latest 0.6.1.  
If I comment out the bad media handler like shown in my earlier post, the call does work.
What do you think?
Reply all
Reply to author
0 new messages