+
+#if 0
+issues:
+- send tones that are clocked with timer, unless data is received from bridge
+ /* send progress, if tones are available and if we don't bridge */
+ if (!p_s_rtp_bridge && interface->is_tones == IS_YES) {
+ char sdp_str[256];
+ struct in_addr ia;
+ unsigned char payload_type;
+
+ PDEBUG(DEBUG_SIP, "Connecting audio, since we have tones available\n");
+ payload_type = (options.law=='a') ? RTP_PT_ALAW : RTP_PT_ULAW;
+ /* open local RTP peer (if not bridging) */
+ if (rtp_connect() < 0) {
+ nua_respond(nh, SIP_500_INTERNAL_SERVER_ERROR, TAG_END());
+ nua_handle_destroy(nh);
+ p_s_handle = NULL;
+ sip_trace_header(this, "RESPOND", DIRECTION_OUT);
+ add_trace("respond", "value", "500 Internal Server Error");
+ add_trace("reason", NULL, "failed to connect RTP/RTCP sockts");
+ end_trace();
+ new_state(PORT_STATE_RELEASE);
+ trigger_work(&p_s_delete);
+ message = message_create(p_serial, ACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_RELEASE);
+ message->param.disconnectinfo.cause = 41;
+ message->param.disconnectinfo.location = LOCATION_PRIVATE_LOCAL;
+ message_put(message);
+ new_state(PORT_STATE_RELEASE);
+ trigger_work(&p_s_delete);
+ return;
+ }
+
+ ia.s_addr = htonl(p_s_rtp_ip_local);
+
+ SPRINT(sdp_str,
+ "v=0\n"
+ "o=LCR-Sofia-SIP 0 0 IN IP4 %s\n"
+ "s=SIP Call\n"
+ "c=IN IP4 %s\n"
+ "t=0 0\n"
+ "m=audio %d RTP/AVP %d\n"
+ "a=rtpmap:%d %s/8000\n"
+ , inet_ntoa(ia), inet_ntoa(ia), p_s_rtp_port_local, payload_type, payload_type, payload_type2name(payload_type));
+ PDEBUG(DEBUG_SIP, "Using SDP response: %s\n", sdp_str);
+
+ nua_respond(p_s_handle, SIP_183_SESSION_PROGRESS,
+ NUTAG_MEDIA_ENABLE(0),
+ SIPTAG_CONTENT_TYPE_STR("application/sdp"),
+ SIPTAG_PAYLOAD_STR(sdp_str), TAG_END());
+ new_state(PORT_STATE_CONNECT);
+ sip_trace_header(this, "RESPOND", DIRECTION_OUT);
+ add_trace("respond", "value", "183 SESSION PROGRESS");
+ add_trace("reason", NULL, "audio available");
+ add_trace("rtp", "ip", "%s", inet_ntoa(ia));
+ add_trace("rtp", "port", "%d,%d", p_s_rtp_port_local, p_s_rtp_port_local + 1);
+ add_trace("rtp", "payload", "%d", payload_type);
+ end_trace();
+ }
+#endif