From c26c190711a1bbe3b5fff1a93facae333757c56e Mon Sep 17 00:00:00 2001 From: David Vossel Date: Thu, 3 Feb 2011 16:22:10 +0000 Subject: Asterisk media architecture conversion - no more format bitfields This patch is the foundation of an entire new way of looking at media in Asterisk. The code present in this patch is everything required to complete phase1 of my Media Architecture proposal. For more information about this project visit the link below. https://wiki.asterisk.org/wiki/display/AST/Media+Architecture+Proposal The primary function of this patch is to convert all the usages of format bitfields in Asterisk to use the new format and format_cap APIs. Functionally no change in behavior should be present in this patch. Thanks to twilson and russell for all the time they spent reviewing these changes. Review: https://reviewboard.asterisk.org/r/1083/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@306010 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/dial.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'main/dial.c') diff --git a/main/dial.c b/main/dial.c index ba1a2bb53..5c30e287d 100644 --- a/main/dial.c +++ b/main/dial.c @@ -248,13 +248,27 @@ static int begin_dial_channel(struct ast_dial_channel *channel, struct ast_chann { char numsubst[AST_MAX_EXTENSION]; int res = 1; + struct ast_format_cap *cap_all_audio = NULL; + struct ast_format_cap *cap_request; /* Copy device string over */ ast_copy_string(numsubst, channel->device, sizeof(numsubst)); + if (chan) { + cap_request = chan->nativeformats; + } else { + cap_all_audio = ast_format_cap_alloc_nolock(); + ast_format_cap_add_all_by_type(cap_all_audio, AST_FORMAT_TYPE_AUDIO); + cap_request = cap_all_audio; + } + /* If we fail to create our owner channel bail out */ - if (!(channel->owner = ast_request(channel->tech, chan ? chan->nativeformats : AST_FORMAT_AUDIO_MASK, chan, numsubst, &channel->cause))) + if (!(channel->owner = ast_request(channel->tech, cap_request, chan, numsubst, &channel->cause))) { + cap_all_audio = ast_format_cap_destroy(cap_all_audio); return -1; + } + cap_request = NULL; + cap_all_audio = ast_format_cap_destroy(cap_all_audio); channel->owner->appl = "AppDial2"; channel->owner->data = "(Outgoing Line)"; -- cgit v1.2.3