Re: Re: credit info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>If you follow 2.2 branch, then you can see it has some steps done
>towards more elegant auth data exchange. A similar thing will be in 2.0.
>On the other hand you cannot satisfy everyone and do everything at once,
>so if someone needs some feature badly, even an outdated patch may help him;)
>
>If you can provide a patch for 2.2, that is using ARQAuthData structure
>to pass some credit related info between ARQ handler and authenticators,
>I would happily commit it.
>



I have tried to code for v2.2, but I simply failed to track someone's ideas in it - where and what goes, mix of stl and pwlib... 
I think I'll try my best soon, will see.

For now, a simple solution would be a simple function (source below).
It should be made to be a member of EndpointRec class.
in minimalist situation its declaration is like this: 
bool SendServiceControlIndication(PString & amountString, unsigned int callDurationLimit); //you are to add h323-preferred-lang, billing-model, etc (if you need)...

it's implementation is as follows (sorry for formatting, on how to use this function see at the end of the msg):


bool EndpointRec::SendServiceControlIndication(PString & amountString, unsigned int callDurationLimit)
{
	PTRACE(3,"RADACCT\t MyTRACE: EndpointRec::SendServiceControlIndication"<<endl);

	if( GetRasAddress().GetTag() != H225_TransportAddress::e_ipAddress || (callDurationLimit <= 0 && amountString.IsEmpty())){
		return false;
	}

	H225_RasMessage ras_msg;
	ras_msg.SetTag(H225_RasMessage::e_serviceControlIndication);
	H225_ServiceControlIndication & sci = ras_msg;
	sci.m_requestSeqNum.SetValue(RasThread->GetRequestSeqNum());
	sci.m_serviceControl.SetSize(1);

	H225_ServiceControlSession &scs = sci.m_serviceControl[0];

	scs.m_reason.SetTag(H225_ServiceControlSession_reason::e_refresh);
	scs.m_sessionId.SetValue(1);		//??XXX?? what should be here????
	scs.IncludeOptionalField(H225_ServiceControlSession::e_contents);

	H225_ServiceControlDescriptor &scd = scs.m_contents;
	scd.SetTag(H225_ServiceControlDescriptor::e_callCreditServiceControl);

					
	H225_CallCreditServiceControl& ccsc = scd;

	if (!amountString.IsEmpty()){	//at this point this balance string is of form: "12345.25USD"; I leave it up to the user app to modify it to $12345.25 or may be to $12340.25 :))
		//PTRACE(3,"RADACCT\t MyTRACE: EndpointRec::SendServiceControlIndication line "<<__LINE__<<endl);
		ccsc.IncludeOptionalField(H225_CallCreditServiceControl::e_amountString);
		ccsc.m_amountString.SetValue(amountString);
		//PTRACE(3,"RADACCT\t MyTRACE: EndpointRec::SendServiceControlIndication line "<<__LINE__<<endl);
	}


/*  //like this you add other info...
	if(billingMode != (H225_CallCreditServiceControl_billingMode::Choices)-1){
		ccsc.IncludeOptionalField(H225_CallCreditServiceControl::e_billingMode);
		ccsc.m_billingMode.SetTag(billingMode);
	}
*/
	if (callDurationLimit > 0){
		ccsc.IncludeOptionalField(H225_CallCreditServiceControl::e_callDurationLimit);
		ccsc.m_callDurationLimit.SetValue(callDurationLimit);
		ccsc.IncludeOptionalField(H225_CallCreditServiceControl::e_enforceCallDurationLimit);
		ccsc.m_enforceCallDurationLimit.SetValue(TRUE); //or = FALSE == not to force.
	}
	const H225_TransportAddress * adr =& GetRasAddress();
	RasThread->SendRas(ras_msg, *adr);
	return true;
}
 
//end


Sometimes (expecially when a call is routed over a remote GK/GW) it is REALLY difficult to pass over some data in elegant way (without ugly hacks) into the main ras code so that you can make use of it later (e.g. when the call is established with the remote gateway)
Since I didn't find any docs, explanation, help etc on how one could possibly do it, I wrote this function and in such cases my gnugk simply sends a separate ServiceControlIndication message. (I think it's only h225v4, whatever...) The only thing left is to make your endpoint undestand this message :) (Overide h323Gatekeeper::OnServiceControlIndication - or something like this, for example...)

one place in my gnugk sources where I use it is like this:

RadAcct::LogAcctEvent(..,callptr& call,..){
...
...
//just after you received radius reply and parsed all atributes in the reply, you can do like this:
endptr EP = call->GetCallingParty();
if(EP){
   EP->SendServiceControlIndication( BalanceString, callduration); 
}




-------------------------------------------------------
This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND

_______________________________________________________

List: Openh323gk-users@xxxxxxxxxxxxxxxxxxxxx
Archive: http://sourceforge.net/mailarchive/forum.php?forum_id=8549
Homepage: http://www.gnugk.org/

[Index of Archives]     [SIP]     [Open H.323]     [Gnu Gatekeeper]     [Asterisk PBX]     [ISDN Cause Codes]     [Yosemite News]

  Powered by Linux