~ubuntu-branches/debian/squeeze/asterisk-chan-capi/squeeze

« back to all changes in this revision

Viewing changes to chan_capi_rtp.c

  • Committer: Bazaar Package Importer
  • Author(s): Mark Purcell, Kilian Krause
  • Date: 2007-11-30 15:54:46 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20071130155446-09q50fizvzsrkind
Tags: 1.0.2-1
* Extremadura release ;-)

[ Kilian Krause ]
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * (CAPI*)
3
3
 *
4
 
 * An implementation of Common ISDN API 2.0 for
5
 
 * Asterisk / OpenPBX.org
 
4
 * An implementation of Common ISDN API 2.0 for Asterisk
6
5
 *
7
6
 * Copyright (C) 2006-2007 Cytronics & Melware
8
7
 *
11
10
 * This program is free software and may be modified and 
12
11
 * distributed under the terms of the GNU Public License.
13
12
 */
14
 
#ifdef PBX_IS_OPBX
15
 
#ifdef HAVE_CONFIG_H
16
 
#include "confdefs.h"
17
 
#endif
18
 
#endif
19
13
 
20
14
#include <stdlib.h>
21
15
#include <stdio.h>
27
21
#include <sys/types.h>
28
22
#include <sys/socket.h>
29
23
 
30
 
#ifdef PBX_IS_OPBX
31
 
#include "openpbx/lock.h"
32
 
#include "openpbx/frame.h"
33
 
#include "openpbx/channel.h"
34
 
#include "openpbx/logger.h"
35
 
#include "openpbx/module.h"
36
 
#include "openpbx/pbx.h"
37
 
#include "openpbx/config.h"
38
 
#include "openpbx/options.h"
39
 
#include "openpbx/features.h"
40
 
#include "openpbx/utils.h"
41
 
#include "openpbx/rtp.h"
42
 
#include "openpbx/strings.h"
43
 
#include "openpbx/chan_capi20.h"
44
 
#include "openpbx/chan_capi.h"
45
 
#include "openpbx/chan_capi_rtp.h"
46
 
#else
47
 
#include "config.h"
48
 
 
49
 
#include <asterisk/lock.h>
50
 
#include <asterisk/frame.h>
51
 
#include <asterisk/channel.h>
52
 
#include <asterisk/logger.h>
53
 
#include <asterisk/module.h>
54
 
#include <asterisk/pbx.h>
55
 
#include <asterisk/config.h>
56
 
#include <asterisk/options.h>
57
 
#include <asterisk/features.h>
58
 
#include <asterisk/utils.h>
59
 
#include <asterisk/rtp.h>
60
 
#include <asterisk/strings.h>
61
24
#include "chan_capi20.h"
62
25
#include "chan_capi.h"
63
26
#include "chan_capi_rtp.h"
64
 
#endif
 
27
#include "chan_capi_utils.h"
65
28
 
66
29
/* RTP settings / NCPI RTP struct */
67
30
 
225
188
/*
226
189
 * write rtp for a channel
227
190
 */
228
 
int capi_write_rtp(struct ast_channel *c, struct ast_frame *f)
 
191
int capi_write_rtp(struct capi_pvt *i, struct ast_frame *f)
229
192
{
230
 
        struct capi_pvt *i = CC_CHANNEL_PVT(c);
231
 
        _cmsg CMSG;
232
193
        struct sockaddr_in us;
233
194
        int len;
234
195
        socklen_t uslen;
281
242
                        i->vname, i->NCCI, len, f->datalen, ast_getformatname(f->subclass),
282
243
                        i->timestamp);
283
244
 
284
 
                DATA_B3_REQ_HEADER(&CMSG, capi_ApplID, get_capi_MessageNumber(), 0);
285
 
                DATA_B3_REQ_NCCI(&CMSG) = i->NCCI;
286
 
                DATA_B3_REQ_FLAGS(&CMSG) = 0;
287
 
                DATA_B3_REQ_DATAHANDLE(&CMSG) = i->send_buffer_handle;
288
 
                DATA_B3_REQ_DATALENGTH(&CMSG) = len;
289
 
                DATA_B3_REQ_DATA(&CMSG) = (buf);
290
 
 
291
 
                _capi_put_cmsg(&CMSG);
 
245
                capi_sendf(NULL, 0, CAPI_DATA_B3_REQ, i->NCCI, get_capi_MessageNumber(),
 
246
                        "dwww",
 
247
                        buf,
 
248
                        len,
 
249
                        i->send_buffer_handle,
 
250
                        0
 
251
                );
292
252
        }
293
253
 
294
254
        return 0;
352
312
        unsigned short info = 0;
353
313
        unsigned int payload1, payload2;
354
314
 
355
 
        FACILITY_REQ_HEADER(&CMSG, capi_ApplID, get_capi_MessageNumber(), 0);
356
 
        FACILITY_REQ_CONTROLLER(&CMSG) = cp->controller;
357
 
        FACILITY_REQ_FACILITYSELECTOR(&CMSG) = FACILITYSELECTOR_VOICE_OVER_IP;
358
 
        FACILITY_REQ_FACILITYREQUESTPARAMETER(&CMSG) = (_cstruct)&fac;
359
 
        _capi_put_cmsg(&CMSG);
 
315
        capi_sendf(NULL, 0, CAPI_FACILITY_REQ, cp->controller, get_capi_MessageNumber(),
 
316
                "ws",
 
317
                FACILITYSELECTOR_VOICE_OVER_IP,
 
318
                &fac
 
319
        );
360
320
 
361
321
        tv.tv_sec = 1;
362
322
        tv.tv_usec = 0;