基於resip協議棧的b2bua代理服務器設計

我們知道GB28181中要求中心信令服務器以b2bua模式進行設計。

通過對resip協議棧的學習,我們可以瞭解到,在resip協議棧中AppDialog是用來指定端到端的一段對話關係的,所以我們可以通過AppDialog來實現b2bua的左右兩個呼叫。

參考:

/**
*   description:
*       implement b2bua call core class.
*
*
*   author:     YangDong
*   date:       2019-05-12
*   email:      [email protected]
*   home_page:  https://blog.csdn.net/heibao111728
*/

#ifndef __DNIUB2BUACALL_H__
#define __DNIUB2BUACALL_H__

#include "resip/stack/Uri.hxx"
#include "resip/dum/DialogUsageManager.hxx"
#include "resip/dum/AppDialogSetFactory.hxx"
#include "resip/dum/RegistrationPersistenceManager.hxx"
#include "resip/dum/DialogSetId.hxx"
#include "resip/dum/AppDialog.hxx"
#include "resip/dum/Handles.hxx"
//#include "DniuAppDialogSet.h"

using namespace resip;

typedef enum _DniuB2buaCallStatus
{
    _NONE = 0,
    _LEFTCALL_INVITE,
    _LEFTCALL_200OK,
    _LEFTCALL_ACK,
    _LEFTCALL_BYE,
    _RIGHTCALL_INVITE,
    _RIGHTCALL_200OK,
    _RIGHTCALL_ACK,
    _RIGHTCALL_BYE,
    _TERMINATE
} DniuB2buaCallStatus;

class CDniuAppDialog;
class CDniuAppDialogSet;
class CDniuAppDialogSetFactory;

class CDniuB2buaCall
{
public:
    CDniuB2buaCall(RegistrationPersistenceManager* RegistrationPersistenceManager, NameAddr target, DialogUsageManager& dum, CDniuAppDialog* appDialog);
    virtual ~CDniuB2buaCall();

    DniuB2buaCallStatus getCallState();
    void SetCallState(DniuB2buaCallStatus state);
    bool isComplete();

    void process();

    void doRightInviteWithSdp();
    void doResponse200OKWithSdpToLeftCall();
    void doAckToRightCall();
    void doByeToRightCall();
    Data generateSsrc();

    CDniuAppDialog* getLeftAppDialog();
    CDniuAppDialog* getRightAppDialog();

    void setRightAppDialog(CDniuAppDialog* appDialog);


private:
    DniuB2buaCallStatus m_state;

    NameAddr        m_target;

    CDniuAppDialog*      m_leftAppDialog;
    CDniuAppDialog*      m_rightAppDialog;
    CDniuAppDialogSet*   m_rightAppDialogSet;

    DialogUsageManager& m_dum;
    RegistrationPersistenceManager* m_RegistrationPersistenceManager; //used to implement 28181 dns

public:
    Data m_leftCallSdp;
    Data m_rightCallSdp;
};


#endif

上述代碼中CDniuAppDialog是繼承自AppDialog的類,目的是加入自定義的變量。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章