Doing a Collect Call with asterisk

Hi there,

Our company is a VoIP service provider and have many users registered with us and using our calling services. I am starting a project related to the collect call concept. In this scenario the called party will bear the cost of the entire call ( i think the caller and called party should be client of the same company so to charge the called party).

The caller calls the desired number with some specific number appended in from (for example if then number to dial is 12345678 then caller dials 9912345678) and when called party answers the call then he will hear an announcement asking him to press 1 to allow collect call or press 2 to reject.

Below is the basic flow up to the confirmation from the called party.

exten => 890,1,Wait(0.2)
exten => 890,n,Playback(screen-record)
exten => 890,n,SetVar(SCREEN_FILE=/tmp/${CALLERID(number)}-${EPOCH})
exten => 890,n,Record(${SCREEN_FILE}.gsm|6|25)
exten => 890,n,Dial(SIP/16|60|gM(screen^${SCREEN_FILE}))
exten => 890,n,Voicemail(10@default)

exten => s,1,Wait(0.2)
exten => s,n,Playback(screen-from)
exten => s,n,Playback(${ARG1})
exten => s,n,Read(ACCEPT|screen-accept|1)
exten => s,n,GotoIf($[${ACCEPT} = 1 ] ?yes:no)
exten => s,n(yes),SetVar(MACRO_RESULT=CONTINUE)
exten => s,n(no),System(/bin/rm ${ARG1})

Now my question is, if the called party accepts the collect call, how can I charge the called party. My idea is to switch the caller’s account code with called party so that the billing will be done on the called party’s account code.

I will like to hear from you guys there if this idea will work and also i will like to hear any other idea from you guys.

Nasir Javaid
Software Engineer

If you call one of my numbers and you are identified as a “junk caller”, then my system automatically plays a DTMF 1 to get the telemarketer human to get on the line. (for the robocalls that say "press 1 to lower your interest rate!)

So, just using “1 to accept” is not going to work. I think something like reverse billing is going to require a human in the loop.

Another observation: who still uses collect calls anyway?

Thanks Basildane,

Answer of your second observation first: A mobile operator in our country is providing this facility to its users. the caller, if has no balance to call, then calls the number with some prefixed digits. while the caller is hearing announcement the callee’s phone rings and he is asked that he will be billed for this call and if he agrees then the call is bridged…

so as i said that operator is providing this facility to it’s own network subscribers hence empowering my idea that they reverse the billing if a collect call is accepted. i think it will work :smile: