iaxcall.h 2.66 KB
Newer Older
1
/*
2 3
 *  Copyright (C) 2006-2007 Savoir-Faire Linux inc.
 *  Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com>
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
 *  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"
24
#include <iax/iax-client.h>
25
#include <iax/frame.h>
26 27 28 29 30 31 32 33 34 35 36 37

/**
 * 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();

38
    /** Get the session pointer or NULL */
39 40 41 42 43 44 45
    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; }

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

    /**
55 56 57
     * Get format for the voice codec used
     *
     * Bitmask for codecs defined in iax/frame.h
58
     */
59
    int getFormat() { return _format; }
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82


    /**
     * 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);


83
private:
84
    /** Each call is associated with an iax_session */
85
    struct iax_session* _session;
86 87 88 89 90

    /**
     * Format currently in use in the conversation,
     * sent in each outgoing voice packet.
     */
91
    int _format;
92 93 94
};

#endif