summaryrefslogtreecommitdiff
path: root/channels/chan_mgcp.c
diff options
context:
space:
mode:
authorMark Spencer <markster@digium.com>2004-05-27 04:18:46 +0000
committerMark Spencer <markster@digium.com>2004-05-27 04:18:46 +0000
commitcf57ba2310bdee914168291207ef08026e72d3f4 (patch)
tree7728489f3c18e50c46ef634bfbfd808caca0acd3 /channels/chan_mgcp.c
parentfc7593e59467a72367654c7bc637d7d679a35af2 (diff)
Make RTP handle codecs (first pass)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3089 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_mgcp.c')
-rwxr-xr-xchannels/chan_mgcp.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index 9399a9ae6..27adaccfa 100755
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -433,7 +433,7 @@ static int transmit_response(struct mgcp_subchannel *sub, char *msg, struct mgcp
static int transmit_notify_request(struct mgcp_subchannel *sub, char *tone);
static int transmit_modify_request(struct mgcp_subchannel *sub);
static int transmit_notify_request_with_callerid(struct mgcp_subchannel *sub, char *tone, char *callerid);
-static int transmit_modify_with_sdp(struct mgcp_subchannel *sub, struct ast_rtp *rtp);
+static int transmit_modify_with_sdp(struct mgcp_subchannel *sub, struct ast_rtp *rtp, int codecs);
static int transmit_connection_del(struct mgcp_subchannel *sub);
static int transmit_audit_endpoint(struct mgcp_endpoint *p);
static void start_rtp(struct mgcp_subchannel *sub);
@@ -1908,13 +1908,17 @@ static int add_sdp(struct mgcp_request *resp, struct mgcp_subchannel *sub, struc
return 0;
}
-static int transmit_modify_with_sdp(struct mgcp_subchannel *sub, struct ast_rtp *rtp)
+static int transmit_modify_with_sdp(struct mgcp_subchannel *sub, struct ast_rtp *rtp, int codecs)
{
struct mgcp_request resp;
char local[256];
char tmp[80];
int x;
+ int capability;
struct mgcp_endpoint *p = sub->parent;
+ capability = p->capability;
+ if (codecs)
+ capability = codecs;
if (!strlen(sub->cxident) && rtp) {
/* We don't have a CXident yet, store the destination and
wait a bit */
@@ -1923,7 +1927,7 @@ static int transmit_modify_with_sdp(struct mgcp_subchannel *sub, struct ast_rtp
}
snprintf(local, sizeof(local), "p:20");
for (x=1;x<= AST_FORMAT_MAX_AUDIO; x <<= 1) {
- if (p->capability & x) {
+ if (capability & x) {
snprintf(tmp, sizeof(tmp), ", a:%s", ast_rtp_lookup_mime_subtype(1, x));
strcat(local, tmp);
}
@@ -2298,7 +2302,7 @@ static void handle_response(struct mgcp_endpoint *p, struct mgcp_subchannel *sub
}
strncpy(sub->cxident, c, sizeof(sub->cxident) - 1);
if (sub->tmpdest.sin_addr.s_addr) {
- transmit_modify_with_sdp(sub, NULL);
+ transmit_modify_with_sdp(sub, NULL, 0);
}
}
else {
@@ -3710,13 +3714,13 @@ static struct ast_rtp *mgcp_get_rtp_peer(struct ast_channel *chan)
return NULL;
}
-static int mgcp_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp, struct ast_rtp *vrtp)
+static int mgcp_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp, struct ast_rtp *vrtp, int codecs)
{
/* XXX Is there such thing as video support with MGCP? XXX */
struct mgcp_subchannel *sub;
sub = chan->pvt->pvt;
if (sub) {
- transmit_modify_with_sdp(sub, rtp);
+ transmit_modify_with_sdp(sub, rtp, codecs);
return 0;
}
return -1;