1 /** 2 * \file gammu-call.h 3 * \author Michal Čihař 4 * 5 * Call data and functions. 6 */ 7 #ifndef __gammu_call_h 8 #define __gammu_call_h 9 10 /** 11 * \defgroup Call Call 12 * Call entries manipulations. 13 */ 14 15 #ifdef __cplusplus 16 extern "C" { 17 #endif 18 19 #include <gammu-types.h> 20 #include <gammu-limits.h> 21 #include <gammu-error.h> 22 #include <gammu-statemachine.h> 23 24 /** 25 * \defgroup Divert Divert 26 * Diversion entries manipulations. 27 */ 28 29 /** 30 * Enum with status of call. 31 * 32 * \ingroup Call 33 */ 34 typedef enum { 35 /** 36 * Somebody calls to us 37 */ 38 GSM_CALL_IncomingCall = 1, 39 /** 40 * We call somewhere 41 */ 42 GSM_CALL_OutgoingCall, 43 /** 44 * Call started 45 */ 46 GSM_CALL_CallStart, 47 /** 48 * End of call from unknown side 49 */ 50 GSM_CALL_CallEnd, 51 /** 52 * End of call from remote side 53 */ 54 GSM_CALL_CallRemoteEnd, 55 /** 56 * End of call from our side 57 */ 58 GSM_CALL_CallLocalEnd, 59 /** 60 * Call established. Waiting for answer or dropping 61 */ 62 GSM_CALL_CallEstablished, 63 /** 64 * Call held 65 */ 66 GSM_CALL_CallHeld, 67 /** 68 * Call resumed 69 */ 70 GSM_CALL_CallResumed, 71 /** 72 * We switch to call 73 */ 74 GSM_CALL_CallSwitched 75 } GSM_CallStatus; 76 77 /** 78 * Call information. 79 * 80 * \ingroup Call 81 */ 82 typedef struct { 83 /** 84 * Call status. 85 */ 86 GSM_CallStatus Status; 87 /** 88 * Call ID 89 */ 90 int CallID; 91 /** 92 * Whether Call ID is available. 93 */ 94 gboolean CallIDAvailable; 95 /** 96 * Status code. 97 */ 98 int StatusCode; 99 /** 100 * Remote phone number. 101 */ 102 unsigned char PhoneNumber[(GSM_MAX_NUMBER_LENGTH + 1) * 2]; 103 } GSM_Call; 104 105 /** 106 * Defines when diversion is active. 107 * 108 * \ingroup Divert 109 */ 110 typedef enum { 111 /** 112 * Divert when busy. 113 */ 114 GSM_DIVERT_Busy = 0x01, 115 /** 116 * Divert when not answered. 117 */ 118 GSM_DIVERT_NoAnswer, 119 /** 120 * Divert when phone off or no coverage. 121 */ 122 GSM_DIVERT_OutOfReach, 123 /** 124 * Divert all calls without ringing. 125 */ 126 GSM_DIVERT_AllTypes 127 } GSM_Divert_DivertTypes; 128 129 /** 130 * Which type of calls should be diverted. 131 * 132 * \ingroup Divert 133 */ 134 typedef enum { 135 /** 136 * Voice calls. 137 */ 138 GSM_DIVERT_VoiceCalls = 0x01, 139 /** 140 * Fax calls. 141 */ 142 GSM_DIVERT_FaxCalls, 143 /** 144 * Data calls. 145 */ 146 GSM_DIVERT_DataCalls, 147 /** 148 * All calls. 149 */ 150 GSM_DIVERT_AllCalls 151 } GSM_Divert_CallTypes; 152 153 /** 154 * Call diversion definition. 155 * 156 * \ingroup Divert 157 */ 158 typedef struct { 159 /** 160 * When diversion is active. 161 */ 162 GSM_Divert_DivertTypes DivertType; 163 /** 164 * Type of call to divert. 165 */ 166 GSM_Divert_CallTypes CallType; 167 /** 168 * Timeout for diversion. 169 */ 170 unsigned int Timeout; 171 /** 172 * Number where to divert. 173 */ 174 unsigned char Number[(GSM_MAX_NUMBER_LENGTH + 1) * 2]; 175 } GSM_CallDivert; 176 177 /** 178 * Multiple call diversions. 179 * 180 * \ingroup Divert 181 */ 182 typedef struct { 183 int EntriesNum; 184 GSM_CallDivert Entries[GSM_MAX_CALL_DIVERTS]; 185 } GSM_MultiCallDivert; 186 187 /** 188 * How to handle number when initiating voice call. 189 * 190 * \ingroup Call 191 */ 192 typedef enum { 193 /** 194 * Show number. 195 */ 196 GSM_CALL_ShowNumber = 1, 197 /** 198 * Hide number. 199 */ 200 GSM_CALL_HideNumber, 201 /** 202 * Keep phone default settings. 203 */ 204 GSM_CALL_DefaultNumberPresence 205 } GSM_CallShowNumber; 206 207 /** 208 * Dials number and starts voice call. 209 * 210 * \param s State machine pointer. 211 * \param Number Number to dial. 212 * \param ShowNumber Whether we want to display number on phone. 213 * 214 * \return Error code 215 * 216 * \ingroup Call 217 */ 218 GSM_Error GSM_DialVoice(GSM_StateMachine * s, char *Number, 219 GSM_CallShowNumber ShowNumber); 220 /** 221 * Dials service number (usually for USSD). 222 * 223 * \param s State machine pointer. 224 * \param Number Number to dial. 225 * 226 * \return Error code 227 * 228 * \ingroup Call 229 */ 230 GSM_Error GSM_DialService(GSM_StateMachine * s, char *Number); 231 232 /** 233 * Accept current incoming call. 234 * 235 * \param s State machine pointer. 236 * \param ID ID of call. 237 * \param all Whether to handle all call and not only the one specified 238 * by ID. 239 * 240 * \return Error code 241 * 242 * \ingroup Call 243 */ 244 GSM_Error GSM_AnswerCall(GSM_StateMachine * s, int ID, gboolean all); 245 246 /** 247 * Deny current incoming call. 248 * 249 * \param s State machine pointer. 250 * \param ID ID of call. 251 * \param all Whether to handle all call and not only the one specified 252 * by ID. 253 * 254 * \return Error code 255 * 256 * \ingroup Call 257 */ 258 GSM_Error GSM_CancelCall(GSM_StateMachine * s, int ID, gboolean all); 259 260 /** 261 * Holds call. 262 * 263 * \param s State machine pointer. 264 * \param ID ID of call. 265 * 266 * \return Error code 267 * 268 * \ingroup Call 269 */ 270 GSM_Error GSM_HoldCall(GSM_StateMachine * s, int ID); 271 272 /** 273 * Unholds call. 274 * 275 * \param s State machine pointer. 276 * \param ID ID of call. 277 * 278 * \return Error code 279 * 280 * \ingroup Call 281 */ 282 GSM_Error GSM_UnholdCall(GSM_StateMachine * s, int ID); 283 284 /** 285 * Initiates conference call. 286 * 287 * \param s State machine pointer. 288 * \param ID ID of call. 289 * 290 * \return Error code 291 * 292 * \ingroup Call 293 */ 294 GSM_Error GSM_ConferenceCall(GSM_StateMachine * s, int ID); 295 296 /** 297 * Splits call. 298 * 299 * \param s State machine pointer. 300 * \param ID ID of call. 301 * 302 * \return Error code 303 * 304 * \ingroup Call 305 */ 306 GSM_Error GSM_SplitCall(GSM_StateMachine * s, int ID); 307 308 /** 309 * Transfers call. 310 * 311 * \param s State machine pointer. 312 * \param ID ID of call. 313 * \param next Switches next call and ignores ID. 314 * 315 * \return Error code 316 * 317 * \ingroup Call 318 */ 319 GSM_Error GSM_TransferCall(GSM_StateMachine * s, int ID, gboolean next); 320 321 /** 322 * Switches call. 323 * 324 * \param s State machine pointer. 325 * \param ID ID of call. 326 * \param next Switches next call and ignores ID. 327 * 328 * \return Error code 329 * 330 * \ingroup Call 331 */ 332 GSM_Error GSM_SwitchCall(GSM_StateMachine * s, int ID, gboolean next); 333 334 /** 335 * Gets call diverts. 336 * 337 * \param s State machine pointer. 338 * \param request Which diverts to get. 339 * \param result Storage for diversions information. 340 * 341 * \return Error code 342 * 343 * \ingroup Divert 344 */ 345 GSM_Error GSM_GetCallDivert(GSM_StateMachine *s, GSM_CallDivert *request, GSM_MultiCallDivert *result); 346 347 /** 348 * Sets call diverts. 349 * 350 * \param s State machine pointer. 351 * \param divert Diversions information to set. 352 * 353 * \return Error code 354 * 355 * \ingroup Divert 356 */ 357 GSM_Error GSM_SetCallDivert(GSM_StateMachine * s, GSM_CallDivert * divert); 358 359 /** 360 * Cancels all diverts. 361 * 362 * \param s State machine pointer. 363 * 364 * \return Error code 365 * 366 * \ingroup Divert 367 */ 368 GSM_Error GSM_CancelAllDiverts(GSM_StateMachine * s); 369 370 /** 371 * Activates/deactivates noticing about incoming calls. 372 * 373 * \param s State machine pointer. 374 * \param enable Whether to enable notifications. 375 * 376 * \return Error code 377 * 378 * \ingroup Call 379 */ 380 GSM_Error GSM_SetIncomingCall(GSM_StateMachine * s, gboolean enable); 381 382 /** 383 * Sends DTMF (Dual Tone Multi Frequency) tone. 384 * 385 * \param s State machine pointer. 386 * \param sequence Sequence to press. 387 * 388 * \return Error code 389 * 390 * \ingroup Call 391 */ 392 GSM_Error GSM_SendDTMF(GSM_StateMachine * s, char *sequence); 393 394 #ifdef __cplusplus 395 } 396 #endif 397 #endif 398 399 /* Editor configuration 400 * vim: noexpandtab sw=8 ts=8 sts=8 tw=72: 401 */ 402