1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
/*
* Asterisk -- An open source telephony toolkit.
*
* Copyright (C) 1999 - 2005, Digium, Inc.
*
* Mark Spencer <markster@digium.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
*/
/*!
* \file
* \brief OSP support (Open Settlement Protocol)
*/
#ifndef _ASTERISK_OSP_H
#define _ASTERISK_OSP_H
#include <time.h>
#include <netinet/in.h>
#include "asterisk/channel.h"
#define OSP_DEF_PROVIDER ((char*)"default") /* Default provider context name */
#define OSP_INVALID_HANDLE ((int)-1) /* Invalid OSP handle, provider, transaction etc. */
#define OSP_DEF_TIMELIMIT ((unsigned int)0) /* Default duration limit, no limit */
#define OSP_INTSTR_SIZE ((unsigned int)16) /* Signed/unsigned int string buffer size */
#define OSP_NORSTR_SIZE ((unsigned int)256) /* Normal string buffer size */
#define OSP_TOKSTR_SIZE ((unsigned int)4096) /* Token string buffer size */
#define OSP_APP_SUCCESS ((char*)"SUCCESS") /* Return status, success */
#define OSP_APP_FAILED ((char*)"FAILED") /* Return status, failed */
#define OSP_APP_ERROR ((char*)"ERROR") /* Return status, error */
struct ast_osp_result {
int inhandle;
int outhandle;
unsigned int intimelimit;
unsigned int outtimelimit;
char tech[20];
char dest[OSP_NORSTR_SIZE];
char calling[OSP_NORSTR_SIZE];
char token[OSP_TOKSTR_SIZE];
int numresults;
};
/*!
* \brief OSP Increase Use Count function
*/
void ast_osp_adduse(void);
/*!
* \brief OSP Decrease Use Count function
*/
void ast_osp_deluse(void);
/*!
* \brief OSP Authentication function
* \param provider OSP provider context name
* \param transaction OSP transaction handle, output
* \param source Source of in_bound call
* \param calling Calling number
* \param called Called number
* \param token OSP token, may be empty
* \param timelimit Call duration limit, output
* \return 1 Authenricated, 0 Unauthenticated, -1 Error
*/
int ast_osp_auth(
const char* provider, /* OSP provider context name */
int* transaction, /* OSP transaction handle, output */
const char* source, /* Source of in_bound call */
const char* calling, /* Calling number */
const char* called, /* Called number */
const char* token, /* OSP token, may be empty */
unsigned int* timelimit /* Call duration limit, output */
);
/*!
* \brief OSP Lookup function
* \param provider OSP provider context name
* \param srcdev Source device of out_bound call
* \param calling Calling number
* \param called Called number
* \param result Lookup results
* \return 1 Found , 0 No route, -1 Error
*/
int ast_osp_lookup(
const char* provider, /* OSP provider conttext name */
const char* srcdev, /* Source device of out_bound call */
const char* calling, /* Calling number */
const char* called, /* Called number */
struct ast_osp_result* result /* OSP lookup results, in/output */
);
/*!
* \brief OSP Next function
* \param reason Last destination failure reason
* \param result Lookup results, in/output
* \return 1 Found , 0 No route, -1 Error
*/
int ast_osp_next(
int reason, /* Last destination failure reason */
struct ast_osp_result *result /* OSP lookup results, in/output */
);
/*!
* \brief OSP Finish function
* \param handle OSP in/out_bound transaction handle
* \param reason Last destination failure reason
* \param start Call start time
* \param duration Call duration
* \return 1 Success, 0 Failed, -1 Error
*/
int ast_osp_finish(
int handle, /* OSP in/out_bound transaction handle */
int reason, /* Last destination failure reason */
time_t start, /* Call start time */
time_t connect, /* Call connect time */
time_t end /* Call end time */
);
#endif /* _ASTERISK_OSP_H */
|