提交 166249b0 authored 作者: Mathieu Rene's avatar Mathieu Rene

Check in TDM and RTP controllable channels (incomplete)

上级 af39d4c9
...@@ -4,6 +4,7 @@ BASE=../../.. ...@@ -4,6 +4,7 @@ BASE=../../..
FT_DIR=.. FT_DIR=..
VERBOSE=1 VERBOSE=1
FTLA=$(FT_DIR)/libfreetdm.la FTLA=$(FT_DIR)/libfreetdm.la
LOCAL_OBJS=tdm.o
LOCAL_CFLAGS=-I$(FT_DIR)/src/include -I$(FT_DIR)/src/isdn/include $(FT_CFLAGS) LOCAL_CFLAGS=-I$(FT_DIR)/src/include -I$(FT_DIR)/src/isdn/include $(FT_CFLAGS)
LOCAL_LDFLAGS=-L$(FT_DIR) -lfreetdm LOCAL_LDFLAGS=-L$(FT_DIR) -lfreetdm
include $(BASE)/build/modmake.rules include $(BASE)/build/modmake.rules
......
...@@ -873,7 +873,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc ...@@ -873,7 +873,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
if (!tech_pvt->ftdmchan) { if (!tech_pvt->ftdmchan) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "no ftdmchan set in channel %s!\n", name); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "no ftdmchan set in channel %s!\n", name);
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }
span_id = ftdm_channel_get_span_id(tech_pvt->ftdmchan); span_id = ftdm_channel_get_span_id(tech_pvt->ftdmchan);
chan_id = ftdm_channel_get_id(tech_pvt->ftdmchan); chan_id = ftdm_channel_get_id(tech_pvt->ftdmchan);
...@@ -906,7 +906,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc ...@@ -906,7 +906,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
ftdm_channel_wait(tech_pvt->ftdmchan, &wflags, ftdm_channel_get_io_interval(tech_pvt->ftdmchan) * 10); ftdm_channel_wait(tech_pvt->ftdmchan, &wflags, ftdm_channel_get_io_interval(tech_pvt->ftdmchan) * 10);
if (!(wflags & FTDM_WRITE)) { if (!(wflags & FTDM_WRITE)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Dropping frame! (write note ready) in channel %s device %d:%d!\n", name, span_id, chan_id); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Dropping frame! (write not ready) in channel %s device %d:%d!\n", name, span_id, chan_id);
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
......
差异被折叠。
...@@ -81,6 +81,7 @@ struct sdp_parser_s { ...@@ -81,6 +81,7 @@ struct sdp_parser_s {
unsigned pr_insane : 1; unsigned pr_insane : 1;
unsigned pr_c_missing : 1; unsigned pr_c_missing : 1;
unsigned pr_config : 1; unsigned pr_config : 1;
unsigned pr_megaco : 1;
}; };
#define is_posdigit(c) ((c) >= '1' && (c) <= '9') #define is_posdigit(c) ((c) >= '1' && (c) <= '9')
...@@ -176,6 +177,7 @@ sdp_parse(su_home_t *home, char const msg[], issize_t msgsize, int flags) ...@@ -176,6 +177,7 @@ sdp_parse(su_home_t *home, char const msg[], issize_t msgsize, int flags)
if (flags & sdp_f_config) if (flags & sdp_f_config)
p->pr_c_missing = 1, p->pr_config = 1; p->pr_c_missing = 1, p->pr_config = 1;
p->pr_mode_manual = (flags & sdp_f_mode_manual) != 0; p->pr_mode_manual = (flags & sdp_f_mode_manual) != 0;
p->pr_megaco = (flags & sdp_f_megaco) != 0;
p->pr_session_mode = sdp_sendrecv; p->pr_session_mode = sdp_sendrecv;
parse_message(p); parse_message(p);
...@@ -1502,8 +1504,18 @@ static void parse_payload(sdp_parser_t *p, char *r, sdp_rtpmap_t **result) ...@@ -1502,8 +1504,18 @@ static void parse_payload(sdp_parser_t *p, char *r, sdp_rtpmap_t **result)
{ {
while (*r) { while (*r) {
unsigned long value; unsigned long value;
if (((p->pr_config && r[0] == '*') || (p->pr_megaco && r[0] == MEGACO_CHOOSE_TOK)) && (r[1] == ' ' || r[1] == '\0')) {
PARSE_ALLOC(p, sdp_rtpmap_t, rm);
*result = rm; result = &rm->rm_next;
rm->rm_predef = 1;
rm->rm_any = 1;
rm->rm_encoding = "*";
rm->rm_rate = 0;
if (parse_ul(p, &r, &value, 128) == 0) { return;
} else if (parse_ul(p, &r, &value, 128) == 0 && value < 128) {
PARSE_ALLOC(p, sdp_rtpmap_t, rm); PARSE_ALLOC(p, sdp_rtpmap_t, rm);
assert(0 <= value && value < 128); assert(0 <= value && value < 128);
...@@ -1519,21 +1531,8 @@ static void parse_payload(sdp_parser_t *p, char *r, sdp_rtpmap_t **result) ...@@ -1519,21 +1531,8 @@ static void parse_payload(sdp_parser_t *p, char *r, sdp_rtpmap_t **result)
rm->rm_encoding = ""; rm->rm_encoding = "";
rm->rm_rate = 0; rm->rm_rate = 0;
} }
} } else {
else if (p->pr_config && r[0] == '*' && (r[1] == ' ' || r[1] == '\0')) { parsing_error(p, "m= invalid format for RTP/AVP");
PARSE_ALLOC(p, sdp_rtpmap_t, rm);
*result = rm; result = &rm->rm_next;
rm->rm_predef = 1;
rm->rm_any = 1;
rm->rm_encoding = "*";
rm->rm_rate = 0;
return;
}
else {
parsing_error(p, "m= invalid format for RTP/AVT");
return; return;
} }
...@@ -1797,6 +1796,13 @@ static int parse_ul(sdp_parser_t *p, char **r, ...@@ -1797,6 +1796,13 @@ static int parse_ul(sdp_parser_t *p, char **r,
return 0; return 0;
} }
if (p->pr_megaco && *ul == MEGACO_CHOOSE_TOK) {
*result = MEGACO_CHOOSE;
(*r)++;
*r += strspn(*r, SPACE TAB);
return 0;
}
return -1; return -1;
} }
...@@ -1824,6 +1830,13 @@ static int parse_ull(sdp_parser_t *p, char **r, ...@@ -1824,6 +1830,13 @@ static int parse_ull(sdp_parser_t *p, char **r,
return 0; return 0;
} }
if (p->pr_megaco && *s == MEGACO_CHOOSE_TOK) {
*result = MEGACO_CHOOSE;
(*r)++;
*r += strspn(*r, SPACE TAB);
return 0;
}
return -1; return -1;
} }
......
...@@ -24,6 +24,10 @@ ...@@ -24,6 +24,10 @@
#ifndef SDP_H #ifndef SDP_H
#define SDP_H #define SDP_H
#define MEGACO_CHOOSE_TOK '$'
#define MEGACO_CHOOSE (UINT16_MAX + 1)
/**@file sofia-sip/sdp.h Simple SDP (RFC 2327) Interface. /**@file sofia-sip/sdp.h Simple SDP (RFC 2327) Interface.
* *
* @author Pekka Pessi <Pekka.Pessi@nokia.com> * @author Pekka Pessi <Pekka.Pessi@nokia.com>
...@@ -260,7 +264,7 @@ typedef enum { ...@@ -260,7 +264,7 @@ typedef enum {
/** Media announcement. /** Media announcement.
* *
* This structure describes one media type, e.g., audio. The description * This structure describes one media type, e.g., audio. The description
* contains the transport address (IP address and port) used for the group, * contains the transport address (IP address and port) used for the group,/Users/mrene/Downloads
* the transport protocol used, the media formats or RTP payload types, and * the transport protocol used, the media formats or RTP payload types, and
* optionally media-specific bandwidth specification, encryption key and * optionally media-specific bandwidth specification, encryption key and
* attributes. * attributes.
...@@ -525,7 +529,9 @@ enum sdp_parse_flags_e { ...@@ -525,7 +529,9 @@ enum sdp_parse_flags_e {
/** Do not generate or parse SDP mode */ /** Do not generate or parse SDP mode */
sdp_f_mode_manual = 512, sdp_f_mode_manual = 512,
/** Always generate media-level mode attributes */ /** Always generate media-level mode attributes */
sdp_f_mode_always = 1024 sdp_f_mode_always = 1024,
/** Allow optional (choose) parameters */
sdp_f_megaco = 2048
}; };
/** SDP parser handle. */ /** SDP parser handle. */
......
...@@ -9,7 +9,7 @@ SOFIAUA_BUILDDIR=$(SOFIA_BUILDDIR)/libsofia-sip-ua ...@@ -9,7 +9,7 @@ SOFIAUA_BUILDDIR=$(SOFIA_BUILDDIR)/libsofia-sip-ua
SOFIALA=$(SOFIAUA_BUILDDIR)/libsofia-sip-ua.la SOFIALA=$(SOFIAUA_BUILDDIR)/libsofia-sip-ua.la
mod_LTLIBRARIES = mod_sofia.la mod_LTLIBRARIES = mod_sofia.la
mod_sofia_la_SOURCES = mod_sofia.c sofia.c sofia_glue.c sofia_presence.c sofia_reg.c sip-dig.c mod_sofia.h mod_sofia_la_SOURCES = mod_sofia.c sofia.c sofia_glue.c sofia_presence.c sofia_reg.c sip-dig.c rtp.c mod_sofia.h
mod_sofia_la_CFLAGS = $(AM_CFLAGS) -I. $(SOFIA_CMD_LINE_CFLAGS) mod_sofia_la_CFLAGS = $(AM_CFLAGS) -I. $(SOFIA_CMD_LINE_CFLAGS)
mod_sofia_la_CFLAGS += -I$(SOFIAUA_DIR)/bnf -I$(SOFIAUA_BUILDDIR)/bnf mod_sofia_la_CFLAGS += -I$(SOFIAUA_DIR)/bnf -I$(SOFIAUA_BUILDDIR)/bnf
mod_sofia_la_CFLAGS += -I$(SOFIAUA_DIR)/http -I$(SOFIAUA_BUILDDIR)/http mod_sofia_la_CFLAGS += -I$(SOFIAUA_DIR)/http -I$(SOFIAUA_BUILDDIR)/http
......
...@@ -5634,6 +5634,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load) ...@@ -5634,6 +5634,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
SWITCH_ADD_API(api_interface, "sofia_count_reg", "Count Sofia registration", sofia_count_reg_function, "[profile/]<user>@<domain>"); SWITCH_ADD_API(api_interface, "sofia_count_reg", "Count Sofia registration", sofia_count_reg_function, "[profile/]<user>@<domain>");
SWITCH_ADD_API(api_interface, "sofia_dig", "SIP DIG", sip_dig_function, "<url>"); SWITCH_ADD_API(api_interface, "sofia_dig", "SIP DIG", sip_dig_function, "<url>");
SWITCH_ADD_CHAT(chat_interface, SOFIA_CHAT_PROTO, sofia_presence_chat_send); SWITCH_ADD_CHAT(chat_interface, SOFIA_CHAT_PROTO, sofia_presence_chat_send);
crtp_init(*module_interface);
/* indicate that the module should continue to be loaded */ /* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
......
...@@ -1152,3 +1152,4 @@ void sofia_process_dispatch_event(sofia_dispatch_event_t **dep); ...@@ -1152,3 +1152,4 @@ void sofia_process_dispatch_event(sofia_dispatch_event_t **dep);
char *sofia_glue_get_host(const char *str, switch_memory_pool_t *pool); char *sofia_glue_get_host(const char *str, switch_memory_pool_t *pool);
void sofia_presence_check_subscriptions(sofia_profile_t *profile, time_t now); void sofia_presence_check_subscriptions(sofia_profile_t *profile, time_t now);
void sofia_msg_thread_start(int idx); void sofia_msg_thread_start(int idx);
void crtp_init(switch_loadable_module_interface_t *module_interface);
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论