~ubuntu-branches/ubuntu/karmic/asterisk/karmic

« back to all changes in this revision

Viewing changes to main/rtp.c

  • Committer: Bazaar Package Importer
  • Author(s): Faidon Liambotis, Tzafrir Cohen, Faidon Liambotis
  • Date: 2007-12-06 17:20:21 UTC
  • mfrom: (1.1.19 upstream)
  • Revision ID: james.westby@ubuntu.com-20071206172021-pd0wrjirz3os7hia
Tags: 1:1.4.15~dfsg-1
* New upstream release (Closes: #452054)
  - Fix a potential corrupt of voicemail.conf on simultaneous PIN updates
    (Closes: #353227)

[ Tzafrir Cohen ]
* Add some sample/reference config files as documentation.
* Provide asterisk-bristuff for upgrading from Etch.
* Move libc-client to not be last, so debian/backports/xorcom.etch would
  still work.

[ Faidon Liambotis ]
* Really enable the libcap/ToS functionality; the previous patch didn't
  enable the functionality, even though the code and the libcap.so
  dependency were there. (Closes: #454342)
* Fix a minor issue with init script's stop target when running with
  safe_asterisk.
* Add chan_vpb, adding support for VoiceTronix OpenSwitch and OpenLine
  cards. (Closes: #396499)
* Fix debian/watch by using a pkg-voip wrapper to avoid upstream's silly
  redirections. (Closes: #449706)
* Use DEBVERSION as asterisk's version string.
* Disable the MD5 build sum that breaks all out-of-tree plugins (duh!).
* Create /usr/local/share/asterisk/sounds to put all site-specific
  non-modifiable sounds.
* Add a note about bugs.debian.org to the banner.
* Add noload for res_config_* since loading them results in errors and
  doesn't provide any functionality.
* News entries were added but we never shipped the file; ship NEWS.Debian.
* Add an entry to NEWS.Debian warning users about app_voicemail_*.so
  (Closes: #452596)
* Provide options in /etc/default/asterisk for configuring safe_asterisk.
  (Closes: #381786)

[ Tzafrir Cohen ]
* Provide a custom sounds directory under /var/lib - user-modifieble at
  runtime and hence not under /usr. (Closes: #337209)

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
 
29
29
#include "asterisk.h"
30
30
 
31
 
ASTERISK_FILE_VERSION(__FILE__, "$Revision: 85057 $")
 
31
ASTERISK_FILE_VERSION(__FILE__, "$Revision: 89630 $")
32
32
 
33
33
#include <stdio.h>
34
34
#include <stdlib.h>
1640
1640
        ast_mutex_unlock(&rtp->bridge_lock);
1641
1641
1642
1642
 
 
1643
/*! \brief remove setting from payload type list if the rtpmap header indicates
 
1644
    an unknown media type */
 
1645
void ast_rtp_unset_m_type(struct ast_rtp* rtp, int pt) 
 
1646
{
 
1647
        ast_mutex_lock(&rtp->bridge_lock);
 
1648
        rtp->current_RTP_PT[pt].isAstFormat = 0;
 
1649
        rtp->current_RTP_PT[pt].code = 0;
 
1650
        ast_mutex_unlock(&rtp->bridge_lock);
 
1651
}
 
1652
 
1643
1653
/*! \brief Make a note of a RTP payload type (with MIME type) that was seen in
1644
1654
 * an SDP "a=rtpmap:" line.
 
1655
 * \return 0 if the MIME type was found and set, -1 if it wasn't found
1645
1656
 */
1646
 
void ast_rtp_set_rtpmap_type(struct ast_rtp *rtp, int pt,
 
1657
int ast_rtp_set_rtpmap_type(struct ast_rtp *rtp, int pt,
1647
1658
                             char *mimeType, char *mimeSubtype,
1648
1659
                             enum ast_rtp_options options)
1649
1660
{
1650
1661
        unsigned int i;
 
1662
        int found = 0;
1651
1663
 
1652
1664
        if (pt < 0 || pt > MAX_RTP_PT) 
1653
 
                return; /* bogus payload type */
 
1665
                return -1; /* bogus payload type */
1654
1666
        
1655
1667
        ast_mutex_lock(&rtp->bridge_lock);
1656
1668
 
1657
1669
        for (i = 0; i < sizeof(mimeTypes)/sizeof(mimeTypes[0]); ++i) {
1658
1670
                if (strcasecmp(mimeSubtype, mimeTypes[i].subtype) == 0 &&
1659
1671
                    strcasecmp(mimeType, mimeTypes[i].type) == 0) {
 
1672
                        found = 1;
1660
1673
                        rtp->current_RTP_PT[pt] = mimeTypes[i].payloadType;
1661
1674
                        if ((mimeTypes[i].payloadType.code == AST_FORMAT_G726) &&
1662
1675
                            mimeTypes[i].payloadType.isAstFormat &&
1668
1681
 
1669
1682
        ast_mutex_unlock(&rtp->bridge_lock);
1670
1683
 
1671
 
        return;
 
1684
        return (found ? 0 : -1);
1672
1685
1673
1686
 
1674
1687
/*! \brief Return the union of all of the codecs that were set by rtp_set...() calls 
2839
2852
                /* Check if anything changed */
2840
2853
                if ((c0->tech_pvt != pvt0) ||
2841
2854
                    (c1->tech_pvt != pvt1) ||
2842
 
                    (c0->masq || c0->masqr || c1->masq || c1->masqr)) {
 
2855
                    (c0->masq || c0->masqr || c1->masq || c1->masqr) ||
 
2856
                    (c0->monitor || c0->spies || c1->monitor || c1->spies)) {
2843
2857
                        ast_log(LOG_DEBUG, "Oooh, something is weird, backing out\n");
2844
2858
                        if (c0->tech_pvt == pvt0)
2845
2859
                                if (pr0->set_rtp_peer(c0, NULL, NULL, 0, 0))
2912
2926
                }
2913
2927
                fr = ast_read(who);
2914
2928
                other = (who == c0) ? c1 : c0;
2915
 
                if (!fr || ((fr->frametype == AST_FRAME_DTMF) &&
 
2929
                if (!fr || ((fr->frametype == AST_FRAME_DTMF_BEGIN || fr->frametype == AST_FRAME_DTMF_END) &&
2916
2930
                            (((who == c0) && (flags & AST_BRIDGE_DTMF_CHANNEL_0)) ||
2917
2931
                             ((who == c1) && (flags & AST_BRIDGE_DTMF_CHANNEL_1))))) {
2918
2932
                        /* Break out of bridge */
2964
2978
                        }
2965
2979
                } else {
2966
2980
                        if ((fr->frametype == AST_FRAME_DTMF_BEGIN) ||
2967
 
                            (fr->frametype == AST_FRAME_DTMF) ||
 
2981
                            (fr->frametype == AST_FRAME_DTMF_END) ||
2968
2982
                            (fr->frametype == AST_FRAME_VOICE) ||
2969
2983
                            (fr->frametype == AST_FRAME_VIDEO) ||
2970
2984
                            (fr->frametype == AST_FRAME_IMAGE) ||
3116
3130
                /* Check if anything changed */
3117
3131
                if ((c0->tech_pvt != pvt0) ||
3118
3132
                    (c1->tech_pvt != pvt1) ||
3119
 
                    (c0->masq || c0->masqr || c1->masq || c1->masqr)) {
 
3133
                    (c0->masq || c0->masqr || c1->masq || c1->masqr) ||
 
3134
                    (c0->monitor || c0->spies || c1->monitor || c1->spies)) {
3120
3135
                        ast_log(LOG_DEBUG, "Oooh, something is weird, backing out\n");
3121
3136
                        if ((c0->masq || c0->masqr) && (fr = ast_read(c0)))
3122
3137
                                ast_frfree(fr);
3141
3156
                fr = ast_read(who);
3142
3157
                other = (who == c0) ? c1 : c0;
3143
3158
                /* Dependong on the frame we may need to break out of our bridge */
3144
 
                if (!fr || ((fr->frametype == AST_FRAME_DTMF) &&
 
3159
                if (!fr || ((fr->frametype == AST_FRAME_DTMF_BEGIN || fr->frametype == AST_FRAME_DTMF_END) &&
3145
3160
                            ((who == c0) && (flags & AST_BRIDGE_DTMF_CHANNEL_0)) |
3146
3161
                            ((who == c1) && (flags & AST_BRIDGE_DTMF_CHANNEL_1)))) {
3147
3162
                        /* Record received frame and who */
3183
3198
                        }
3184
3199
                } else {
3185
3200
                        if ((fr->frametype == AST_FRAME_DTMF_BEGIN) ||
3186
 
                            (fr->frametype == AST_FRAME_DTMF) ||
 
3201
                            (fr->frametype == AST_FRAME_DTMF_END) ||
3187
3202
                            (fr->frametype == AST_FRAME_VOICE) ||
3188
3203
                            (fr->frametype == AST_FRAME_VIDEO) ||
3189
3204
                            (fr->frametype == AST_FRAME_IMAGE) ||