adding add rsp sdp code

This commit is contained in:
root 2012-07-25 17:28:56 -04:00
parent 6cf298a746
commit f223b9a0bb

View File

@ -142,8 +142,13 @@ switch_status_t mg_is_ito_pkg_req(megaco_profile_t* mg_profile, MgMgcoCommand *c
(reqEvtPar->u.other.val.u.eq.type.pres == PRSNT_NODEF) &&
(reqEvtPar->u.other.val.u.eq.type.val == MGT_VALTYPE_UINT32))
{
#ifdef BIT_64
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO," Received Inactivity timer value [%d]\n",
reqEvtPar->u.other.val.u.eq.u.decInt.val);
#else
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO," Received Inactivity timer value [%ld]\n",
reqEvtPar->u.other.val.u.eq.u.decInt.val);
#endif
mg_profile->inact_tmr = reqEvtPar->u.other.val.u.eq.u.decInt.val/MG_INACTIVITY_TMR_RESOLUTION;
@ -544,7 +549,7 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
if ((NOTPRSNT != termId->type.pres) &&
(MGT_TERMID_CHOOSE == termId->type.val)){
term = megaco_choose_termination(mg_profile, "RTP"); /* TODO - RTP string has be configured one */
term = megaco_choose_termination(mg_profile, mg_profile->rtp_termination_id_prefix);
if(NULL == term){
mg_util_set_err_string(&errTxt, " Resource Failure ");
@ -660,14 +665,19 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
desc->type.val = MGT_MEDIADESC;
mgUtlCpyMgMgcoMediaDesc(&desc->u.media, inc_med_desc, &rsp.u.mgCmdRsp[0]->memCp);
{
/* only for RTP */
if(is_rtp){
/* build local descriptors */
/*MgMgcoStreamDesc *stream;*/
MgMgcoLocalDesc *local;
CmSdpInfoSet *psdp;
char* ipAddress = "192.168.1.1";
char* ipAddress[4];// = "192.168.1.1";
MgMgcoMediaDesc* media = &desc->u.media;
switch_split((char*)term->u.rtp.local_addr,'.',ipAddress);
printf("ipAddress[0]=%s, ipAddress[1]=%s, ipAddress[2]=%s,ipAddress[3]=%s\n",ipAddress[0],ipAddress[1],ipAddress[2],ipAddress[3]);
/* Most probably we need to add local descriptor */
/* allocating mem for local descriptor */
@ -746,13 +756,13 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
MG_SET_VAL_PRES( (psdp->info[psdp->numComp.val-1]->orig.orig.sdpAddr.u.ip4.addrType),
CM_SDP_IPV4_IP_UNI);
MG_SET_VAL_PRES( (psdp->info[psdp->numComp.val-1]->orig.orig.sdpAddr.u.ip4.u.ip.b[0]),
ipAddress[0]);
atoi(ipAddress[0]));
MG_SET_VAL_PRES( (psdp->info[psdp->numComp.val-1]->orig.orig.sdpAddr.u.ip4.u.ip.b[1]),
ipAddress[1]);
atoi(ipAddress[1]));
MG_SET_VAL_PRES( (psdp->info[psdp->numComp.val-1]->orig.orig.sdpAddr.u.ip4.u.ip.b[2]),
ipAddress[2]);
atoi(ipAddress[2]));
MG_SET_VAL_PRES( (psdp->info[psdp->numComp.val-1]->orig.orig.sdpAddr.u.ip4.u.ip.b[3]),
ipAddress[3]);
atoi(ipAddress[3]));
/* fill session name */
/* TODO - need to fill proper session name or skip it..*/
@ -765,10 +775,11 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
MG_INIT_TOKEN_VALUE(&(psdp->info[psdp->numComp.val-1]->conn.addrType), CM_SDP_ADDR_TYPE_IPV4);
MG_INIT_TOKEN_VALUE(&(psdp->info[psdp->numComp.val-1]->conn.u.ip4.addrType), CM_SDP_IPV4_IP_UNI);
MG_SET_VAL_PRES( (psdp->info[psdp->numComp.val-1]->conn.u.ip4.u.uniIp.b[0]), ipAddress[0]);
MG_SET_VAL_PRES( (psdp->info[psdp->numComp.val-1]->conn.u.ip4.u.uniIp.b[1]), ipAddress[1]);
MG_SET_VAL_PRES( (psdp->info[psdp->numComp.val-1]->conn.u.ip4.u.uniIp.b[2]), ipAddress[2]);
MG_SET_VAL_PRES( (psdp->info[psdp->numComp.val-1]->conn.u.ip4.u.uniIp.b[3]), ipAddress[3]);
MG_SET_VAL_PRES( (psdp->info[psdp->numComp.val-1]->conn.u.ip4.u.uniIp.b[0]), atoi(ipAddress[0]));
MG_SET_VAL_PRES( (psdp->info[psdp->numComp.val-1]->conn.u.ip4.u.uniIp.b[1]), atoi(ipAddress[1]));
MG_SET_VAL_PRES( (psdp->info[psdp->numComp.val-1]->conn.u.ip4.u.uniIp.b[2]), atoi(ipAddress[2]));
MG_SET_VAL_PRES( (psdp->info[psdp->numComp.val-1]->conn.u.ip4.u.uniIp.b[3]), atoi(ipAddress[3]));
/* t= line */
MG_INIT_TOKEN_VALUE(&(psdp->info[psdp->numComp.val-1]->sdpTime.pres),1);
@ -801,6 +812,7 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
MG_INIT_TOKEN_VALUE(&(media->field.id.u.port.type),CM_SDP_PORT_INT);
MG_INIT_TOKEN_VALUE(&(media->field.id.u.port.u.portInt.pres),1);
MG_INIT_TOKEN_VALUE(&(media->field.id.u.port.u.portInt.port.type), CM_SDP_SPEC);
//MG_INIT_TOKEN_VALUE(&(media->field.id.u.port.u.portInt.port.val), term->u.rtp.local_port);
MG_INIT_TOKEN_VALUE(&(media->field.id.u.port.u.portInt.port.val), 2904);
if (mgUtlGrowList((void ***)&media->field.par.pflst, sizeof(CmSdpMedProtoFmts),
@ -837,11 +849,9 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
}
MG_INIT_TOKEN_VALUE(&(media->attrSet.attr[0]->type),CM_SDP_ATTR_PTIME);
MG_INIT_TOKEN_VALUE(&(media->attrSet.attr[0]->u.ptime),30);
MG_INIT_TOKEN_VALUE(&(media->attrSet.attr[0]->u.ptime), term->u.rtp.ptime);
}
}
}