Parent Directory
|
Revision Log
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(const GetOptions& opts) 70 { 71 72 LOGDEBUG("appwoomera_run()"); 73 74 /* Command line options 75 */ 76 std::string opt_woomera_port = opts.getValue("woomera-port"); 77 if ( opt_woomera_port.empty() ) 78 { 79 opt_woomera_port = "42420"; 80 } 81 82 /* initialise woomera subsystem 83 */ 84 woomera_init(); 85 woomera_server* server = woomera_server_new(); 86 woomera_callctlr* callctlr = woomera_callctlr_new(woomera_server_send_event, server); 87 woomera_callctlr_add_protocol(callctlr, &proto_handler, "isdn", 0); 88 89 /* create and run the server 90 */ 91 woomera_server_attr * attr = woomera_server_attr_new(); 92 attr->server = server; 93 attr->callctlr = callctlr; 94 attr->port = atoi(opt_woomera_port.c_str()); 95 attr->timeout = 1000; 96 attr->callback = 0; /* function that checks apps own fdS, called by the server poll loop */ 97 attr->user_data = 0; 98 99 woomera_server_run(attr); 100 101 /* exit 102 */ 103 woomera_server_delete(server); 104 } 105 106 107 /* 108 * vim:ts=4:set nu: 109 */
| No admin address has been configured | ViewVC Help |
| Powered by ViewVC 1.0.8 |