基于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的类,目的是加入自定义的变量。

你可能感兴趣的:(resip)