iaxcall.h 2.5 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
 *  Copyright (C) 2006 Savoir-Faire Linux inc.
 *  Author: Yan Morin <yan.morin@savoirfairelinux.com>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
#ifndef IAXCALL_H
#define IAXCALL_H

#include "call.h"
23
#include <iax/iax-client.h>
24
#include <iax/frame.h>
25
26
27
28
29
30
31
32
33
34
35
36

/**
 * IAXCall are IAX implementation of a normal Call 
 * @author Yan Morin <yan.morin@gmail.com>
 */
class IAXCall : public Call
{
public:
    IAXCall(const CallID& id, Call::CallType type);

    ~IAXCall();

37
    /** Get the session pointer or NULL */
38
39
40
41
42
43
44
    struct iax_session* getSession() { return _session; }

    /** Set the session pointer 
     * @param session the session pointer to assign
     */
    void setSession(struct iax_session* session) { _session = session; }

45
46
47
48
49
50
51
52
53
54
55
    /**
     * Set format (one single bit
     *
     * This function sets the _audioCodec variable with the correct
     * codec.
     */
    void setFormat(int format);

    /**
     * Get format
     */
56
    int getFormat() { return _format; }
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79


    /**
     * Get the bitwise list of supported formats
     */
    int getSupportedFormat();

    /**
     * Return a format (int) with the first matching codec selected.
     * 
     * This considers the order of the appearance in the CodecMap,
     * thus, the order of preference.
     *
     * NOTE: Everything returned is bound to the content of the local
     *       CodecMap, so it won't return format values that aren't valid
     *       in this call context.
     *
     * @param needles  The format(s) (bitwise) you are looking for to match
     * @return The matching format, thus 0 if none matches
     */
    int getFirstMatchingFormat(int needles);


80
private:
81
    /** Each call is associated with an iax_session */
82
    struct iax_session* _session;
83
84
85
86
87

    /**
     * Format currently in use in the conversation,
     * sent in each outgoing voice packet.
     */
88
    int _format;
89
90
91
};

#endif