X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=blobdiff_plain;f=endpointapp.cpp;h=da797de148d3c916d56fdda7c24c925c08ca8c42;hp=947903379ac6577e609e99de6835858f6680407d;hb=810c051a69a0c07d8cba5237324a836d8ac7a5b5;hpb=e01d4caa3eef0f4d17e5513cb793e19fecd2b051 diff --git a/endpointapp.cpp b/endpointapp.cpp index 9479033..da797de 100644 --- a/endpointapp.cpp +++ b/endpointapp.cpp @@ -9,16 +9,15 @@ ** ** \*****************************************************************************/ - -#include #include "main.h" /* * EndpointApp constructor */ -EndpointApp::EndpointApp(class Endpoint *epoint, int origin) +EndpointApp::EndpointApp(class Endpoint *epoint, int origin, int type) { ea_endpoint = epoint; + ea_type = type; classuse++; } @@ -30,20 +29,38 @@ EndpointApp::~EndpointApp(void) classuse--; } -int EndpointApp::handler(void) -{ - return(0); -} - /* mini application for test purpose only */ -void EndpointApp::ea_message_port(unsigned long port_id, int message_type, union parameter *param) +void EndpointApp::ea_message_port(unsigned int port_id, int message_type, union parameter *param) { PDEBUG(DEBUG_EPOINT, "%s: Spare function.\n", __FUNCTION__); } -void EndpointApp::ea_message_join(unsigned long join_id, int message_type, union parameter *param) +void EndpointApp::ea_message_join(unsigned int join_id, int message_type, union parameter *param) { PDEBUG(DEBUG_EPOINT, "%s: Spare function.\n", __FUNCTION__); } + +/* create endpoint app */ +class EndpointApp *new_endpointapp(class Endpoint *epoint, int origin, int type) +{ + class EndpointApp *app = NULL; + + switch (type) { + case EAPP_TYPE_PBX: + app = new EndpointAppPBX(epoint, origin); + break; + case EAPP_TYPE_BRIDGE: + app = new EndpointAppBridge(epoint, origin); + break; + } + + if (!app) + FATAL("Failed to create endpoint APP (type %d)\n", type); + + epoint->ep_app_type = type; + epoint->ep_app = app; + + return app; +}