[server] / trunk / server / src / appwoomera.cxx Repository:
ViewVC logotype

View of /trunk/server/src/appwoomera.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 20 - (download) (annotate)
Tue Mar 31 16:04:15 2009 UTC (4 years, 1 month ago) by amartin
File size: 2137 byte(s)
Work in progress.
    1 /*
    2  * This file is part of the Dialogic Woomera Server project.
    3  *
    4  *
    5  * Copyright (C) 2009 Dialogic Corporation
    6  * All Rights Reserved
    7  *
    8  */
    9 
   10 /*!
   11  * \file    appwoomer.cxx
   12  * \brief   Woomera HMP server.
   13  * \author  John Tarlton  <john.tarlton@dialogic.com>
   14  * \author  Antony Martin <antony.martin@dialogic.com>
   15  * \version 0.1
   16  */
   17 
   18 
   19 /*----------------------------- Dependencies -------------------------------*/
   20 
   21 #include "logger.h"
   22 
   23 #include <woomera.h>
   24 #include <woomera_server.h>
   25 
   26 /*--------------------------------------------------------------------------*/
   27 
   28 
   29 /*!
   30  * Callback for woomera messages.
   31  */
   32 woomera_server_response* message_handler( woomera_callctlr_command * msg,
   33                                           void * prot_user_data)
   34 
   35 {
   36   LOGDEBUG("message_handler() got: " << msg->e);
   37 
   38   woomera_server_response* response = woomera_server_response_new(msg->connection_id);
   39   response->response = 200;
   40   strcpy(response->args, "OK");
   41   return response;
   42 }
   43 
   44 
   45 /*
   46  * Callback fro Woomera media events.
   47  */
   48 int media_handler(void * user_data, void * call_user_data, const char * call_id, unsigned session,
   49                   unsigned int cmd, void * parm, int parmlen)
   50 {
   51   LOGDEBUG("media_handler() ");
   52   return 0;
   53 }
   54 
   55 
   56 /*
   57  * Protocol definition.
   58  */
   59 static woomera_protocol_def proto_handler = {
   60   WOOMERA_PROTOCOL_READ_PUSH | WOOMERA_PROTOCOL_WRITE_PUSH,
   61   message_handler,
   62   media_handler
   63 };
   64 
   65 
   66 /*!
   67  *
   68  */
   69 void appwoomera_run()
   70 {
   71   /* initialise woomera subsystem
   72    */
   73   woomera_init();
   74   woomera_server* server = woomera_server_new();
   75   woomera_callctlr* callctlr = woomera_callctlr_new(woomera_server_send_event, server);
   76   woomera_callctlr_add_protocol(callctlr, &proto_handler, "isdn",  0);
   77 
   78   /* create and run the server
   79    */
   80   woomera_server_attr * attr = woomera_server_attr_new();
   81   attr->server    = server;
   82   attr->callctlr  = callctlr;
   83   attr->port      = 42420;
   84   attr->timeout   = 1000;
   85   attr->callback  = 0;    /* function that checks apps own fdS, called by the server poll loop */
   86   attr->user_data = 0;
   87 
   88   woomera_server_run(attr);
   89 
   90   /* exit
   91    */
   92   woomera_server_delete(server);
   93  }
   94 
   95 
   96 /*
   97  * vim:ts=4:set nu:
   98  */

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.8