Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.gets.app.jar;
- import javax.sip.message.Message;
- import javax.sip.message.Response;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import com.hp.opencall.ngin.scif.Call;
- import com.hp.opencall.ngin.scif.CallLeg;
- import com.hp.opencall.ngin.scif.CallUser;
- import com.hp.opencall.ngin.scif.Cause;
- import com.hp.opencall.ngin.scif.Contact;
- import com.hp.opencall.ngin.scif.PollEvent;
- import com.hp.opencall.ngin.scif.ScifEvent;
- import com.hp.opencall.ngin.scif.ScifException;
- import com.hp.opencall.ngin.scif.ScifFactory;
- import com.hp.opencall.ngin.scif.resources.IvrCallLeg;
- import com.hp.opencall.ngin.scif.resources.RawMediaCallLeg;
- import com.hp.opencall.ngin.scif.resources.RawMediaCallLeg.RawBytesMediaUser;
- import com.hp.opencall.ngin.scif.resources.RawMrfContact;
- import com.hp.opencall.seeconnector.diameterbase.api.event.DiameterBaseEvent;
- import com.hp.opencall.seeconnector.diameterbase.api.event.DiameterBaseMessageListener;
- import com.hp.opencall.ngin.scif.parameters.SipRawMessageContent;
- public class GetsCallUser implements CallUser, RawBytesMediaUser, DiameterBaseMessageListener {
- private static final Logger _log = LoggerFactory.getLogger(GetsCallUser.class.getPackage().getName());
- private final Call call;
- private IvrCallLeg ivrCallLeg;
- private static final String IVRCONTACT_SRF_NAME_SIP_RAW = "IMSMRF";
- public GetsCallUser(Call aCall) {
- call = aCall;
- }
- public void callStart(Cause aCause, CallLeg aFirstLeg, Contact aCalledParty) {
- _log.info("[GETS]["+this.getClass().getName()+"]:callStart()" + aCause.toString() + ".");
- try {
- RawMrfContact rawContact = ScifFactory.instance().getResourceContact(call, RawMrfContact.class, IVRCONTACT_SRF_NAME_SIP_RAW);
- call.forwardCall(rawContact);
- _log.info("[GETS]["+this.getClass().getName()+"]:callStart()" + rawContact.getName() + "|"+rawContact.getLegName()+"|"+rawContact.getAddress());
- } catch (ScifException e) {
- e.printStackTrace();
- }
- }
- public void callEarlyAnswered(CallLeg aNewLeg) {
- _log.info("[GETS]["+this.getClass().getName()+"]:Call early-answered.");
- }
- public void callAnswered(Cause aCause, CallLeg aNewLeg) {
- _log.info("[GETS]["+this.getClass().getName()+"]:"+"[" + call.getId() + "] Call answered");
- RawMediaCallLeg ivrLeg = (RawMediaCallLeg)aNewLeg;
- ivrLeg.setRawBytesMediaUser(this);
- // Build the media operation payload.
- SipRawMessageContent mediaOperation = null ;
- try {
- ivrLeg.performMediaOperation(mediaOperation);
- } catch (ScifException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- public void callPoll(ScifEvent anEvent) {
- if (anEvent instanceof PollEvent) {
- ((PollEvent)anEvent).reject(Cause.NOT_APPLICABLE);
- }
- }
- public void callEnd(Cause aCause) {
- _log.info("[GETS]["+this.getClass().getName()+"]:"+"[" + call.getId() + "] FMS call end, with cause " + aCause);
- }
- public void collectComplete(Cause aCause, String arg1){
- _log.info("[GETS]["+this.getClass().getName()+"]:"+"collectComplete()-->");
- }
- public void playComplete(Cause aCause) {
- _log.info("[GETS]["+this.getClass().getName()+"]:"+"playComplete()-->");
- try {
- ivrCallLeg.release(Cause.IVR_DISCONNECTED);
- } catch (ScifException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- public String getCallId() {
- return call.getId();
- }
- public void mediaOperationNotification(SipRawMessageContent arg0, Message arg1) {
- // TODO Auto-generated method stub
- }
- public void mediaOperationRejected(int arg0, Response arg1) {
- // TODO Auto-generated method stub
- }
- @Override
- public void requestReceived(DiameterBaseEvent arg0) {
- // TODO Auto-generated method stub
- }
- @Override
- public void responseReceived(DiameterBaseEvent arg0) {
- // TODO Auto-generated method stub
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement