sdp.c Send octet-align in fmtp

rfc4867 8.2:

      octet-align: Permissible values are 0 and 1.  If 1, octet-aligned
               operation SHALL be used.  If 0 or if not present,
               bandwidth-efficient operation is employed.

We don't have any support for AMR BE mode, but if we don't
send this the other end expects BE mode and can't decode the stream

Change-Id: I938758ac4ec55db9223e3da6c3c277e8fa670055
This commit is contained in:
Keith Whyte 2017-08-29 16:56:11 +02:00 committed by Holger Freyther
parent 148df95d42
commit b603272787
1 changed files with 10 additions and 1 deletions

View File

@ -166,18 +166,27 @@ bool sdp_extract_sdp(struct sip_call_leg *leg, const sip_t *sip, bool any_codec)
char *sdp_create_file(struct sip_call_leg *leg, struct call_leg *other) char *sdp_create_file(struct sip_call_leg *leg, struct call_leg *other)
{ {
struct in_addr net = { .s_addr = ntohl(other->ip) }; struct in_addr net = { .s_addr = ntohl(other->ip) };
char *fmtp_str = NULL, *sdp;
leg->wanted_codec = app_media_name(other->payload_msg_type); leg->wanted_codec = app_media_name(other->payload_msg_type);
return talloc_asprintf(leg,
if (strcmp(leg->wanted_codec, "AMR") == 0)
fmtp_str = talloc_asprintf(leg, "a=fmtp:%d octet-align=1\r\n", other->payload_type);
sdp = talloc_asprintf(leg,
"v=0\r\n" "v=0\r\n"
"o=Osmocom 0 0 IN IP4 %s\r\n" "o=Osmocom 0 0 IN IP4 %s\r\n"
"s=GSM Call\r\n" "s=GSM Call\r\n"
"c=IN IP4 %s\r\n" "c=IN IP4 %s\r\n"
"t=0 0\r\n" "t=0 0\r\n"
"m=audio %d RTP/AVP %d\r\n" "m=audio %d RTP/AVP %d\r\n"
"%s"
"a=rtpmap:%d %s/8000\r\n", "a=rtpmap:%d %s/8000\r\n",
inet_ntoa(net), inet_ntoa(net), /* never use diff. addr! */ inet_ntoa(net), inet_ntoa(net), /* never use diff. addr! */
other->port, other->payload_type, other->port, other->payload_type,
fmtp_str ? fmtp_str : "",
other->payload_type, other->payload_type,
leg->wanted_codec); leg->wanted_codec);
talloc_free(fmtp_str);
return sdp;
} }