[asterisk-commits] russell: branch russell/messaging r306868 - in /team/russell/messaging: ./ ad...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Feb 8 11:06:03 CST 2011
Author: russell
Date: Tue Feb 8 11:05:51 2011
New Revision: 306868
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=306868
Log:
resolve conflict, enable automerge
Added:
team/russell/messaging/include/asterisk/format.h
- copied unchanged from r306867, trunk/include/asterisk/format.h
team/russell/messaging/include/asterisk/format_cap.h
- copied unchanged from r306867, trunk/include/asterisk/format_cap.h
team/russell/messaging/include/asterisk/format_pref.h
- copied unchanged from r306867, trunk/include/asterisk/format_pref.h
team/russell/messaging/main/format.c
- copied unchanged from r306867, trunk/main/format.c
team/russell/messaging/main/format_cap.c
- copied unchanged from r306867, trunk/main/format_cap.c
team/russell/messaging/main/format_pref.c
- copied unchanged from r306867, trunk/main/format_pref.c
team/russell/messaging/phoneprov/snom-mac.xml
- copied unchanged from r306867, trunk/phoneprov/snom-mac.xml
team/russell/messaging/tests/test_format_api.c
- copied unchanged from r306867, trunk/tests/test_format_api.c
Modified:
team/russell/messaging/ (props changed)
team/russell/messaging/CHANGES
team/russell/messaging/addons/chan_mobile.c
team/russell/messaging/addons/chan_ooh323.c
team/russell/messaging/addons/chan_ooh323.h
team/russell/messaging/addons/format_mp3.c
team/russell/messaging/addons/ooh323cDriver.c
team/russell/messaging/addons/ooh323cDriver.h
team/russell/messaging/apps/app_alarmreceiver.c
team/russell/messaging/apps/app_amd.c
team/russell/messaging/apps/app_chanspy.c
team/russell/messaging/apps/app_confbridge.c
team/russell/messaging/apps/app_dahdibarge.c
team/russell/messaging/apps/app_dial.c
team/russell/messaging/apps/app_dictate.c
team/russell/messaging/apps/app_dumpchan.c
team/russell/messaging/apps/app_echo.c
team/russell/messaging/apps/app_fax.c
team/russell/messaging/apps/app_festival.c
team/russell/messaging/apps/app_followme.c
team/russell/messaging/apps/app_ices.c
team/russell/messaging/apps/app_jack.c
team/russell/messaging/apps/app_meetme.c
team/russell/messaging/apps/app_milliwatt.c
team/russell/messaging/apps/app_mixmonitor.c
team/russell/messaging/apps/app_mp3.c
team/russell/messaging/apps/app_nbscat.c
team/russell/messaging/apps/app_originate.c
team/russell/messaging/apps/app_parkandannounce.c
team/russell/messaging/apps/app_queue.c
team/russell/messaging/apps/app_record.c
team/russell/messaging/apps/app_rpt.c
team/russell/messaging/apps/app_sendtext.c
team/russell/messaging/apps/app_sms.c
team/russell/messaging/apps/app_speech_utils.c
team/russell/messaging/apps/app_talkdetect.c
team/russell/messaging/apps/app_test.c
team/russell/messaging/apps/app_voicemail.c
team/russell/messaging/apps/app_waitforsilence.c
team/russell/messaging/bridges/bridge_multiplexed.c
team/russell/messaging/bridges/bridge_simple.c
team/russell/messaging/bridges/bridge_softmix.c
team/russell/messaging/cel/cel_radius.c
team/russell/messaging/channels/chan_agent.c
team/russell/messaging/channels/chan_alsa.c
team/russell/messaging/channels/chan_bridge.c
team/russell/messaging/channels/chan_console.c
team/russell/messaging/channels/chan_dahdi.c
team/russell/messaging/channels/chan_gtalk.c
team/russell/messaging/channels/chan_h323.c
team/russell/messaging/channels/chan_iax2.c
team/russell/messaging/channels/chan_jingle.c
team/russell/messaging/channels/chan_local.c
team/russell/messaging/channels/chan_mgcp.c
team/russell/messaging/channels/chan_misdn.c
team/russell/messaging/channels/chan_multicast_rtp.c
team/russell/messaging/channels/chan_nbs.c
team/russell/messaging/channels/chan_oss.c
team/russell/messaging/channels/chan_phone.c
team/russell/messaging/channels/chan_sip.c
team/russell/messaging/channels/chan_skinny.c
team/russell/messaging/channels/chan_unistim.c
team/russell/messaging/channels/chan_usbradio.c
team/russell/messaging/channels/chan_vpb.cc
team/russell/messaging/channels/h323/ast_h323.cxx
team/russell/messaging/channels/h323/chan_h323.h
team/russell/messaging/channels/iax2-parser.c
team/russell/messaging/channels/iax2-parser.h
team/russell/messaging/channels/iax2-provision.c
team/russell/messaging/channels/iax2.h
team/russell/messaging/channels/sig_pri.c
team/russell/messaging/channels/sig_pri.h
team/russell/messaging/channels/sip/include/globals.h
team/russell/messaging/channels/sip/include/sip.h
team/russell/messaging/codecs/codec_a_mu.c
team/russell/messaging/codecs/codec_adpcm.c
team/russell/messaging/codecs/codec_alaw.c
team/russell/messaging/codecs/codec_dahdi.c
team/russell/messaging/codecs/codec_g722.c
team/russell/messaging/codecs/codec_g726.c
team/russell/messaging/codecs/codec_gsm.c
team/russell/messaging/codecs/codec_ilbc.c
team/russell/messaging/codecs/codec_lpc10.c
team/russell/messaging/codecs/codec_resample.c
team/russell/messaging/codecs/codec_speex.c
team/russell/messaging/codecs/codec_ulaw.c
team/russell/messaging/codecs/ex_adpcm.h
team/russell/messaging/codecs/ex_alaw.h
team/russell/messaging/codecs/ex_g722.h
team/russell/messaging/codecs/ex_g726.h
team/russell/messaging/codecs/ex_gsm.h
team/russell/messaging/codecs/ex_ilbc.h
team/russell/messaging/codecs/ex_lpc10.h
team/russell/messaging/codecs/ex_speex.h
team/russell/messaging/codecs/ex_ulaw.h
team/russell/messaging/configs/chan_dahdi.conf.sample
team/russell/messaging/configs/phoneprov.conf.sample
team/russell/messaging/configure
team/russell/messaging/configure.ac
team/russell/messaging/doc/asterisk.sgml
team/russell/messaging/formats/format_g719.c
team/russell/messaging/formats/format_g723.c
team/russell/messaging/formats/format_g726.c
team/russell/messaging/formats/format_g729.c
team/russell/messaging/formats/format_gsm.c
team/russell/messaging/formats/format_h263.c
team/russell/messaging/formats/format_h264.c
team/russell/messaging/formats/format_ilbc.c
team/russell/messaging/formats/format_jpeg.c
team/russell/messaging/formats/format_ogg_vorbis.c
team/russell/messaging/formats/format_pcm.c
team/russell/messaging/formats/format_siren14.c
team/russell/messaging/formats/format_siren7.c
team/russell/messaging/formats/format_sln.c
team/russell/messaging/formats/format_sln16.c
team/russell/messaging/formats/format_vox.c
team/russell/messaging/formats/format_wav.c
team/russell/messaging/formats/format_wav_gsm.c
team/russell/messaging/funcs/func_channel.c
team/russell/messaging/funcs/func_frame_trace.c
team/russell/messaging/funcs/func_pitchshift.c
team/russell/messaging/include/asterisk/abstract_jb.h
team/russell/messaging/include/asterisk/astobj2.h
team/russell/messaging/include/asterisk/audiohook.h
team/russell/messaging/include/asterisk/autoconfig.h.in
team/russell/messaging/include/asterisk/bridging.h
team/russell/messaging/include/asterisk/bridging_technology.h
team/russell/messaging/include/asterisk/callerid.h
team/russell/messaging/include/asterisk/channel.h
team/russell/messaging/include/asterisk/data.h
team/russell/messaging/include/asterisk/file.h
team/russell/messaging/include/asterisk/frame.h
team/russell/messaging/include/asterisk/frame_defs.h
team/russell/messaging/include/asterisk/image.h
team/russell/messaging/include/asterisk/mod_format.h
team/russell/messaging/include/asterisk/pbx.h
team/russell/messaging/include/asterisk/rtp_engine.h
team/russell/messaging/include/asterisk/sched.h
team/russell/messaging/include/asterisk/slin.h
team/russell/messaging/include/asterisk/slinfactory.h
team/russell/messaging/include/asterisk/speech.h
team/russell/messaging/include/asterisk/translate.h
team/russell/messaging/main/abstract_jb.c
team/russell/messaging/main/app.c
team/russell/messaging/main/asterisk.c
team/russell/messaging/main/astobj2.c
team/russell/messaging/main/audiohook.c
team/russell/messaging/main/bridging.c
team/russell/messaging/main/callerid.c
team/russell/messaging/main/ccss.c
team/russell/messaging/main/channel.c
team/russell/messaging/main/cli.c
team/russell/messaging/main/data.c
team/russell/messaging/main/dial.c
team/russell/messaging/main/dsp.c
team/russell/messaging/main/features.c
team/russell/messaging/main/file.c
team/russell/messaging/main/frame.c
team/russell/messaging/main/http.c
team/russell/messaging/main/image.c
team/russell/messaging/main/indications.c
team/russell/messaging/main/logger.c
team/russell/messaging/main/manager.c
team/russell/messaging/main/pbx.c
team/russell/messaging/main/rtp_engine.c
team/russell/messaging/main/say.c
team/russell/messaging/main/slinfactory.c
team/russell/messaging/main/taskprocessor.c
team/russell/messaging/main/translate.c
team/russell/messaging/main/udptl.c
team/russell/messaging/main/xmldoc.c
team/russell/messaging/pbx/pbx_loopback.c
team/russell/messaging/pbx/pbx_spool.c
team/russell/messaging/res/ais/evt.c
team/russell/messaging/res/res_adsi.c
team/russell/messaging/res/res_agi.c
team/russell/messaging/res/res_calendar.c
team/russell/messaging/res/res_clioriginate.c
team/russell/messaging/res/res_config_ldap.c
team/russell/messaging/res/res_fax.c
team/russell/messaging/res/res_fax_spandsp.c
team/russell/messaging/res/res_http_post.c
team/russell/messaging/res/res_jabber.c
team/russell/messaging/res/res_musiconhold.c
team/russell/messaging/res/res_odbc.c
team/russell/messaging/res/res_rtp_asterisk.c
team/russell/messaging/res/res_rtp_multicast.c
team/russell/messaging/res/res_smdi.c
team/russell/messaging/res/res_speech.c
Propchange: team/russell/messaging/
------------------------------------------------------------------------------
automerge = *
Propchange: team/russell/messaging/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.
Propchange: team/russell/messaging/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Feb 8 11:05:51 2011
@@ -1,1 +1,1 @@
-/trunk:1-305882
+/trunk:1-306867
Modified: team/russell/messaging/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/russell/messaging/CHANGES?view=diff&rev=306868&r1=306867&r2=306868
==============================================================================
--- team/russell/messaging/CHANGES (original)
+++ team/russell/messaging/CHANGES Tue Feb 8 11:05:51 2011
@@ -49,6 +49,10 @@
--------------------------
* Added moh_signaling option to specify what to do when the channel's bridged
peer puts the ISDN channel on hold.
+ * Added display_send and display_receive options to control how the display ie
+ is handled. To send display text from the dialplan use the SendText()
+ application when the option is enabled.
+ * Added mcid_send option to allow sending a MCID request on a span.
------------------------------------------------------------------------------
--- Functionality changes from Asterisk 1.6.2 to Asterisk 1.8 ----------------
Modified: team/russell/messaging/addons/chan_mobile.c
URL: http://svnview.digium.com/svn/asterisk/team/russell/messaging/addons/chan_mobile.c?view=diff&rev=306868&r1=306867&r2=306868
==============================================================================
--- team/russell/messaging/addons/chan_mobile.c (original)
+++ team/russell/messaging/addons/chan_mobile.c Tue Feb 8 11:05:51 2011
@@ -71,7 +71,7 @@
#define DEVICE_FRAME_FORMAT AST_FORMAT_SLINEAR
#define CHANNEL_FRAME_SIZE 320
-static format_t prefformat = DEVICE_FRAME_FORMAT;
+static struct ast_format prefformat;
static int discovery_interval = 60; /* The device discovery interval, default 60 seconds. */
static pthread_t discovery_thread = AST_PTHREADT_NULL; /* The discovery thread */
@@ -196,7 +196,7 @@
static struct ast_channel *mbl_new(int state, struct mbl_pvt *pvt, char *cid_num,
const struct ast_channel *requestor);
-static struct ast_channel *mbl_request(const char *type, format_t format,
+static struct ast_channel *mbl_request(const char *type, struct ast_format_cap *cap,
const struct ast_channel *requestor, void *data, int *cause);
static int mbl_call(struct ast_channel *ast, char *dest, int timeout);
static int mbl_hangup(struct ast_channel *ast);
@@ -450,10 +450,9 @@
* channel stuff
*/
-static const struct ast_channel_tech mbl_tech = {
+static struct ast_channel_tech mbl_tech = {
.type = "Mobile",
.description = "Bluetooth Mobile Device Channel Driver",
- .capabilities = AST_FORMAT_SLINEAR,
.requester = mbl_request,
.call = mbl_call,
.hangup = mbl_hangup,
@@ -844,11 +843,11 @@
}
chn->tech = &mbl_tech;
- chn->nativeformats = prefformat;
- chn->rawreadformat = prefformat;
- chn->rawwriteformat = prefformat;
- chn->writeformat = prefformat;
- chn->readformat = prefformat;
+ ast_format_cap_add(chn->nativeformats, &prefformat);
+ ast_format_copy(&chn->rawreadformat, &prefformat);
+ ast_format_copy(&chn->rawwriteformat, &prefformat);
+ ast_format_copy(&chn->writeformat, &prefformat);
+ ast_format_copy(&chn->readformat, &prefformat);
chn->tech_pvt = pvt;
if (state == AST_STATE_RING)
@@ -867,7 +866,7 @@
return NULL;
}
-static struct ast_channel *mbl_request(const char *type, format_t format,
+static struct ast_channel *mbl_request(const char *type, struct ast_format_cap *cap,
const struct ast_channel *requestor, void *data, int *cause)
{
@@ -875,7 +874,6 @@
struct mbl_pvt *pvt;
char *dest_dev = NULL;
char *dest_num = NULL;
- format_t oldformat;
int group = -1;
if (!data) {
@@ -884,10 +882,9 @@
return NULL;
}
- oldformat = format;
- format &= (AST_FORMAT_SLINEAR);
- if (!format) {
- ast_log(LOG_WARNING, "Asked to get a channel of unsupported format '%s'\n", ast_getformatname(oldformat));
+ if (!(ast_format_cap_iscompatible(cap, &prefformat))) {
+ char tmp[256];
+ ast_log(LOG_WARNING, "Asked to get a channel of unsupported format '%s'\n", ast_getformatname_multiple(tmp, sizeof(tmp), cap));
*cause = AST_CAUSE_FACILITY_NOT_IMPLEMENTED;
return NULL;
}
@@ -1099,7 +1096,7 @@
memset(&pvt->fr, 0x00, sizeof(struct ast_frame));
pvt->fr.frametype = AST_FRAME_VOICE;
- pvt->fr.subclass.codec = DEVICE_FRAME_FORMAT;
+ ast_format_set(&pvt->fr.subclass.format, DEVICE_FRAME_FORMAT, 0);
pvt->fr.src = "Mobile";
pvt->fr.offset = AST_FRIENDLY_OFFSET;
pvt->fr.mallocd = 0;
@@ -4534,6 +4531,7 @@
if (sdp_session)
sdp_close(sdp_session);
+ mbl_tech.capabilities = ast_format_cap_destroy(mbl_tech.capabilities);
return 0;
}
@@ -4542,6 +4540,11 @@
int dev_id, s;
+ if (!(mbl_tech.capabilities = ast_format_cap_alloc())) {
+ return AST_MODULE_LOAD_DECLINE;
+ }
+ ast_format_set(&prefformat, DEVICE_FRAME_FORMAT, 0);
+ ast_format_cap_add(mbl_tech.capabilities, &prefformat);
/* Check if we have Bluetooth, no point loading otherwise... */
dev_id = hci_get_route(NULL);
s = hci_open_dev(dev_id);
Modified: team/russell/messaging/addons/chan_ooh323.c
URL: http://svnview.digium.com/svn/asterisk/team/russell/messaging/addons/chan_ooh323.c?view=diff&rev=306868&r1=306867&r2=306868
==============================================================================
--- team/russell/messaging/addons/chan_ooh323.c (original)
+++ team/russell/messaging/addons/chan_ooh323.c Tue Feb 8 11:05:51 2011
@@ -66,7 +66,7 @@
static struct ast_jb_conf global_jbconf;
/* Channel Definition */
-static struct ast_channel *ooh323_request(const char *type, format_t format,
+static struct ast_channel *ooh323_request(const char *type, struct ast_format_cap *cap,
const struct ast_channel *requestor, void *data, int *cause);
static int ooh323_digit_begin(struct ast_channel *ast, char digit);
static int ooh323_digit_end(struct ast_channel *ast, char digit, unsigned int duration);
@@ -82,7 +82,7 @@
static enum ast_rtp_glue_result ooh323_get_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance **rtp);
static enum ast_rtp_glue_result ooh323_get_vrtp_peer(struct ast_channel *chan, struct ast_rtp_instance **rtp);
static int ooh323_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *rtp,
- struct ast_rtp_instance *vrtp, struct ast_rtp_instance *trtp, format_t codecs, int nat_active);
+ struct ast_rtp_instance *vrtp, struct ast_rtp_instance *trtp, const struct ast_format_cap *codecs, int nat_active);
static struct ast_udptl *ooh323_get_udptl_peer(struct ast_channel *chan);
static int ooh323_set_udptl_peer(struct ast_channel *chan, struct ast_udptl *udptl);
@@ -92,10 +92,9 @@
struct ooh323_peer *find_friend(const char *name, int port);
-static const struct ast_channel_tech ooh323_tech = {
+static struct ast_channel_tech ooh323_tech = {
.type = type,
.description = tdesc,
- .capabilities = -1,
.properties = AST_CHAN_TP_WANTSJITTER | AST_CHAN_TP_CREATESJITTER,
.requester = ooh323_request,
.send_digit_begin = ooh323_digit_begin,
@@ -172,9 +171,9 @@
char callee_url[AST_MAX_EXTENSION];
int port;
- format_t readformat; /* negotiated read format */
- format_t writeformat; /* negotiated write format */
- format_t capability;
+ struct ast_format readformat; /* negotiated read format */
+ struct ast_format writeformat; /* negotiated write format */
+ struct ast_format_cap *cap;
struct ast_codec_pref prefs;
int dtmfmode;
int dtmfcodec;
@@ -204,7 +203,7 @@
unsigned inUse;
char accountcode[20];
int amaflags;
- format_t capability;
+ struct ast_format_cap *cap;
struct ast_codec_pref prefs;
int dtmfmode;
int dtmfcodec;
@@ -225,7 +224,7 @@
char name[256];
unsigned outgoinglimit;
unsigned outUse;
- format_t capability;
+ struct ast_format_cap *cap;
struct ast_codec_pref prefs;
char accountcode[20];
int amaflags;
@@ -286,7 +285,7 @@
static char gIP[20];
static char gCallerID[AST_MAX_EXTENSION] = "";
static struct ooAliases *gAliasList;
-static format_t gCapability = AST_FORMAT_ULAW;
+static struct ast_format_cap *gCap;
static struct ast_codec_pref gPrefs;
static int gDTMFMode = H323_DTMF_RFC2833;
static int gDTMFCodec = 101;
@@ -337,14 +336,14 @@
static struct ast_channel *ooh323_new(struct ooh323_pvt *i, int state,
- const char *host, int capability, const char *linkedid)
+ const char *host, struct ast_format_cap *cap, const char *linkedid)
{
struct ast_channel *ch = NULL;
- int fmt = 0;
- if (gH323Debug)
- ast_verbose("--- ooh323_new - %s, %d\n", host, capability);
-
-
+ struct ast_format tmpfmt;
+ if (gH323Debug)
+ ast_verbose("--- ooh323_new - %s\n", host);
+
+ ast_format_clear(&tmpfmt);
/* Don't hold a h323 pvt lock while we allocate a channel */
ast_mutex_unlock(&i->lock);
ch = ast_channel_alloc(1, state, i->callerid_num, i->callerid_name,
@@ -360,12 +359,14 @@
ast_channel_lock(ch);
ch->tech = &ooh323_tech;
- if (capability)
- fmt = ast_best_codec(capability);
- if (!fmt)
- fmt = ast_codec_pref_index(&i->prefs, 0);
-
- ch->nativeformats = ch->rawwriteformat = ch->rawreadformat = fmt;
+ if (cap)
+ ast_best_codec(cap, &tmpfmt);
+ if (!tmpfmt.id)
+ ast_codec_pref_index(&i->prefs, 0, &tmpfmt);
+
+ ast_format_cap_add(ch->nativeformats, &tmpfmt);
+ ast_format_copy(&ch->rawwriteformat, &tmpfmt);
+ ast_format_copy(&ch->rawreadformat, &tmpfmt);
ast_channel_set_fd(ch, 0, ast_rtp_instance_fd(i->rtp, 0));
ast_channel_set_fd(ch, 1, ast_rtp_instance_fd(i->rtp, 1));
@@ -377,8 +378,8 @@
ch->rings = 1;
ch->adsicpe = AST_ADSI_UNAVAILABLE;
- ast_set_write_format(ch, fmt);
- ast_set_read_format(ch, fmt);
+ ast_set_write_format(ch, &tmpfmt);
+ ast_set_read_format(ch, &tmpfmt);
ch->tech_pvt = i;
i->owner = ch;
ast_module_ref(myself);
@@ -472,6 +473,11 @@
ast_log(LOG_ERROR, "Couldn't allocate private ooh323 structure\n");
return NULL;
}
+ if (!(pvt->cap = ast_format_cap_alloc_nolock())) {
+ ast_free(pvt);
+ ast_log(LOG_ERROR, "Couldn't allocate private ooh323 structure\n");
+ return NULL;
+ }
ast_mutex_init(&pvt->lock);
ast_mutex_lock(&pvt->lock);
@@ -529,7 +535,7 @@
ast_copy_string(pvt->accountcode, gAccountcode, sizeof(pvt->accountcode));
pvt->amaflags = gAMAFLAGS;
- pvt->capability = gCapability;
+ ast_format_cap_copy(pvt->cap, gCap);
memcpy(&pvt->prefs, &gPrefs, sizeof(pvt->prefs));
ast_mutex_unlock(&pvt->lock);
@@ -549,7 +555,7 @@
/*
Possible data values - peername, exten/peername, exten at ip
*/
-static struct ast_channel *ooh323_request(const char *type, format_t format,
+static struct ast_channel *ooh323_request(const char *type, struct ast_format_cap *cap,
const struct ast_channel *requestor, void *data, int *cause)
{
@@ -560,17 +566,14 @@
char *ext = NULL;
char tmp[256];
char formats[FORMAT_STRING_SIZE];
- int oldformat;
int port = 0;
if (gH323Debug)
ast_verbose("--- ooh323_request - data %s format %s\n", (char*)data,
- ast_getformatname_multiple(formats,FORMAT_STRING_SIZE,format));
-
- oldformat = format;
- format &= AST_FORMAT_AUDIO_MASK;
- if (!format) {
- ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%lld'\n", (long long) format);
+ ast_getformatname_multiple(formats,FORMAT_STRING_SIZE,cap));
+
+ if (!(ast_format_cap_has_type(cap, AST_FORMAT_TYPE_AUDIO))) {
+ ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%s'\n", ast_getformatname_multiple(formats,FORMAT_STRING_SIZE,cap));
return NULL;
}
@@ -633,7 +636,7 @@
if (ext)
ast_copy_string(p->exten, ext, sizeof(p->exten));
- p->capability = peer->capability;
+ ast_format_cap_copy(p->cap, peer->cap);
memcpy(&p->prefs, &peer->prefs, sizeof(struct ast_codec_pref));
p->dtmfmode |= peer->dtmfmode;
p->dtmfcodec = peer->dtmfcodec;
@@ -667,7 +670,7 @@
p->dtmfcodec = gDTMFCodec;
p->t38support = gT38Support;
p->rtptimeout = gRTPTimeout;
- p->capability = gCapability;
+ ast_format_cap_copy(p->cap, gCap);
p->rtdrinterval = gRTDRInterval;
p->rtdrcount = gRTDRCount;
p->faststart = gFastStart;
@@ -686,7 +689,7 @@
}
- chan = ooh323_new(p, AST_STATE_DOWN, p->username, format,
+ chan = ooh323_new(p, AST_STATE_DOWN, p->username, cap,
requestor ? requestor->linkedid : NULL);
ast_mutex_unlock(&p->lock);
@@ -1034,13 +1037,13 @@
if (gH323Debug)
ast_verbose(" hanging %s with cause: %d\n", p->username, q931cause);
- ast->tech_pvt = NULL;
+ ast->tech_pvt = NULL;
if (!ast_test_flag(p, H323_ALREADYGONE)) {
- ooHangCall(p->callToken,
+ ooHangCall(p->callToken,
ooh323_convert_hangupcause_asteriskToH323(q931cause), q931cause);
ast_set_flag(p, H323_ALREADYGONE);
/* ast_mutex_unlock(&p->lock); */
- } else
+ } else
ast_set_flag(p, H323_NEEDDESTROY);
/* detach channel here */
if (p->owner) {
@@ -1056,11 +1059,11 @@
/* Notify the module monitors that use count for resource has changed */
ast_update_use_count();
-
+
} else {
ast_debug(1, "No call to hangup\n" );
}
-
+
if (gH323Debug)
ast_verbose("+++ ooh323_hangup\n");
@@ -1080,8 +1083,7 @@
if (ast->_state != AST_STATE_UP) {
ast_channel_lock(ast);
ast_setstate(ast, AST_STATE_UP);
- if (option_debug)
- ast_debug(1, "ooh323_answer(%s)\n", ast->name);
+ ast_debug(1, "ooh323_answer(%s)\n", ast->name);
ast_channel_unlock(ast);
ooAnswerCall(p->callToken);
}
@@ -1130,26 +1132,25 @@
return res;
}
-
if (f->frametype == AST_FRAME_VOICE) {
/* sending progress for first */
if (!ast_test_flag(p, H323_OUTGOING) && !p->progsent &&
- p->callToken) {
+ p->callToken) {
ooManualProgress(p->callToken);
p->progsent = 1;
}
- if (!(f->subclass.codec & ast->nativeformats)) {
- if (ast->nativeformats != 0) {
+ if (!(ast_format_cap_iscompatible(ast->nativeformats, &f->subclass.format))) {
+ if (!(ast_format_cap_is_empty(ast->nativeformats))) {
ast_log(LOG_WARNING,
"Asked to transmit frame type %s, while native formats is %s (read/write = %s/%s)\n",
- ast_getformatname(f->subclass.codec),
+ ast_getformatname(&f->subclass.format),
ast_getformatname_multiple(buf, sizeof(buf), ast->nativeformats),
- ast_getformatname(ast->readformat),
- ast_getformatname(ast->writeformat));
-
- ast_set_write_format(ast, f->subclass.codec);
+ ast_getformatname(&ast->readformat),
+ ast_getformatname(&ast->writeformat));
+
+ ast_set_write_format(ast, &f->subclass.format);
} else {
/* ast_set_write_format(ast, f->subclass);
ast->nativeformats = f->subclass; */
@@ -1198,48 +1199,50 @@
if (gH323Debug)
ast_verbose("----- ooh323_indicate %d on call %s\n", condition, callToken);
-
- ast_mutex_lock(&p->lock);
+
+ ast_mutex_lock(&p->lock);
switch (condition) {
case AST_CONTROL_CONGESTION:
if (!ast_test_flag(p, H323_ALREADYGONE)) {
- ooHangCall(callToken, OO_REASON_LOCAL_CONGESTED,
+ ooHangCall(callToken, OO_REASON_LOCAL_CONGESTED,
AST_CAUSE_SWITCH_CONGESTION);
ast_set_flag(p, H323_ALREADYGONE);
}
break;
case AST_CONTROL_BUSY:
if (!ast_test_flag(p, H323_ALREADYGONE)) {
- ooHangCall(callToken, OO_REASON_LOCAL_BUSY, AST_CAUSE_USER_BUSY);
+ ooHangCall(callToken, OO_REASON_LOCAL_BUSY, AST_CAUSE_USER_BUSY);
ast_set_flag(p, H323_ALREADYGONE);
}
break;
case AST_CONTROL_HOLD:
- ast_moh_start(ast, data, NULL);
+ ast_moh_start(ast, data, NULL);
break;
case AST_CONTROL_UNHOLD:
ast_moh_stop(ast);
break;
case AST_CONTROL_PROGRESS:
if (ast->_state != AST_STATE_UP) {
- if (!p->progsent) {
- if (gH323Debug)
- ast_log(LOG_DEBUG,"Sending manual progress for %s, res = %d\n", callToken,
- ooManualProgress(callToken));
- else
- ooManualProgress(callToken);
- p->progsent = 1;
- }
+ if (!p->progsent) {
+ if (gH323Debug) {
+ ast_debug(1, "Sending manual progress for %s, res = %d\n", callToken,
+ ooManualProgress(callToken));
+ } else {
+ ooManualProgress(callToken);
+ }
+ p->progsent = 1;
+ }
}
break;
case AST_CONTROL_RINGING:
if (ast->_state == AST_STATE_RING || ast->_state == AST_STATE_RINGING) {
- if (gH323Debug)
- ast_log(LOG_DEBUG,"Sending manual ringback for %s, res = %d\n",
+ if (gH323Debug) {
+ ast_debug(1, "Sending manual ringback for %s, res = %d\n",
callToken,
- ooManualRingback(callToken));
- else
- ooManualRingback(callToken);
+ ooManualRingback(callToken));
+ } else {
+ ooManualRingback(callToken);
+ }
}
break;
case AST_CONTROL_SRCUPDATE:
@@ -1253,9 +1256,10 @@
|| ast_strlen_zero(ast->connected.id.name.str)) {
break;
}
- if (gH323Debug)
- ast_log(LOG_DEBUG, "Sending connected line info for %s (%s)\n",
+ if (gH323Debug) {
+ ast_debug(1, "Sending connected line info for %s (%s)\n",
callToken, ast->connected.id.name.str);
+ }
ooSetANI(callToken, ast->connected.id.name.str);
break;
@@ -1370,8 +1374,8 @@
if (gH323Debug)
ast_verbose("+++++ ooh323_queryoption %d on channel %s\n", option, ast->name);
-
- ast_mutex_unlock(&p->lock);
+
+ ast_mutex_unlock(&p->lock);
return res;
}
@@ -1409,15 +1413,15 @@
}
-void ooh323_set_write_format(ooCallData *call, int fmt, int txframes)
+void ooh323_set_write_format(ooCallData *call, struct ast_format *fmt, int txframes)
{
struct ooh323_pvt *p = NULL;
char formats[FORMAT_STRING_SIZE];
if (gH323Debug)
- ast_verbose("--- ooh323_update_writeformat %s/%d\n",
- ast_getformatname_multiple(formats,FORMAT_STRING_SIZE, fmt), txframes);
-
+ ast_verbose("--- ooh323_update_writeformat %s/%d\n",
+ ast_getformatname(fmt), txframes);
+
p = find_call(call);
if (!p) {
ast_log(LOG_ERROR, "No matching call found for %s\n", call->callToken);
@@ -1426,11 +1430,11 @@
ast_mutex_lock(&p->lock);
- p->writeformat = fmt;
+ ast_format_copy(&p->writeformat, fmt);
if (p->owner) {
while (p->owner && ast_channel_trylock(p->owner)) {
- ast_debug(1,"Failed to grab lock, trying again\n");
+ ast_debug(1, "Failed to grab lock, trying again\n");
DEADLOCK_AVOIDANCE(&p->lock);
}
if (!p->owner) {
@@ -1439,9 +1443,9 @@
return;
}
if (gH323Debug)
- ast_verbose("Writeformat before update %s/%s\n",
- ast_getformatname_multiple(formats,FORMAT_STRING_SIZE, p->owner->writeformat),
- ast_getformatname_multiple(formats,FORMAT_STRING_SIZE, p->owner->nativeformats));
+ ast_verbose("Writeformat before update %s/%s\n",
+ ast_getformatname(&p->owner->writeformat),
+ ast_getformatname_multiple(formats, sizeof(formats), p->owner->nativeformats));
if (txframes)
ast_codec_pref_setsize(&p->prefs, fmt, txframes);
ast_rtp_codecs_packetization_set(ast_rtp_instance_get_codecs(p->rtp), p->rtp, &p->prefs);
@@ -1454,9 +1458,9 @@
p->rtp, p->dtmfcodec, "audio", "cisco-telephone-event", 0);
}
- p->owner->nativeformats = fmt;
- ast_set_write_format(p->owner, p->owner->writeformat);
- ast_set_read_format(p->owner, p->owner->readformat);
+ ast_format_cap_set(p->owner->nativeformats, fmt);
+ ast_set_write_format(p->owner, &p->owner->writeformat);
+ ast_set_read_format(p->owner, &p->owner->readformat);
ast_channel_unlock(p->owner);
} else
ast_log(LOG_ERROR, "No owner found\n");
@@ -1468,15 +1472,14 @@
ast_verbose("+++ ooh323_update_writeformat\n");
}
-void ooh323_set_read_format(ooCallData *call, int fmt)
+void ooh323_set_read_format(ooCallData *call, struct ast_format *fmt)
{
struct ooh323_pvt *p = NULL;
- char formats[FORMAT_STRING_SIZE];
if (gH323Debug)
ast_verbose("--- ooh323_update_readformat %s\n",
- ast_getformatname_multiple(formats,FORMAT_STRING_SIZE, fmt));
-
+ ast_getformatname(fmt));
+
p = find_call(call);
if (!p) {
ast_log(LOG_ERROR, "No matching call found for %s\n", call->callToken);
@@ -1485,12 +1488,11 @@
ast_mutex_lock(&p->lock);
- p->readformat = fmt;
-
+ ast_format_copy(&p->readformat, fmt);
if (p->owner) {
while (p->owner && ast_channel_trylock(p->owner)) {
- ast_debug(1,"Failed to grab lock, trying again\n");
+ ast_debug(1, "Failed to grab lock, trying again\n");
DEADLOCK_AVOIDANCE(&p->lock);
}
if (!p->owner) {
@@ -1500,12 +1502,12 @@
}
if (gH323Debug)
- ast_verbose("Readformat before update %s\n",
- ast_getformatname_multiple(formats,FORMAT_STRING_SIZE, p->owner->readformat));
- p->owner->nativeformats = fmt;
- ast_set_read_format(p->owner, p->owner->readformat);
+ ast_verbose("Readformat before update %s\n",
+ ast_getformatname(&p->owner->readformat));
+ ast_format_cap_set(p->owner->nativeformats, fmt);
+ ast_set_read_format(p->owner, &p->owner->readformat);
ast_channel_unlock(p->owner);
- } else
+ } else
ast_log(LOG_ERROR, "No owner found\n");
ast_mutex_unlock(&p->lock);
@@ -1523,12 +1525,12 @@
if (gH323Debug)
ast_verbose("--- onAlerting %s\n", call->callToken);
- p = find_call(call);
-
- if(!p) {
+ p = find_call(call);
+
+ if(!p) {
ast_log(LOG_ERROR, "No matching call found\n");
return -1;
- }
+ }
ast_mutex_lock(&p->lock);
if (!p->owner) {
ast_mutex_unlock(&p->lock);
@@ -1536,7 +1538,7 @@
return 0;
}
while (p->owner && ast_channel_trylock(p->owner)) {
- ast_debug(1,"Failed to grab lock, trying again\n");
+ ast_debug(1, "Failed to grab lock, trying again\n");
DEADLOCK_AVOIDANCE(&p->lock);
}
if (!p->owner) {
@@ -1579,12 +1581,12 @@
if (gH323Debug)
ast_verbose("--- onProgress %s\n", call->callToken);
- p = find_call(call);
-
- if(!p) {
+ p = find_call(call);
+
+ if(!p) {
ast_log(LOG_ERROR, "No matching call found\n");
return -1;
- }
+ }
ast_mutex_lock(&p->lock);
if (!p->owner) {
ast_mutex_unlock(&p->lock);
@@ -1592,7 +1594,7 @@
return 0;
}
while (p->owner && ast_channel_trylock(p->owner)) {
- ast_debug(1,"Failed to grab lock, trying again\n");
+ ast_debug(1, "Failed to grab lock, trying again\n");
DEADLOCK_AVOIDANCE(&p->lock);
}
if (!p->owner) {
@@ -1618,8 +1620,8 @@
ast_setstate(c, AST_STATE_RINGING);
ast_queue_control(c, AST_CONTROL_PROGRESS);
- ast_channel_unlock(c);
- ast_mutex_unlock(&p->lock);
+ ast_channel_unlock(c);
+ ast_mutex_unlock(&p->lock);
if (gH323Debug)
ast_verbose("+++ onProgress %s\n", call->callToken);
@@ -1659,7 +1661,7 @@
f.src = "SEND_DIGIT";
while (p->owner && ast_channel_trylock(p->owner)) {
- ast_debug(1,"Failed to grab lock, trying again\n");
+ ast_debug(1, "Failed to grab lock, trying again\n");
DEADLOCK_AVOIDANCE(&p->lock);
}
if (!p->owner) {
@@ -1760,7 +1762,7 @@
ast_copy_string(p->context, user->context, sizeof(p->context));
ast_copy_string(p->accountcode, user->accountcode, sizeof(p->accountcode));
p->amaflags = user->amaflags;
- p->capability = user->capability;
+ ast_format_cap_copy(p->cap, user->cap);
memcpy(&p->prefs, &user->prefs, sizeof(struct ast_codec_pref));
p->dtmfmode |= user->dtmfmode;
p->dtmfcodec = user->dtmfcodec;
@@ -1804,7 +1806,7 @@
}
}
- ooh323c_set_capability_for_call(call, &p->prefs, p->capability, p->dtmfmode, p->dtmfcodec,
+ ooh323c_set_capability_for_call(call, &p->prefs, p->cap, p->dtmfmode, p->dtmfcodec,
p->t38support);
configure_local_rtp(p, call);
@@ -1971,7 +1973,7 @@
p->username?p->username:"NULL", call->callToken, prefsBuf);
}
- ooh323c_set_capability_for_call(call, &p->prefs, p->capability,
+ ooh323c_set_capability_for_call(call, &p->prefs, p->cap,
p->dtmfmode, p->dtmfcodec, p->t38support);
configure_local_rtp(p, call);
@@ -1997,16 +1999,16 @@
return -1;
}
- if(ast_test_flag(p, H323_OUTGOING)) {
+ if(ast_test_flag(p, H323_OUTGOING)) {
ast_mutex_lock(&p->lock);
if (!p->owner) {
ast_mutex_unlock(&p->lock);
ast_log(LOG_ERROR, "Channel has no owner\n");
return -1;
}
-
+
while (p->owner && ast_channel_trylock(p->owner)) {
- ast_debug(1,"Failed to grab lock, trying again\n");
+ ast_debug(1, "Failed to grab lock, trying again\n");
DEADLOCK_AVOIDANCE(&p->lock);
}
if (p->owner) {
@@ -2026,7 +2028,7 @@
}
ast_queue_control(c, AST_CONTROL_ANSWER);
- ast_channel_unlock(p->owner);
+ ast_channel_unlock(p->owner);
manager_event(EVENT_FLAG_SYSTEM,"ChannelUpdate","Channel: %s\r\nChanneltype: %s\r\n"
"CallRef: %d\r\n", c->name, "OOH323", p->call_reference);
}
@@ -2051,42 +2053,42 @@
if ((p = find_call(call))) {
ast_mutex_lock(&p->lock);
-
+
while (p->owner) {
if (ast_channel_trylock(p->owner)) {
ooTrace(OOTRCLVLINFO, "Failed to grab lock, trying again\n");
- ast_log(LOG_DEBUG,"Failed to grab lock, trying again\n");
+ ast_debug(1, "Failed to grab lock, trying again\n");
DEADLOCK_AVOIDANCE(&p->lock);
} else {
- ownerLock = 1; break;
+ ownerLock = 1; break;
}
}
if (ownerLock) {
- if (!ast_test_flag(p, H323_ALREADYGONE)) {
+ if (!ast_test_flag(p, H323_ALREADYGONE)) {
ast_set_flag(p, H323_ALREADYGONE);
p->owner->hangupcause = call->q931cause;
p->owner->_softhangup |= AST_SOFTHANGUP_DEV;
ast_queue_hangup_with_cause(p->owner,call->q931cause);
}
- }
-
- if(p->owner) {
- p->owner->tech_pvt = NULL;
+ }
+
+ if(p->owner) {
+ p->owner->tech_pvt = NULL;
ast_channel_unlock(p->owner);
- p->owner = NULL;
+ p->owner = NULL;
ast_module_unref(myself);
}
ast_set_flag(p, H323_NEEDDESTROY);
- ooh323c_stop_call_thread(call);
+ ooh323c_stop_call_thread(call);
ast_mutex_unlock(&p->lock);
- ast_mutex_lock(&usecnt_lock);
- usecnt--;
- ast_mutex_unlock(&usecnt_lock);
+ ast_mutex_lock(&usecnt_lock);
+ usecnt--;
+ ast_mutex_unlock(&usecnt_lock);
}
@@ -2157,6 +2159,7 @@
if(peer->url) free(peer->url);
if(peer->e164) free(peer->e164);
+ peer->cap = ast_format_cap_destroy(peer->cap);
free(peer);
}
@@ -2177,9 +2180,13 @@
user = ast_calloc(1,sizeof(struct ooh323_user));
if (user) {
memset(user, 0, sizeof(struct ooh323_user));
+ if (!(user->cap = ast_format_cap_alloc_nolock())) {
+ ast_free(user);
+ return NULL;
+ }
ast_mutex_init(&user->lock);
ast_copy_string(user->name, name, sizeof(user->name));
- user->capability = gCapability;
+ ast_format_cap_copy(user->cap, gCap);
memcpy(&user->prefs, &gPrefs, sizeof(user->prefs));
user->rtptimeout = gRTPTimeout;
user->dtmfmode = gDTMFMode;
@@ -2223,14 +2230,14 @@
} else user->rtpmask = NULL;
} else if (!strcasecmp(v->name, "disallow")) {
ast_parse_allow_disallow(&user->prefs,
- &user->capability, v->value, 0);
+ user->cap, v->value, 0);
} else if (!strcasecmp(v->name, "allow")) {
const char* tcodecs = v->value;
if (!strcasecmp(v->value, "all")) {
tcodecs = "ulaw,alaw,g729,g723,gsm";
}
ast_parse_allow_disallow(&user->prefs,
- &user->capability, tcodecs, 1);
+ user->cap, tcodecs, 1);
} else if (!strcasecmp(v->name, "amaflags")) {
user->amaflags = ast_cdr_amaflags2int(v->value);
} else if (!strcasecmp(v->name, "ip")) {
@@ -2286,9 +2293,13 @@
peer = ast_calloc(1, sizeof(*peer));
if (peer) {
memset(peer, 0, sizeof(struct ooh323_peer));
+ if (!(peer->cap = ast_format_cap_alloc_nolock())) {
+ ast_free(peer);
+ return NULL;
+ }
ast_mutex_init(&peer->lock);
ast_copy_string(peer->name, name, sizeof(peer->name));
- peer->capability = gCapability;
+ ast_format_cap_copy(peer->cap, gCap);
memcpy(&peer->prefs, &gPrefs, sizeof(peer->prefs));
peer->rtptimeout = gRTPTimeout;
ast_copy_string(peer->accountcode, gAccountcode, sizeof(peer->accountcode));
@@ -2362,14 +2373,14 @@
sizeof(peer->rtpmaskstr));
} else peer->rtpmask = NULL;
} else if (!strcasecmp(v->name, "disallow")) {
- ast_parse_allow_disallow(&peer->prefs, &peer->capability,
+ ast_parse_allow_disallow(&peer->prefs, peer->cap,
v->value, 0);
} else if (!strcasecmp(v->name, "allow")) {
const char* tcodecs = v->value;
if (!strcasecmp(v->value, "all")) {
tcodecs = "ulaw,alaw,g729,g723,gsm";
}
- ast_parse_allow_disallow(&peer->prefs, &peer->capability,
+ ast_parse_allow_disallow(&peer->prefs, peer->cap,
tcodecs, 1);
} else if (!strcasecmp(v->name, "amaflags")) {
peer->amaflags = ast_cdr_amaflags2int(v->value);
@@ -2475,6 +2486,7 @@
struct ooh323_peer *peer = NULL;
char *cat;
const char *utype;
+ struct ast_format tmpfmt;
if (gH323Debug)
ast_verbose("--- reload_config\n");
@@ -2509,7 +2521,7 @@
gPort = 1720;
gIP[0] = '\0';
strcpy(gCallerID, DEFAULT_H323ID);
- gCapability = AST_FORMAT_ALAW;
+ ast_format_cap_set(gCap, ast_format_set(&tmpfmt, AST_FORMAT_ALAW, 0));
memset(&gPrefs, 0, sizeof(struct ast_codec_pref));
gDTMFMode = H323_DTMF_RFC2833;
gDTMFCodec = 101;
@@ -2678,13 +2690,13 @@
} else if (!strcasecmp(v->name, "accountcode")) {
ast_copy_string(gAccountcode, v->value, sizeof(gAccountcode));
} else if (!strcasecmp(v->name, "disallow")) {
[... 26628 lines stripped ...]
More information about the asterisk-commits
mailing list