[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 28 - (download) (annotate)
Wed Apr 1 09:34:34 2009 UTC (4 years, 1 month ago) by amartin
File size: 2519 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 #include "getoption.h"
   23 #include "dialogicmanager.h"
   24 
   25 #include <woomera.h>
   26 #include <woomera_server.h>
   27 
   28 /*--------------------------------------------------------------------------*/
   29 
   30 
   31 /*!
   32  * Callback for woomera messages.
   33  */
   34 woomera_server_response* message_handler( woomera_callctlr_command * msg,
   35                                           void * prot_user_data)
   36 
   37 {
   38   LOGDEBUG("message_handler() got: " << msg->e);
   39 
   40   woomera_server_response* response = woomera_server_response_new(msg->connection_id);
   41   response->response = 200;
   42   strcpy(response->args, "OK");
   43   return response;
   44 }
   45 
   46 
   47 /*
   48  * Callback fro Woomera media events.
   49  */
   50 int media_handler(void * user_data, void * call_user_data, const char * call_id, unsigned session,
   51                   unsigned int cmd, void * parm, int parmlen)
   52 {
   53   LOGDEBUG("media_handler() ");
   54   return 0;
   55 }
   56 
   57 
   58 /*
   59  * Protocol definition.
   60  */
   61 static woomera_protocol_def proto_handler = {
   62   WOOMERA_PROTOCOL_READ_PUSH | WOOMERA_PROTOCOL_WRITE_PUSH,
   63   message_handler,
   64   media_handler
   65 };
   66 
   67 
   68 /*!
   69  *
   70  */
   71 void appwoomera_run(const GetOptions& opts)
   72 {
   73 
   74   LOGDEBUG("appwoomera_run()");
   75 
   76   /* Command line options
   77    */
   78   std::string opt_woomera_port = opts.getValue("woomera-port");
   79   if ( opt_woomera_port.empty() )
   80   {
   81     opt_woomera_port = "42420";
   82   }
   83 
   84   /* intialise dialogic
   85    */
   86   DialogicManager* dm = new DialogicManager;
   87   dm->init();
   88 
   89 
   90   /* initialise woomera subsystem
   91    */
   92   woomera_init();
   93   woomera_server* server = woomera_server_new();
   94   woomera_callctlr* callctlr = woomera_callctlr_new(woomera_server_send_event, server);
   95   woomera_callctlr_add_protocol(callctlr, &proto_handler, "isdn",  0);
   96 
   97   /* create and run the server
   98    */
   99   woomera_server_attr * attr = woomera_server_attr_new();
  100   attr->server    = server;
  101   attr->callctlr  = callctlr;
  102   attr->port      = atoi(opt_woomera_port.c_str());
  103   attr->timeout   = 1000;
  104   attr->callback  = 0;    /* function that checks apps own fdS, called by the server poll loop */
  105   attr->user_data = 0;
  106 
  107   woomera_server_run(attr);
  108 
  109   /* exit
  110    */
  111   woomera_server_delete(server);
  112  }
  113 
  114 
  115 /*
  116  * vim:ts=4:set nu:
  117  */

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