MayamaTakeshi / sip-lab

A node module that helps to write SIP functional tests
3 stars 2 forks source link

Refactor to permit proper control of multiple media offer/answer #42

Closed MayamaTakeshi closed 1 year ago

MayamaTakeshi commented 1 year ago

Precedes #22, #32 and #40.

Currently, we handle SDP with only one media offer and it is always audio. However, to add support for video, MRCPv2, MSRP, T.38 etc, we will need to change the code to handle multiple media offer. Also, we could have multiple audio streams, multiple video streams, no audio/video in some MSRP scenarios etc. So, the current Call struct:

struct Call {
    int id;
    pjsip_inv_session *inv;
    pjmedia_transport *med_transport;
    pjmedia_stream *med_stream;
    pj_bool_t local_hold;
    pj_bool_t remote_hold;
    pjmedia_master_port *master_port;
    pjmedia_port *media_port; //will contain Null Port, WAV File Player etc.

    pjmedia_port *null_port;
    chainlink *wav_writer;
    chainlink *wav_player;
    chainlink *tonegen;
    chainlink *dtmfdet;
    chainlink *fax;

    Transport *transport;

    bool outgoing;

    char DigitBuffers[2][MAXDIGITS + 1];
    int DigitBufferLength[2];
    int last_digit_timestamp[2];

    pjsip_evsub *xfer_sub; // Xfer server subscription, if this call was triggered by xfer.

    pjsip_rx_data *initial_invite_rdata;
};

must be refactored to have an array/list of media elements and this array/list might grow/shrink in case of reinvite.

MayamaTakeshi commented 1 year ago

We are working on it on the branch multiple_media. Before proceeding: call->transport is not being properly set in incoming calls (on_rx_request). We will need this to properly build the local SDP.

MayamaTakeshi commented 1 year ago

Done. Final changes commited as: 4e3a5a32206d9f860e0f59f9bd1b8e94bde979a6