You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sems/core/plug-in/sipctrl/SipCtrlInterface.h

116 lines
2.1 KiB

#ifndef _SipCtrlInterface_h_
#define _SipCtrlInterface_h_
#include "sip_ua.h"
#include <string>
#include <list>
using std::string;
using std::list;
class AmSipRequest;
class AmSipReply;
//class udp_trsp;
class trans_layer;
class trans_bucket;
struct sip_msg;
struct sip_header;
#ifndef _STANDALONE
#include "AmApi.h"
class SipCtrlInterfaceFactory: public AmCtrlInterfaceFactory
{
string bind_addr;
unsigned short bind_port;
public:
static string outbound_host;
static unsigned int outbound_port;
static bool accept_fr_without_totag;
static int log_raw_messages;
static bool log_parsed_messages;
SipCtrlInterfaceFactory(const string& name): AmCtrlInterfaceFactory(name) {}
~SipCtrlInterfaceFactory() {}
int onLoad();
AmCtrlInterface* instance();
};
#else
#include "AmThread.h"
#endif
class SipCtrlInterface:
#ifndef _STANDALONE
public AmCtrlInterface,
#else
public AmThread,
#endif
public sip_ua
{
string bind_addr;
unsigned short bind_port;
//udp_trsp* udp_server;
trans_layer* tl;
void prepare_routes_uac(const list<sip_header*>& routes, string& route_field);
void prepare_routes_uas(const list<sip_header*>& routes, string& route_field);
int cancel(const AmSipRequest& req);
protected:
void run();
void on_stop() {}
public:
SipCtrlInterface(const string& bind_addr, unsigned short bind_port);
~SipCtrlInterface(){}
/**
* From AmCtrlInterface
*/
int send(const AmSipRequest &req, char* serKey, unsigned int& serKeyLen);
int send(const AmSipReply &rep);
#ifndef _STANDALONE
string getContact(const string &displayName,
const string &userName, const string &hostName,
const string &uriParams, const string &hdrParams);
#endif
void handleSipMsg(AmSipRequest &req);
void handleSipMsg(AmSipReply &rep);
/**
* From sip_ua
*/
void handle_sip_request(const char* tid, sip_msg* msg);
void handle_sip_reply(sip_msg* msg);
};
#endif
/** EMACS **
* Local variables:
* mode: c++
* c-basic-offset: 4
* End:
*/