/*
	ContextRSyncSipNotifyT
*/

ContextRSyncSipNotifyT::ContextRSyncSipNotifyT(
	MagSession&			session,
    	McsSubscriptionDataProxy sub,
	const string&		messageOriginator,
	)
	: ContextMsgBaseT(session,sub)
	, mMessageOriginator(messageOriginator)
{
	logWrite(MagLog, LOG_TRACE(4), __FILE__, __LINE__,
		 "Constructing ContextRSyncSipNotifyT");
		 
}


bool ContextRSyncSipNotifyT::isContextMwi()
{
	return false;
}

void ContextRSyncSipNotifyT::sendAck(int rspType, int errorCode)
{
	logWrite(MagLog, LOG_TRACE(4), __FILE__, __LINE__,
		 "ContextRSyncSipNotifyT::sendAck not invoking anything");
		 
	//this kind of transaction requires no end-to-end ACK
	mSession.killSession();
}

void ContextRSyncSipNotifyT::sendWifiMsg(
	const SessionDeviceSet::SessionDevice* psidDevice,
	const string& outboundAddress,
	RTTSession *tRtt,
	int cht
	)
{
	logWrite(MagLog, LOG_TRACE(4), __FILE__, __LINE__,
		 "ContextRSyncSipNotifyT::sendWifiMsg invoking sendMwiWifiMsg");
		 
}

void ContextRSyncSipNotifyT::sendSmppMsg(
	const SessionDeviceSet::SessionDevice* cellDevice
	)
{
	int typeNumFrom = TypeOfNumber::national;
	int planIndFrom = NumberPlanIndicator::isdn_e164;
	CseUri fromUri(mMessageOriginator);
	string fromDN = fromUri.get_userPart();
	
	RTTSession* rttSession = selectSmppRtt();
	if (!rttSession)
	{
		mSession.killSession();
		return;
	}
	int cht = -1;
	
	logWrite(MagLog, LOG_TRACE(4), __FILE__, __LINE__,
		 "ContextMsgMwiSipT::sendSmppMsg invoking sendMwiSmppMsg");
		 

	//E.L.
	/*
	 if ( VONAGE ) // in case of VONAGE CSE will send simple text msg not the binary mwi as it use to
        {
                simple text msg ( use to send binari(mwi pr blob) )


                SmppSendSMSMessage(
                mSession.mMagSessionID,
                cfg.smscName,
//              smppSmsInformation->mFrom,
                from, // config  VM_ADDRESS
//              smppSmsInformation->mTypeNumFrom,
                typeNumFrom,
//              smppSmsInformation->mPlanIndFrom,
                planIndFrom,
                toDN,
//              smppSmsInformation->mTypeNumTo,//TypeOfNumber::international,
                typeNumTo,//TypeOfNumber::international, should be part of config for VM_ADDRESS
//              smppSmsInformation->mPlanIndTo,//NumberPlanIndicator::e164,
                planIndTo,//NumberPlanIndicator::e164,  // should be part of config for VM_ADDRESS
//              smppSmsInformation->mTxtMsg,
                this->mTxtMsg,
//              smppSmsInformation->mconnection,
                this->mRTTSession,
//              smppSmsInformation->ch
                this->mChannel
                );
        }
	*/

	sendMwiSmppMsg(
		mSession,
		cellDevice,
		rttSession,
		cht,
		fromDN,
		typeNumFrom,
		planIndFrom,
		this->mIndicationActive,
		//don't really know what type it is
		MwiType::voicemail
		, m_mcsSubscriptionData
		, this);
}
