| 1 | /* |
| 2 | * Copyright (C) 2004-2005 by Objective Systems, Inc. |
| 3 | * |
| 4 | * This software is furnished under an open source license and may be |
| 5 | * used and copied only in accordance with the terms of this license. |
| 6 | * The text of the license may generally be found in the root |
| 7 | * directory of this installation in the COPYING file. It |
| 8 | * can also be viewed online at the following URL: |
| 9 | * |
| 10 | * http://www.obj-sys.com/open/license.html |
| 11 | * |
| 12 | * Any redistributions of this file including modified versions must |
| 13 | * maintain this copyright notice. |
| 14 | * |
| 15 | *****************************************************************************/ |
| 16 | /** |
| 17 | * @file ooStackCmds.h |
| 18 | * This file contains stack commands which an user application can use to make |
| 19 | * call, hang call etc. |
| 20 | */ |
| 21 | |
| 22 | #ifndef OO_STACKCMDS_H |
| 23 | #define OO_STACKCMDS_H |
| 24 | |
| 25 | #include "ootypes.h" |
| 26 | |
| 27 | #ifdef __cplusplus |
| 28 | extern "C" { |
| 29 | #endif |
| 30 | |
| 31 | #ifndef EXTERN |
| 32 | #if defined (MAKE_DLL) |
| 33 | #define EXTERN __declspec(dllexport) |
| 34 | #else |
| 35 | #define EXTERN |
| 36 | #endif /* MAKE_DLL */ |
| 37 | #endif /* EXTERN */ |
| 38 | |
| 39 | |
| 40 | |
| 41 | /** |
| 42 | * @defgroup stackcmds Stack Control Commands |
| 43 | * @{ |
| 44 | */ |
| 45 | |
| 46 | /** |
| 47 | * This is an enumeration of Stack Command return codes. |
| 48 | */ |
| 49 | typedef enum OOStkCmdStat{ |
| 50 | OO_STKCMD_SUCCESS, |
| 51 | OO_STKCMD_MEMERR, |
| 52 | OO_STKCMD_INVALIDPARAM, |
| 53 | OO_STKCMD_WRITEERR, |
| 54 | OO_STKCMD_CONNECTIONERR |
| 55 | }OOStkCmdStat; |
| 56 | |
| 57 | /** |
| 58 | * This is an enumeration of stack command codes. |
| 59 | */ |
| 60 | typedef enum OOStackCmdID { |
| 61 | OO_CMD_NOOP, |
| 62 | OO_CMD_MAKECALL, /*!< Make call */ |
| 63 | OO_CMD_ANSCALL, /*!< Answer call */ |
| 64 | OO_CMD_FWDCALL, /*!< Forward call */ |
| 65 | OO_CMD_HANGCALL, /*!< Terminate call */ |
| 66 | OO_CMD_SENDDIGIT, /*!< Send dtmf */ |
| 67 | OO_CMD_MANUALRINGBACK, /*!< Send Alerting - ringback */ |
| 68 | OO_CMD_MANUALPROGRESS, /*!< Send progress */ |
| 69 | OO_CMD_STOPMONITOR, /*!< Stop the event monitor */ |
| 70 | OO_CMD_REQMODE, /*!< Request new mode */ |
| 71 | OO_CMD_SETANI, /*! <Set conncted info */ |
| 72 | OO_CMD_UPDLC /*! <Update Logical channels */ |
| 73 | |
| 74 | } OOStackCmdID; |
| 75 | |
| 76 | /** |
| 77 | * This structure is used to queue a stack command for processing in |
| 78 | * the event handler loop. |
| 79 | */ |
| 80 | typedef struct OOStackCommand { |
| 81 | OOStackCmdID type; |
| 82 | void* param1; |
| 83 | int plen1; |
| 84 | void* param2; |
| 85 | int plen2; |
| 86 | void* param3; |
| 87 | int plen3; |
| 88 | } OOStackCommand; |
| 89 | |
| 90 | #define ooCommand OOStackCommand; |
| 91 | |
| 92 | /** |
| 93 | * This function is used by an application to place a call. |
| 94 | * @param dest Call Destination - IP:port / alias |
| 95 | * @param callToken Pointer to a buffer in which callToken will be returned |
| 96 | * @param bufsiz Size of the callToken buffer passed. |
| 97 | * @param opts These are call specific options and if passed a non-null |
| 98 | * value, will override global endpoint options. |
| 99 | * |
| 100 | * @return Returns OOStkCmdStat value indication success or failure. |
| 101 | */ |
| 102 | EXTERN OOStkCmdStat ooMakeCall |
| 103 | (const char* dest, char *callToken, size_t bufsiz, ooCallOptions *opts); |
| 104 | |
| 105 | |
| 106 | |
| 107 | /** |
| 108 | * This function is used to send a manual ringback message (alerting message) |
| 109 | * for a call. Effective only when manual-ringback is enabled. |
| 110 | * @param callToken Unique token for the call. |
| 111 | * |
| 112 | * @return Returns OOStkCmdStat value indication success or failure. |
| 113 | */ |
| 114 | EXTERN OOStkCmdStat ooManualRingback(const char *callToken); |
| 115 | EXTERN OOStkCmdStat ooManualProgress(const char *callToken); |
| 116 | |
| 117 | /** |
| 118 | * This function is used to answer a call |
| 119 | * @param callToken Unique token for the call |
| 120 | * |
| 121 | * @return Returns OOStkCmdStat value indication success or failure. |
| 122 | */ |
| 123 | EXTERN OOStkCmdStat ooAnswerCall(const char *callToken); |
| 124 | |
| 125 | /** |
| 126 | * This function is used to forward an existing call to third party. |
| 127 | * @param callToken Unique token for the call. |
| 128 | * @param dest Address to which the call has to be forwarded. Can be |
| 129 | * IP:PORT or alias. |
| 130 | * |
| 131 | * @return Returns OOStkCmdStat value indication success or failure. |
| 132 | */ |
| 133 | EXTERN OOStkCmdStat ooForwardCall(const char* callToken, char *dest); |
| 134 | |
| 135 | /** |
| 136 | * This function is used by an user application to terminate a call. |
| 137 | * @param callToken The uinque token for the call. |
| 138 | * @param reason Reason for hanging call. |
| 139 | * |
| 140 | * @return Returns OOStkCmdStat value indication success or failure. |
| 141 | */ |
| 142 | EXTERN OOStkCmdStat ooHangCall(const char* callToken, OOCallClearReason reason, int q931cause); |
| 143 | |
| 144 | /** |
| 145 | * This command function can be used by an user application to send a DTMF |
| 146 | * sequence using H.245 UserInputIndication message. |
| 147 | * @param callToken Unique token for the call |
| 148 | * @param alpha Alphanumeric string reperesenting dtmf sequence |
| 149 | * |
| 150 | * @return Returns OOStkCmdStat value indication success or failure. |
| 151 | */ |
| 152 | EXTERN OOStkCmdStat ooSendDTMFDigit(const char *callToken, const char* alpha); |
| 153 | |
| 154 | |
| 155 | /** |
| 156 | * This function is used by the user application to stop stack thread. |
| 157 | * |
| 158 | * @return Returns OOStkCmdStat value indication success or failure. |
| 159 | */ |
| 160 | EXTERN OOStkCmdStat ooStopMonitor(void); |
| 161 | |
| 162 | |
| 163 | /** |
| 164 | * This function is used by application to obtain the text description for |
| 165 | * failure of tsack command. |
| 166 | * @param stat Status code returned by stack command api. |
| 167 | * |
| 168 | * @return Text description corresponding to the code. |
| 169 | */ |
| 170 | EXTERN const char* ooGetStkCmdStatusCodeTxt(OOStkCmdStat stat); |
| 171 | /** |
| 172 | * @} |
| 173 | */ |
| 174 | |
| 175 | EXTERN OOStkCmdStat ooRequestChangeMode(const char *callToken, int isT38Mode); |
| 176 | |
| 177 | EXTERN OOStkCmdStat ooRunCall(const char* dest, char* callToken, size_t bufsiz, ooCallOptions *opts); |
| 178 | |
| 179 | int ooGenerateOutgoingCallToken (char *callToken, size_t size); |
| 180 | |
| 181 | EXTERN OOStkCmdStat ooSetANI(const char *callToken, const char* ani); |
| 182 | EXTERN OOStkCmdStat ooUpdateLogChannels(const char *callToken, const char* localIP, const int port); |
| 183 | |
| 184 | #ifdef __cplusplus |
| 185 | } |
| 186 | #endif |
| 187 | |
| 188 | #endif |