[svn-commits] file: branch file/rtp_engine r129109 - /team/file/rtp_engine/channels/chan_sip.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Tue Jul 8 13:57:33 CDT 2008
Author: file
Date: Tue Jul 8 13:57:32 2008
New Revision: 129109
URL: http://svn.digium.com/view/asterisk?view=rev&rev=129109
Log:
Move timeouts over and codec negotiation.
Modified:
team/file/rtp_engine/channels/chan_sip.c
Modified: team/file/rtp_engine/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/file/rtp_engine/channels/chan_sip.c?view=diff&rev=129109&r1=129108&r2=129109
==============================================================================
--- team/file/rtp_engine/channels/chan_sip.c (original)
+++ team/file/rtp_engine/channels/chan_sip.c Tue Jul 8 13:57:32 2008
@@ -4150,22 +4150,22 @@
if (dialog->rtp) { /* Audio */
ast_rtp_instance_set_prop(dialog->rtp, AST_RTP_PROPERTY_DTMF, ast_test_flag(&dialog->flags[0], SIP_DTMF) == SIP_DTMF_RFC2833);
ast_rtp_instance_set_prop(dialog->rtp, AST_RTP_PROPERTY_DTMF_COMPENSATE, ast_test_flag(&dialog->flags[1], SIP_PAGE2_RFC2833_COMPENSATE));
-// ast_rtp_set_rtptimeout(dialog->rtp, peer->rtptimeout);
-// ast_rtp_set_rtpholdtimeout(dialog->rtp, peer->rtpholdtimeout);
-// ast_rtp_set_rtpkeepalive(dialog->rtp, peer->rtpkeepalive);
+ dialog->rtp->timeout = peer->rtptimeout;
+ dialog->rtp->holdtimeout = peer->rtpholdtimeout;
+ dialog->rtp->keepalive = peer->rtpkeepalive;
/* Set Frame packetization */
- ast_rtp_instance_packetization_set(dialog->rtp, &dialog->prefs);
+ ast_rtp_codecs_packetization_set(&dialog->rtp->codecs, dialog->rtp, &dialog->prefs);
dialog->autoframing = peer->autoframing;
}
if (dialog->vrtp) { /* Video */
-// ast_rtp_set_rtptimeout(dialog->vrtp, peer->rtptimeout);
-// ast_rtp_set_rtpholdtimeout(dialog->vrtp, peer->rtpholdtimeout);
-// ast_rtp_set_rtpkeepalive(dialog->vrtp, peer->rtpkeepalive);
+ dialog->vrtp->timeout = peer->rtptimeout;
+ dialog->vrtp->holdtimeout = peer->rtpholdtimeout;
+ dialog->vrtp->keepalive = peer->rtpkeepalive;
}
if (dialog->trtp) { /* Realtime text */
-// ast_rtp_set_rtptimeout(dialog->trtp, peer->rtptimeout);
-// ast_rtp_set_rtpholdtimeout(dialog->trtp, peer->rtpholdtimeout);
-// ast_rtp_set_rtpkeepalive(dialog->trtp, peer->rtpkeepalive);
+ dialog->trtp->timeout = peer->rtptimeout;
+ dialog->trtp->holdtimeout = peer->rtpholdtimeout;
+ dialog->trtp->keepalive = peer->rtpkeepalive;
}
ast_string_field_set(dialog, peername, peer->name);
@@ -5951,30 +5951,26 @@
ao2_t_ref(p, -1, "failed to create RTP audio session, drop p");
return NULL;
}
- ast_rtp_setqos(p->rtp, global_tos_audio, global_cos_audio, "SIP RTP");
- ast_rtp_setdtmf(p->rtp, ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_RFC2833);
- ast_rtp_setdtmfcompensate(p->rtp, ast_test_flag(&p->flags[1], SIP_PAGE2_RFC2833_COMPENSATE));
- ast_rtp_set_rtptimeout(p->rtp, global_rtptimeout);
- ast_rtp_set_rtpholdtimeout(p->rtp, global_rtpholdtimeout);
- ast_rtp_set_rtpkeepalive(p->rtp, global_rtpkeepalive);
+ ast_rtp_instance_set_qos(p->rtp, global_tos_audio, global_cos_audio, "SIP RTP");
+ ast_rtp_instance_set_prop(p->rtp, AST_RTP_PROPERTY_DTMF, ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_RFC2833);
+ ast_rtp_instance_set_prop(p->rtp, AST_RTP_PROPERTY_DTMF_COMPENSATE, ast_test_flag(&p->flags[1], SIP_PAGE2_RFC2833_COMPENSATE));
+ p->rtp->timeout = global_rtptimeout;
+ p->rtp->holdtimeout = global_rtpholdtimeout;
+ p->rtp->keepalive = global_rtpkeepalive;
if (p->vrtp) {
- ast_rtp_setqos(p->vrtp, global_tos_video, global_cos_video, "SIP VRTP");
- ast_rtp_setdtmf(p->vrtp, 0);
- ast_rtp_setdtmfcompensate(p->vrtp, 0);
- ast_rtp_set_rtptimeout(p->vrtp, global_rtptimeout);
- ast_rtp_set_rtpholdtimeout(p->vrtp, global_rtpholdtimeout);
- ast_rtp_set_rtpkeepalive(p->vrtp, global_rtpkeepalive);
+ ast_rtp_instance_set_qos(p->vrtp, global_tos_video, global_cos_video, "SIP VRTP");
+ p->vrtp->timeout = global_rtptimeout;
+ p->vrtp->holdtimeout = global_rtpholdtimeout;
+ p->vrtp->keepalive = global_rtpkeepalive;
}
if (p->trtp) {
- ast_rtp_setqos(p->trtp, global_tos_text, global_cos_text, "SIP TRTP");
- ast_rtp_setdtmf(p->trtp, 0);
- ast_rtp_setdtmfcompensate(p->trtp, 0);
+ ast_rtp_instance_set_qos(p->trtp, global_tos_text, global_cos_text, "SIP TRTP");
}
if (p->udptl)
ast_udptl_setqos(p->udptl, global_tos_audio, global_cos_audio);
p->maxcallbitrate = default_maxcallbitrate;
p->autoframing = global_autoframing;
- ast_rtp_codec_setpref(p->rtp, &p->prefs);
+ ast_rtp_codecs_packetization_set(&p->rtp->codecs, p->rtp, &p->prefs);
}
if (useglobal_nat && sin) {
@@ -6513,7 +6509,7 @@
int iterator;
int sendonly = -1;
int numberofports;
- struct ast_rtp *newaudiortp, *newvideortp, *newtextrtp; /* Buffers for codec handling */
+ struct ast_rtp_codecs newaudiortp, newvideortp, newtextrtp;
int newjointcapability; /* Negotiated capability */
int newpeercapability;
int newnoncodeccapability;
@@ -6538,33 +6534,10 @@
return -1;
}
- /* Initialize the temporary RTP structures we use to evaluate the offer from the peer */
-#ifdef LOW_MEMORY
- newaudiortp = ast_threadstorage_get(&ts_audio_rtp, ast_rtp_alloc_size());
-#else
- newaudiortp = alloca(ast_rtp_alloc_size());
-#endif
- memset(newaudiortp, 0, ast_rtp_alloc_size());
- ast_rtp_new_init(newaudiortp);
- ast_rtp_pt_clear(newaudiortp);
-
-#ifdef LOW_MEMORY
- newvideortp = ast_threadstorage_get(&ts_video_rtp, ast_rtp_alloc_size());
-#else
- newvideortp = alloca(ast_rtp_alloc_size());
-#endif
- memset(newvideortp, 0, ast_rtp_alloc_size());
- ast_rtp_new_init(newvideortp);
- ast_rtp_pt_clear(newvideortp);
-
-#ifdef LOW_MEMORY
- newtextrtp = ast_threadstorage_get(&ts_text_rtp, ast_rtp_alloc_size());
-#else
- newtextrtp = alloca(ast_rtp_alloc_size());
-#endif
- memset(newtextrtp, 0, ast_rtp_alloc_size());
- ast_rtp_new_init(newtextrtp);
- ast_rtp_pt_clear(newtextrtp);
+ /* Make sure that the codec structures are all cleared out */
+ ast_rtp_codecs_payloads_clear(&newaudiortp, NULL);
+ ast_rtp_codecs_payloads_clear(&newvideortp, NULL);
+ ast_rtp_codecs_payloads_clear(&newtextrtp, NULL);
/* Update our last rtprx when we receive an SDP, too */
p->lastrtprx = p->lastrtptx = time(NULL); /* XXX why both ? */
@@ -6643,11 +6616,13 @@
p->novideo = TRUE;
p->notext = TRUE;
- if (p->vrtp)
- ast_rtp_pt_clear(newvideortp); /* Must be cleared in case no m=video line exists */
-
- if (p->trtp)
- ast_rtp_pt_clear(newtextrtp); /* Must be cleared in case no m=text line exists */
+ if (p->vrtp) {
+ ast_rtp_codecs_payloads_clear(&newvideortp, NULL);
+ }
+
+ if (p->trtp) {
+ ast_rtp_codecs_payloads_clear(&newtextrtp, NULL);
+ }
/* Find media streams in this SDP offer */
while ((m = get_sdp_iterate(&iterator, req, "m"))[0] != '\0') {
@@ -6671,7 +6646,8 @@
}
if (debug)
ast_verbose("Found RTP audio format %d\n", codec);
- ast_rtp_set_m_type(newaudiortp, codec);
+
+ ast_rtp_codecs_payloads_set_m_type(&newaudiortp, NULL, codec);
}
} else if ((sscanf(m, "video %d/%d RTP/AVP %n", &x, &numberofports, &len) == 2) ||
(sscanf(m, "video %d RTP/AVP %n", &x, &len) == 1)) {
@@ -6687,7 +6663,7 @@
}
if (debug)
ast_verbose("Found RTP video format %d\n", codec);
- ast_rtp_set_m_type(newvideortp, codec);
+ ast_rtp_codecs_payloads_set_m_type(&newvideortp, NULL, codec);
}
} else if ((sscanf(m, "text %d/%d RTP/AVP %n", &x, &numberofports, &len) == 2) ||
(sscanf(m, "text %d RTP/AVP %n", &x, &len) == 1)) {
@@ -6703,7 +6679,7 @@
}
if (debug)
ast_verbose("Found RTP text format %d\n", codec);
- ast_rtp_set_m_type(newtextrtp, codec);
+ ast_rtp_codecs_payloads_set_m_type(&newtextrtp, NULL, codec);
}
} else if (p->udptl && ( (sscanf(m, "image %d udptl t38%n", &x, &len) == 1) ||
(sscanf(m, "image %d UDPTL t38%n", &x, &len) == 1) )) {
@@ -6879,10 +6855,10 @@
}
}
if (framing && p->autoframing) {
- struct ast_codec_pref *pref = ast_rtp_codec_getpref(p->rtp);
+ struct ast_codec_pref *pref = &p->rtp->codecs.pref;
int codec_n;
int format = 0;
- for (codec_n = 0; codec_n < MAX_RTP_PT; codec_n++) {
+ for (codec_n = 0; codec_n < AST_RTP_MAX_PT; codec_n++) {
format = ast_rtp_codec_getformat(codec_n);
if (!format) /* non-codec or not found */
continue;
@@ -6890,7 +6866,7 @@
ast_log(LOG_DEBUG, "Setting framing for %d to %ld\n", format, framing);
ast_codec_pref_setsize(pref, format, framing);
}
- ast_rtp_codec_setpref(p->rtp, pref);
+ ast_rtp_codecs_packetization_set(&p->rtp->codecs, p->rtp, pref);
}
continue;
@@ -6914,24 +6890,24 @@
/* Note: should really look at the 'freq' and '#chans' params too */
/* Note: This should all be done in the context of the m= above */
if (!strncasecmp(mimeSubtype, "H26", 3) || !strncasecmp(mimeSubtype, "MP4", 3)) { /* Video */
- if(ast_rtp_set_rtpmap_type(newvideortp, codec, "video", mimeSubtype, 0) != -1) {
+ if(ast_rtp_codecs_payloads_set_rtpmap_type(&newvideortp, NULL, codec, "video", mimeSubtype, 0) != -1) {
if (debug)
ast_verbose("Found video description format %s for ID %d\n", mimeSubtype, codec);
found_rtpmap_codecs[last_rtpmap_codec] = codec;
last_rtpmap_codec++;
} else {
- ast_rtp_unset_m_type(newvideortp, codec);
+ ast_rtp_codecs_payloads_unset(&newvideortp, NULL, codec);
if (debug)
ast_verbose("Found unknown media description format %s for ID %d\n", mimeSubtype, codec);
}
} else if (!strncasecmp(mimeSubtype, "T140", 4)) { /* Text */
if (p->trtp) {
/* ast_verbose("Adding t140 mimeSubtype to textrtp struct\n"); */
- ast_rtp_set_rtpmap_type(newtextrtp, codec, "text", mimeSubtype, 0);
+ ast_rtp_codecs_payloads_set_rtpmap_type(&newtextrtp, NULL, codec, "text", mimeSubtype, 0);
}
} else if (!strncasecmp(mimeSubtype, "RED", 3)) { /* Text with Redudancy */
if (p->trtp) {
- ast_rtp_set_rtpmap_type(newtextrtp, codec, "text", mimeSubtype, 0);
+ ast_rtp_codecs_payloads_set_rtpmap_type(&newtextrtp, NULL, codec, "text", mimeSubtype, 0);
red_pt = codec;
sprintf(red_fmtp, "fmtp:%d ", red_pt);
@@ -6939,14 +6915,14 @@
ast_verbose("Red submimetype has payload type: %d\n", red_pt);
}
} else { /* Must be audio?? */
- if(ast_rtp_set_rtpmap_type(newaudiortp, codec, "audio", mimeSubtype,
+ if(ast_rtp_codecs_payloads_set_rtpmap_type(&newaudiortp, NULL, codec, "audio", mimeSubtype,
ast_test_flag(&p->flags[0], SIP_G726_NONSTANDARD) ? AST_RTP_OPT_G726_NONSTANDARD : 0) != -1) {
if (debug)
ast_verbose("Found audio description format %s for ID %d\n", mimeSubtype, codec);
found_rtpmap_codecs[last_rtpmap_codec] = codec;
last_rtpmap_codec++;
} else {
- ast_rtp_unset_m_type(newaudiortp, codec);
+ ast_rtp_codecs_payloads_unset(&newaudiortp, NULL, codec);
if (debug)
ast_verbose("Found unknown media description format %s for ID %d\n", mimeSubtype, codec);
}
@@ -7114,18 +7090,15 @@
p->peercapability = newpeercapability; /* The other sides capability in latest offer */
p->jointnoncodeccapability = newnoncodeccapability; /* DTMF capabilities */
- if (p->jointcapability & AST_FORMAT_T140RED) {
- p->red = 1;
- rtp_red_init(p->trtp, 300, red_data_pt, 2);
- } else {
- p->red = 0;
- }
-
- ast_rtp_pt_copy(p->rtp, newaudiortp);
- if (p->vrtp)
- ast_rtp_pt_copy(p->vrtp, newvideortp);
- if (p->trtp)
- ast_rtp_pt_copy(p->trtp, newtextrtp);
+ ast_rtp_codecs_payloads_copy(&newaudiortp, &p->rtp->codecs, p->rtp);
+
+ if (p->vrtp) {
+ ast_rtp_codecs_payloads_copy(&newvideortp, &p->vrtp->codecs, p->vrtp);
+ }
+
+ if (p->trtp) {
+ ast_rtp_codecs_payloads_copy(&newtextrtp, &p->trtp->codecs, p->trtp);
+ }
if (ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_AUTO) {
ast_clear_flag(&p->flags[0], SIP_DTMF);
@@ -7133,8 +7106,8 @@
/* XXX Would it be reasonable to drop the DSP at this point? XXX */
ast_set_flag(&p->flags[0], SIP_DTMF_RFC2833);
/* Since RFC2833 is now negotiated we need to change some properties of the RTP stream */
- ast_rtp_setdtmf(p->rtp, 1);
- ast_rtp_setdtmfcompensate(p->rtp, ast_test_flag(&p->flags[1], SIP_PAGE2_RFC2833_COMPENSATE));
+ ast_rtp_instance_set_prop(p->rtp, AST_RTP_PROPERTY_DTMF, 1);
+ ast_rtp_instance_set_prop(p->rtp, AST_RTP_PROPERTY_DTMF_COMPENSATE, ast_test_flag(&p->flags[1], SIP_PAGE2_RFC2833_COMPENSATE));
} else {
ast_set_flag(&p->flags[0], SIP_DTMF_INBAND);
}
@@ -7968,11 +7941,11 @@
if (debug)
ast_verbose("Adding codec 0x%x (%s) to SDP\n", codec, ast_getformatname(codec));
- if ((rtp_code = ast_rtp_lookup_code(p->rtp, 1, codec)) == -1)
+ if ((rtp_code = ast_rtp_codecs_payload_code(&p->rtp->codecs, 1, codec)) == -1)
return;
if (p->rtp) {
- struct ast_codec_pref *pref = ast_rtp_codec_getpref(p->rtp);
+ struct ast_codec_pref *pref = &p->rtp->codecs.pref;
fmt = ast_codec_pref_getsize(pref, codec);
} else /* I dont see how you couldn't have p->rtp, but good to check for and error out if not there like earlier code */
return;
@@ -8014,7 +7987,7 @@
if (debug)
ast_verbose("Adding video codec 0x%x (%s) to SDP\n", codec, ast_getformatname(codec));
- if ((rtp_code = ast_rtp_lookup_code(p->vrtp, 1, codec)) == -1)
+ if ((rtp_code = ast_rtp_codecs_payload_code(&p->vrtp->codecs, 1, codec)) == -1)
return;
ast_str_append(m_buf, 0, " %d", rtp_code);
@@ -8036,7 +8009,7 @@
if (debug)
ast_verbose("Adding text codec 0x%x (%s) to SDP\n", codec, ast_getformatname(codec));
- if ((rtp_code = ast_rtp_lookup_code(p->trtp, 1, codec)) == -1)
+ if ((rtp_code = ast_rtp_codecs_payload_code(&p->trtp->codecs, 1, codec)) == -1)
return;
ast_str_append(m_buf, 0, " %d", rtp_code);
@@ -8045,10 +8018,11 @@
/* Add fmtp code here */
if (codec == AST_FORMAT_T140RED) {
+ int t140code = ast_rtp_codecs_payload_code(&p->trtp->codecs, 1, AST_FORMAT_T140);
ast_str_append(a_buf, 0, "a=fmtp:%d %d/%d/%d\r\n", rtp_code,
- ast_rtp_lookup_code(p->trtp, 1, AST_FORMAT_T140),
- ast_rtp_lookup_code(p->trtp, 1, AST_FORMAT_T140),
- ast_rtp_lookup_code(p->trtp, 1, AST_FORMAT_T140));
+ t140code,
+ t140code,
+ t140code);
}
}
@@ -8175,7 +8149,7 @@
if (debug)
ast_verbose("Adding non-codec 0x%x (%s) to SDP\n", format, ast_rtp_lookup_mime_subtype(0, format, 0));
- if ((rtp_code = ast_rtp_lookup_code(p->rtp, 0, format)) == -1)
+ if ((rtp_code = ast_rtp_codecs_payload_code(&p->rtp->codecs, 0, format)) == -1)
return;
ast_str_append(m_buf, 0, " %d", rtp_code);
@@ -8595,7 +8569,7 @@
if (p->rtp) {
if (!p->autoframing && !ast_test_flag(&p->flags[0], SIP_OUTGOING)) {
ast_debug(1, "Setting framing from config on incoming call\n");
- ast_rtp_codec_setpref(p->rtp, &p->prefs);
+ ast_rtp_codecs_packetization_set(&p->rtp->codecs, p->rtp, &p->prefs);
}
try_suggested_sip_codec(p);
add_sdp(&resp, p, oldsdp);
@@ -10751,7 +10725,7 @@
if (peer) {
/* Set Frame packetization */
if (p->rtp) {
- ast_rtp_codec_setpref(p->rtp, &peer->prefs);
+ ast_rtp_codecs_packetization_set(&p->rtp->codecs, p->rtp, &peer->prefs);
p->autoframing = peer->autoframing;
}
if (!peer->host_dynamic) {
@@ -11649,7 +11623,7 @@
/* XXX what about p->prefs = peer->prefs; ? */
/* Set Frame packetization */
if (p->rtp) {
- ast_rtp_codec_setpref(p->rtp, &peer->prefs);
+ ast_rtp_codecs_packetization_set(&p->rtp->codecs, p->rtp, &peer->prefs);
p->autoframing = peer->autoframing;
}
@@ -12595,13 +12569,13 @@
}
/* We absolutely cannot destroy the rtp struct while a bridge is active or we WILL crash */
- if (dialog->rtp && ast_rtp_get_bridged(dialog->rtp)) {
+ if (dialog->rtp && dialog->rtp->bridged) {
ast_debug(2, "Bridge still active. Delaying destroy of SIP dialog '%s' Method: %s\n", dialog->callid, sip_methods[dialog->method].text);
sip_pvt_unlock(dialog);
return 0;
}
- if (dialog->vrtp && ast_rtp_get_bridged(dialog->vrtp)) {
+ if (dialog->vrtp && dialog->vrtp->bridged) {
ast_debug(2, "Bridge still active. Delaying destroy of SIP dialog '%s' Method: %s\n", dialog->callid, sip_methods[dialog->method].text);
sip_pvt_unlock(dialog);
return 0;
@@ -13320,10 +13294,11 @@
ast_cli(fd, "%-15.15s %-11.11s (inv state: %s) -- %s\n", ast_inet_ntoa(cur->sa.sin_addr), cur->callid, invitestate2string[cur->invitestate].desc, "-- No RTP active");
return 0; /* don't care, we scan all channels */
}
+
+/*
rxcount = ast_rtp_get_qosvalue(cur->rtp, AST_RTP_RXCOUNT);
txcount = ast_rtp_get_qosvalue(cur->rtp, AST_RTP_TXCOUNT);
- /* Find the duration of this channel */
if (c && c->cdr && !ast_tvzero(c->cdr->start)) {
duration = (int)(ast_tvdiff_ms(ast_tvnow(), c->cdr->start) / 1000);
durh = duration / 3600;
@@ -13333,7 +13308,7 @@
} else {
durbuf[0] = '\0';
}
- /* Print stats for every call with RTP */
+
ast_cli(fd, FORMAT,
ast_inet_ntoa(cur->sa.sin_addr),
cur->callid,
@@ -13350,7 +13325,7 @@
ast_rtp_get_qosvalue(cur->rtp, AST_RTP_TXJITTER)
);
arg->numchans++;
-
+*/
return 0; /* don't care, we scan all channels */
}
@@ -16965,8 +16940,8 @@
build_contact(p); /* Build our contact header */
if (p->rtp) {
- ast_rtp_setdtmf(p->rtp, ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_RFC2833);
- ast_rtp_setdtmfcompensate(p->rtp, ast_test_flag(&p->flags[1], SIP_PAGE2_RFC2833_COMPENSATE));
+ ast_rtp_instance_set_prop(p->rtp, AST_RTP_PROPERTY_DTMF, ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_RFC2833);
+ ast_rtp_instance_set_prop(p->rtp, AST_RTP_PROPERTY_DTMF_COMPENSATE, ast_test_flag(&p->flags[1], SIP_PAGE2_RFC2833_COMPENSATE));
}
if (!replace_id && gotdest) { /* No matching extension found */
@@ -17879,6 +17854,7 @@
snprintf(buf, buflen, "%s:%d", ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port));
} else if (!strcasecmp(args.param, "rtpqos")) {
+/*
struct ast_rtp_quality qos;
struct ast_rtp *rtp = p->rtp;
@@ -17925,6 +17901,7 @@
ast_log(LOG_WARNING, "Unrecognized argument '%s' to %s\n", preparse, funcname);
return -1;
}
+*/
} else {
res = -1;
}
@@ -17952,6 +17929,7 @@
sip_alreadygone(p);
/* Get RTCP quality before end of call */
+/*
if (p->do_history || p->owner) {
struct ast_channel *bridge = ast_bridged_channel(p->owner);
char *videoqos, *textqos;
@@ -18000,6 +17978,7 @@
pbx_builtin_setvar_helper(p->owner, "RTPTEXTQOS", textqos);
}
}
+*/
stop_media_flows(p); /* Immediately stop RTP, VRTP and UDPTL as applicable */
stop_session_timer(p); /* Stop Session-Timer */
@@ -19047,15 +19026,15 @@
return;
/* If we have no timers set, return now */
- if ((ast_rtp_get_rtpkeepalive(dialog->rtp) == 0) && (ast_rtp_get_rtptimeout(dialog->rtp) == 0) && (ast_rtp_get_rtpholdtimeout(dialog->rtp) == 0))
+ if (!dialog->rtp->keepalive && !dialog->rtp->timeout && !dialog->rtp->holdtimeout) {
return;
+ }
/* Check AUDIO RTP keepalives */
- if (dialog->lastrtptx && ast_rtp_get_rtpkeepalive(dialog->rtp) &&
- (t > dialog->lastrtptx + ast_rtp_get_rtpkeepalive(dialog->rtp))) {
+ if (dialog->lastrtptx && dialog->rtp->keepalive && (t > dialog->lastrtptx + dialog->rtp->keepalive)) {
/* Need to send an empty RTP packet */
dialog->lastrtptx = time(NULL);
- ast_rtp_sendcng(dialog->rtp, 0);
+// ast_rtp_sendcng(dialog->rtp, 0);
}
/*! \todo Check video RTP keepalives
@@ -19065,16 +19044,14 @@
*/
/* Check AUDIO RTP timers */
- if (dialog->lastrtprx && (ast_rtp_get_rtptimeout(dialog->rtp) || ast_rtp_get_rtpholdtimeout(dialog->rtp)) &&
- (t > dialog->lastrtprx + ast_rtp_get_rtptimeout(dialog->rtp))) {
+ if (dialog->lastrtprx && (dialog->rtp->timeout || dialog->rtp->holdtimeout) && (t > dialog->lastrtprx + dialog->rtp->timeout)) {
/* Might be a timeout now -- see if we're on hold */
struct sockaddr_in sin;
ast_rtp_get_peer(dialog->rtp, &sin);
- if (sin.sin_addr.s_addr || (ast_rtp_get_rtpholdtimeout(dialog->rtp) &&
- (t > dialog->lastrtprx + ast_rtp_get_rtpholdtimeout(dialog->rtp)))) {
+ if (sin.sin_addr.s_addr || (dialog->rtp->holdtimeout && (t > dialog->lastrtprx + dialog->rtp->holdtimeout))) {
/* Needs a hangup */
- if (ast_rtp_get_rtptimeout(dialog->rtp)) {
+ if (dialog->rtp->timeout) {
while (dialog->owner && ast_channel_trylock(dialog->owner)) {
sip_pvt_unlock(dialog);
usleep(1);
@@ -19089,11 +19066,11 @@
has already been requested and we don't want to
repeatedly request hangups
*/
- ast_rtp_set_rtptimeout(dialog->rtp, 0);
- ast_rtp_set_rtpholdtimeout(dialog->rtp, 0);
+ dialog->rtp->timeout = 0;
+ dialog->rtp->holdtimeout = 0;
if (dialog->vrtp) {
- ast_rtp_set_rtptimeout(dialog->vrtp, 0);
- ast_rtp_set_rtpholdtimeout(dialog->vrtp, 0);
+ dialog->vrtp->timeout = 0;
+ dialog->vrtp->holdtimeout = 0;
}
}
}
@@ -21657,7 +21634,7 @@
} else
ast_log(LOG_WARNING, "I don't know about this dtmf mode: %s\n", mode);
if (p->rtp)
- ast_rtp_setdtmf(p->rtp, ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_RFC2833);
+ ast_rtp_instance_set_prop(p->rtp, AST_RTP_PROPERTY_DTMF, ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_RFC2833);
if (ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_INBAND) {
if (!p->vad) {
p->vad = ast_dsp_new();
More information about the svn-commits
mailing list