com.hoiio.sdk
Class HoiioService

java.lang.Object
  extended by com.hoiio.sdk.HoiioService

public class HoiioService
extends Object


Constructor Summary
HoiioService(String appId, String accessToken)
          Constructor
 
Method Summary
 Map<String,Object> call(String dest1, String dest2, String callerId, String tag, String notifyUrl)
          Make 2-way callback
 Map<String,Object> callGetHistory(Date from, Date to, Integer page)
          Get call history
 Map<String,Object> callGetRate(String dest1, String dest2)
          Get Call Rate
 Map<String,Object> callQueryStatus(String txnRef)
          Query call status
 Map<String,Object> conference(String dest, String room, String callerId, String tag, String notifyUrl)
          Make conference call
 Map<String,Object> hangup(String txnRef)
           
 Map<String,Object> ivrDial(String msg, String dest, String callerID, String tag, String notifyUrl)
          Make outgoing IVR
 Map<String,Object> ivrGather(String session, String msg, Integer maxDigits, Integer timeout, Integer attempts, String tag, String notifyUrl)
          IVR Gather
 Map<String,Object> ivrHangup(String session, String msg, String tag, String notifyUrl)
          IVR Hangup
 Map<String,Object> ivrPlay(String session, String msg, String tag, String notifyUrl)
          IVR play the message
 Map<String,Object> ivrRecord(String session, String msg, String maxDuration, String tag, String notifyUrl)
          IVR Record
 Map<String,Object> ivrTransfer(String session, String msg, String dest, String callerID, String tag, String notifyUrl)
          IVR Transfer
 Map<String,String> parseNotify(String notify)
          Parse notify for call, sms and ivr
 Map<String,Object> smsGetHistory(Date from, Date to, Integer page)
          Get SMS history
 Map<String,Object> smsGetRate(String dest, String msg)
          Get SMS rate
 Map<String,Object> smsQueryStatus(String txnRef)
          Query SMS status
 Map<String,Object> smsSend(String dest, String senderName, String msg, String tag, String notifyUrl)
          Send SMS
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HoiioService

public HoiioService(String appId,
                    String accessToken)
Constructor

Method Detail

call

public Map<String,Object> call(String dest1,
                               String dest2,
                               String callerId,
                               String tag,
                               String notifyUrl)
                        throws HoiioException
Make 2-way callback

Parameters:
dest1 - (optional) The first number to call in E.164 format (e.g. +6511111111). This cannot be the same as dest2 parameter. If omitted, the call will be made to the number registered in your developer account.
dest2 - The second number to call in E.164 format (e.g. +6511111111). This cannot be the same as dest1 parameter.
callerId - (optional) Caller ID that dest2 will see on their incoming call. Can be either developer's registered number/hoiio number/"private"
tag - (optional) This is a text string containing your own reference ID for this transaction
notifyUrl - (optional) A fully-qualified HTTP/S callback URL on your web server to be notified when the call ends
Returns:
Throws:
HoiioException - Any error occurs

callGetRate

public Map<String,Object> callGetRate(String dest1,
                                      String dest2)
                               throws HoiioException
Get Call Rate

Parameters:
dest1 - The first number to call in E.164 format (e.g. +6511111111).
dest2 - The second number to call in E.164 format (e.g. +6511111111).
Returns:
Throws:
HoiioException - Any error occurs

callQueryStatus

public Map<String,Object> callQueryStatus(String txnRef)
                                   throws HoiioException
Query call status

Parameters:
txnRef - The unique reference ID for the required transaction.
Returns:
Throws:
HoiioException - Any error occurs

callGetHistory

public Map<String,Object> callGetHistory(Date from,
                                         Date to,
                                         Integer page)
                                  throws HoiioException
Get call history

Parameters:
from - (optional) Retrieve call history made by this app starting from this date/time in "YYYY-MM-DD HH:MM:SS" (GMT+8) format. E.g. "2010-01-01 00:00:00". If omitted, call history will be retrieved from the earliest transaction.
to - (optional) Retrieve call history made by this app before this date/time in "YYYY-MM-DD HH:MM:SS" (GMT+8) format. E.g. "2010-01-01 00:00:00". If omitted, call history will be retrieved up to the current point of time.
page - (optional) Each request returns a maximum of 100 entries. This parameter indicates which subset of entries to return. If omitted, the first page will be retrieved.
Returns:
Throws:
HoiioException - Any error occurs

conference

public Map<String,Object> conference(String dest,
                                     String room,
                                     String callerId,
                                     String tag,
                                     String notifyUrl)
                              throws HoiioException
Make conference call

Parameters:
dest - A comma-seperated list of destination numbers in E.164 format to be called and placed in the conference room
room - (optional) A text string representing the conference room ID. Valid characters are a-z, A-Z, 0-9, period (.) and underscore (_) characters. Max 32 characters.
callerId - (optional) The Caller ID that each destination number will see on their incoming call.
tag - (optional) This is a text string containing your own reference ID for this transaction
notifyUrl - (optional) A fully-qualified HTTP/S callback URL on your web server to be notified when a call ends
Returns:
Throws:
HoiioException - Any error occurs

hangup

public Map<String,Object> hangup(String txnRef)
                          throws HoiioException
Parameters:
txnRef - The unique reference ID for the call you want to hangup.
Returns:
Throws:
HoiioException

smsSend

public Map<String,Object> smsSend(String dest,
                                  String senderName,
                                  String msg,
                                  String tag,
                                  String notifyUrl)
                           throws HoiioException
Send SMS

Parameters:
dest - The recipient number of the SMS in E.164 format (e.g. +6511111111).
senderName - (optional) The sender name that the recipient of your SMS will see
msg - Contents of the SMS message.
tag - (optional) This is a text string containing your own reference ID for this transaction
notifyUrl - (optional) A fully-qualified HTTP/S callback URL on your web server to be notified when the SMS has been delivered
Returns:
Throws:
HoiioException

smsGetRate

public Map<String,Object> smsGetRate(String dest,
                                     String msg)
                              throws HoiioException
Get SMS rate

Parameters:
dest - The recipient number of the SMS in E.164 format (e.g. +6511111111).
msg - (optional) If provided, an estimate of the number of multipart SMS and total cost of sending this message will be included in the response. Otherwise, the rate per multipart SMS will be returned.
Returns:
Throws:
HoiioException

smsQueryStatus

public Map<String,Object> smsQueryStatus(String txnRef)
                                  throws HoiioException
Query SMS status

Parameters:
txnRef - The unique reference ID for the required transaction.
Returns:
Throws:
HoiioException

smsGetHistory

public Map<String,Object> smsGetHistory(Date from,
                                        Date to,
                                        Integer page)
                                 throws HoiioException
Get SMS history

Parameters:
from - (optional) Retrieve SMS history made by this app starting from this date/time in "YYYY-MM-DD HH:MM:SS" (GMT+8) format. E.g. "2010-01-01 00:00:00". If omitted, SMS history will be retrieved from the earliest transaction.
to - (optional) Retrieve SMS history made by this app before this date/time in "YYYY-MM-DD HH:MM:SS" (GMT+8) format. E.g. "2010-01-01 00:00:00". If omitted, SMS history will be retrieved up to the current point of time.
page - (optional) Each request returns a maximum of 100 entries. This parameter indicates which subset of entries to return. If omitted, the first page will be retrieved.
Returns:
Throws:
HoiioException

ivrDial

public Map<String,Object> ivrDial(String msg,
                                  String dest,
                                  String callerID,
                                  String tag,
                                  String notifyUrl)
                           throws HoiioException
Make outgoing IVR

Parameters:
msg - (optional) The message that you want to play after the call is answered. Max 500 characters.
dest - The destination number to call in E.164 format (e.g. +6511111111).
callerID - (optional) The Caller ID that the destination number will see on their incoming call
tag - (optional) This is a text string containing your own reference ID for this transaction
notifyUrl - (optional) A fully-qualified HTTP/S URL on your web server to be notified when this action has completed execution
Returns:
Throws:
HoiioException

ivrPlay

public Map<String,Object> ivrPlay(String session,
                                  String msg,
                                  String tag,
                                  String notifyUrl)
                           throws HoiioException
IVR play the message

Parameters:
session - The unique session ID for this particular call. (returned in one of the start blocks: dial or answer)
msg - (optional) This is the message that you want to play to the user. Max 500 characters.
tag - (optional) This is a text string containing your own reference ID for this transaction
notifyUrl - (optional) A fully-qualified HTTP/S URL on your web server to be notified when this action has completed execution
Returns:
Throws:
HoiioException

ivrGather

public Map<String,Object> ivrGather(String session,
                                    String msg,
                                    Integer maxDigits,
                                    Integer timeout,
                                    Integer attempts,
                                    String tag,
                                    String notifyUrl)
                             throws HoiioException
IVR Gather

Parameters:
session - The unique session ID for this particular call. (returned in one of the start blocks: dial or answer)
msg - (optional) This is the message that you want to play to the user. Max 500 characters.
maxDigits - (optional) the maximum digits people can enter
timeout - (optional) the time that user need to input the response
attempts - (optional) number of user attempts
tag - (optional) This is a text string containing your own reference ID for this transaction
notifyUrl - A fully-qualified HTTP/S URL on your web server to be notified when this action has completed execution
Returns:
Throws:
HoiioException

ivrRecord

public Map<String,Object> ivrRecord(String session,
                                    String msg,
                                    String maxDuration,
                                    String tag,
                                    String notifyUrl)
                             throws HoiioException
IVR Record

Parameters:
session - The unique session ID for this particular call. (returned in one of the start blocks: dial or answer)
msg - (optional) This is the message that you want to play to the user. Max 500 characters.
maxDuration - (optional) maximum time of the record
tag - (optional) This is a text string containing your own reference ID for this transaction
notifyUrl - A fully-qualified HTTP/S URL on your web server to be notified when this action has completed execution
Returns:
Throws:
HoiioException

ivrTransfer

public Map<String,Object> ivrTransfer(String session,
                                      String msg,
                                      String dest,
                                      String callerID,
                                      String tag,
                                      String notifyUrl)
                               throws HoiioException
IVR Transfer

Parameters:
session - The unique session ID for this particular call. (returned in one of the start blocks: dial or answer)
msg - (optional) This is the message that you want to play to the user. Max 500 characters.
dest - the destination to transfer the call to
callerID - (optional) the callerID of the call
tag - (optional) This is a text string containing your own reference ID for this transaction
notifyUrl - (optional) A fully-qualified HTTP/S URL on your web server to be notified when this action has completed execution
Returns:
Throws:
HoiioException

ivrHangup

public Map<String,Object> ivrHangup(String session,
                                    String msg,
                                    String tag,
                                    String notifyUrl)
                             throws HoiioException
IVR Hangup

Parameters:
session - The unique session ID for this particular call. (returned in one of the start blocks: dial or answer)
msg - (optional) This is the message that you want to play to the user. Max 500 characters.
tag - (optional) This is a text string containing your own reference ID for this transaction
notifyUrl - (optional) A fully-qualified HTTP/S URL on your web server to be notified when this action has completed execution
Returns:
Throws:
HoiioException

parseNotify

public Map<String,String> parseNotify(String notify)
Parse notify for call, sms and ivr

Parameters:
notify -
Returns: