提交 30a0a205 authored 作者: Mathieu Rene's avatar Mathieu Rene

Merge branch 'nsg-4.3' of git.sangoma.com:smg_freeswitch into nsg/4.3

...@@ -111,6 +111,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi ...@@ -111,6 +111,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
const char *dname; const char *dname;
ftdm_codec_t codec; ftdm_codec_t codec;
uint32_t interval; uint32_t interval;
ftdm_status_t fstatus;
ctdm_private_t *tech_pvt = NULL; ctdm_private_t *tech_pvt = NULL;
...@@ -136,6 +137,11 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi ...@@ -136,6 +137,11 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
channel = switch_core_session_get_channel(*new_session); channel = switch_core_session_get_channel(*new_session);
if ((fstatus = ftdm_span_start(span)) != FTDM_SUCCESS && fstatus != FTDM_EINVAL) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't start span %s.\n", span_name);
goto fail;
}
if (ftdm_channel_open(span_id, chan_id, &chan) != FTDM_SUCCESS) { if (ftdm_channel_open(span_id, chan_id, &chan) != FTDM_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't open span or channel.\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't open span or channel.\n");
goto fail; goto fail;
......
...@@ -500,7 +500,7 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i ...@@ -500,7 +500,7 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
mg_context_t* mg_ctxt; mg_context_t* mg_ctxt;
int mediaId; int mediaId;
MgMgcoLocalDesc *local = NULL; MgMgcoLocalDesc *local = NULL;
CmSdpInfoSet *psdp = NULL; /*CmSdpInfoSet *psdp = NULL;*/
/* TODO - Kapil dummy line , will need to add with proper code */ /* TODO - Kapil dummy line , will need to add with proper code */
...@@ -707,6 +707,11 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i ...@@ -707,6 +707,11 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
/* only for RTP */ /* only for RTP */
if(is_rtp){ if(is_rtp){
mg_build_sdp(&desc->u.media, inc_med_desc, mg_profile, term, &rsp.u.mgCmdRsp[0]->memCp);
}
#if 0
if(is_rtp){
mg_build_sdp(desc, inc_med_desc, mg_profile, term, &rsp.u.mgCmdRsp[0]->memCp);
/* build local descriptors */ /* build local descriptors */
/*MgMgcoStreamDesc *stream;*/ /*MgMgcoStreamDesc *stream;*/
char* ipAddress[4];// = "192.168.1.1"; char* ipAddress[4];// = "192.168.1.1";
...@@ -762,11 +767,14 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i ...@@ -762,11 +767,14 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
psdp = &(local->sdp); psdp = &(local->sdp);
if (mgUtlGrowList((void ***)&psdp->info, sizeof(CmSdpInfo), if((NOTPRSNT == local->sdp.numComp.pres) || (0 == local->sdp.numComp.val)){
&psdp->numComp, &rsp.u.mgCmdRsp[0]->memCp) != ROK)
{ if (mgUtlGrowList((void ***)&psdp->info, sizeof(CmSdpInfo),
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR,"Grow List failed\n"); &psdp->numComp, &rsp.u.mgCmdRsp[0]->memCp) != ROK)
return SWITCH_STATUS_FALSE; {
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR,"Grow List failed\n");
return SWITCH_STATUS_FALSE;
}
} }
psdp->info[psdp->numComp.val-1]->pres.pres = PRSNT_NODEF; psdp->info[psdp->numComp.val-1]->pres.pres = PRSNT_NODEF;
...@@ -875,7 +883,7 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i ...@@ -875,7 +883,7 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
MG_INIT_TOKEN_VALUE(&(media->field.par.pflst[media->field.par.numProtFmts.val-1]->u.rtp.fmts[0]->type), CM_SDP_SPEC); MG_INIT_TOKEN_VALUE(&(media->field.par.pflst[media->field.par.numProtFmts.val-1]->u.rtp.fmts[0]->type), CM_SDP_SPEC);
MG_INIT_TOKEN_VALUE(&(media->field.par.pflst[media->field.par.numProtFmts.val-1]->u.rtp.fmts[0]->val), 4); MG_INIT_TOKEN_VALUE(&(media->field.par.pflst[media->field.par.numProtFmts.val-1]->u.rtp.fmts[0]->val), 8);
/* Fill attribute if reqd */ /* Fill attribute if reqd */
{ {
...@@ -893,6 +901,7 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i ...@@ -893,6 +901,7 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
free(dup); free(dup);
} }
#endif
/* We will always send one command at a time..*/ /* We will always send one command at a time..*/
...@@ -1055,10 +1064,11 @@ switch_status_t handle_mg_modify_cmd(megaco_profile_t* mg_profile, MgMgcoCommand ...@@ -1055,10 +1064,11 @@ switch_status_t handle_mg_modify_cmd(megaco_profile_t* mg_profile, MgMgcoCommand
ret = mg_prc_descriptors(mg_profile, inc_cmd, term); ret = mg_prc_descriptors(mg_profile, inc_cmd, term);
/* SDP updated to termination */ /* SDP updated to termination */
megaco_activate_termination(term); megaco_activate_termination(term);
} }
/* TODO - copy inc descriptor...not sure if we need to do this.. */
/********************************************************************/ /********************************************************************/
/* Matt - to provide the response SDP structure which needs to fill in Modify command response */ /* Matt - to provide the response SDP structure which needs to fill in Modify command response */
......
...@@ -155,6 +155,9 @@ int mg_enable_logging(void); ...@@ -155,6 +155,9 @@ int mg_enable_logging(void);
int mg_disable_logging(void); int mg_disable_logging(void);
void mg_util_set_err_string ( MgStr *errTxt, char* str); void mg_util_set_err_string ( MgStr *errTxt, char* str);
switch_status_t mg_build_sdp(MgMgcoMediaDesc* out, MgMgcoMediaDesc* inc, megaco_profile_t* mg_profile, mg_termination_t* term, CmMemListCp *memCp);
switch_status_t mg_add_local_descriptor(MgMgcoMediaDesc* media, megaco_profile_t* mg_profile, mg_termination_t* term, CmMemListCp *memCp);
switch_status_t sng_mgco_cfg(megaco_profile_t* profile); switch_status_t sng_mgco_cfg(megaco_profile_t* profile);
switch_status_t sng_mgco_init(sng_mg_event_interface_t* event); switch_status_t sng_mgco_init(sng_mg_event_interface_t* event);
...@@ -193,6 +196,9 @@ switch_status_t mg_fill_svc_change(MgMgcoSvcChgPar *srvPar, uint8_t method, c ...@@ -193,6 +196,9 @@ switch_status_t mg_fill_svc_change(MgMgcoSvcChgPar *srvPar, uint8_t method, c
void mg_fill_null_context(MgMgcoContextId* ctxt); void mg_fill_null_context(MgMgcoContextId* ctxt);
switch_status_t mg_send_service_change(SuId suId, const char* term_name, uint8_t method, MgServiceChangeReason_e reason,uint8_t wild); switch_status_t mg_send_service_change(SuId suId, const char* term_name, uint8_t method, MgServiceChangeReason_e reason,uint8_t wild);
switch_status_t mg_create_mgco_command(MgMgcoCommand *cmd, uint8_t apiType, uint8_t cmdType); switch_status_t mg_create_mgco_command(MgMgcoCommand *cmd, uint8_t apiType, uint8_t cmdType);
switch_status_t mg_add_lcl_media(CmSdpMediaDescSet* med, megaco_profile_t* mg_profile, mg_termination_t* term, CmMemListCp *memCp);
switch_status_t mg_add_supported_media_codec(CmSdpMediaDesc* media, megaco_profile_t* mg_profile, mg_termination_t* term, CmMemListCp *memCp);
switch_status_t mg_rem_unsupported_codecs (megaco_profile_t* mg_profile, mg_termination_t* term, CmSdpMedFmtRtpList *fmtList, CmSdpAttrSet *attrSet, CmMemListCp *memCp);
switch_status_t mg_send_oos_service_change(megaco_profile_t* mg_profile, const char* term_name, int wild); switch_status_t mg_send_oos_service_change(megaco_profile_t* mg_profile, const char* term_name, int wild);
switch_status_t mg_send_ins_service_change(megaco_profile_t* mg_profile, const char* term_name, int wild); switch_status_t mg_send_ins_service_change(megaco_profile_t* mg_profile, const char* term_name, int wild);
......
...@@ -74,7 +74,7 @@ switch_status_t config_profile(megaco_profile_t *profile, switch_bool_t reload) ...@@ -74,7 +74,7 @@ switch_status_t config_profile(megaco_profile_t *profile, switch_bool_t reload)
// <map termination-id-prefix="Term1/" termination-id-base="1" tech="freetdm" channel-prefix="wp2" channel-map"1-15,17-31"/> // <map termination-id-prefix="Term1/" termination-id-base="1" tech="freetdm" channel-prefix="wp2" channel-map"1-15,17-31"/>
const char *prefix = switch_xml_attr(mg_term, "termination-id-prefix"); const char *prefix = switch_xml_attr(mg_term, "termination-id-prefix");
//const char *sztermination_id_base = switch_xml_attr(mg_term, "termination-id-base"); //const char *sztermination_id_base = switch_xml_attr(mg_term, "termination-id-base");
//const char *tech = switch_xml_attr(mg_term, "tech"); const char *tech = switch_xml_attr(mg_term, "tech");
const char *channel_prefix = switch_xml_attr(mg_term, "channel-prefix"); const char *channel_prefix = switch_xml_attr(mg_term, "channel-prefix");
const char *channel_map = switch_xml_attr(mg_term, "channel-map"); const char *channel_map = switch_xml_attr(mg_term, "channel-map");
...@@ -100,7 +100,8 @@ switch_status_t config_profile(megaco_profile_t *profile, switch_bool_t reload) ...@@ -100,7 +100,8 @@ switch_status_t config_profile(megaco_profile_t *profile, switch_bool_t reload)
term->type = MG_TERM_TDM; term->type = MG_TERM_TDM;
term->profile = profile; term->profile = profile;
term->mg_ctxt = NULL; term->mg_ctxt = NULL;
term->active_events = NULL; term->tech = switch_core_strdup(pool, tech);
term->active_events = NULL;
term->name = switch_core_sprintf(pool, "%s%d", prefix, j); term->name = switch_core_sprintf(pool, "%s%d", prefix, j);
term->u.tdm.channel = j; term->u.tdm.channel = j;
term->u.tdm.span_name = switch_core_strdup(pool, channel_prefix); term->u.tdm.span_name = switch_core_strdup(pool, channel_prefix);
...@@ -260,6 +261,7 @@ static switch_xml_config_item_t *get_instructions(megaco_profile_t *profile) { ...@@ -260,6 +261,7 @@ static switch_xml_config_item_t *get_instructions(megaco_profile_t *profile) {
SWITCH_CONFIG_ITEM("rtp-port-range", SWITCH_CONFIG_STRING, CONFIG_REQUIRED, &profile->rtp_port_range, "1-65535", &switch_config_string_strdup, "", "rtp port range"), SWITCH_CONFIG_ITEM("rtp-port-range", SWITCH_CONFIG_STRING, CONFIG_REQUIRED, &profile->rtp_port_range, "1-65535", &switch_config_string_strdup, "", "rtp port range"),
SWITCH_CONFIG_ITEM("rtp-termination-id-prefix", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &profile->rtp_termination_id_prefix, "", &switch_config_string_strdup, "", "rtp termination prefix"), SWITCH_CONFIG_ITEM("rtp-termination-id-prefix", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &profile->rtp_termination_id_prefix, "", &switch_config_string_strdup, "", "rtp termination prefix"),
SWITCH_CONFIG_ITEM("rtp-termination-id-len", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, &profile->rtp_termination_id_len, "", &opt_termination_id_len, "", "rtp termination id"), SWITCH_CONFIG_ITEM("rtp-termination-id-len", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, &profile->rtp_termination_id_len, "", &opt_termination_id_len, "", "rtp termination id"),
SWITCH_CONFIG_ITEM("codec-prefs", SWITCH_CONFIG_STRING, 0, &profile->codec_prefs, "", &switch_config_string_strdup, "", "codec preferences, coma-separated"),
SWITCH_CONFIG_ITEM_END() SWITCH_CONFIG_ITEM_END()
}; };
......
...@@ -113,6 +113,7 @@ struct mg_termination_s { ...@@ -113,6 +113,7 @@ struct mg_termination_s {
mg_termination_t *next; /*!< List for physical terminations */ mg_termination_t *next; /*!< List for physical terminations */
mg_context_t* mg_ctxt; mg_context_t* mg_ctxt;
uint32_t flags; uint32_t flags;
const char *tech; /* Endpoint controlling the TDM interface - only FreeTDM tested so far */
union { union {
struct { struct {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论