Skip to content
This repository has been archived by the owner on Nov 19, 2019. It is now read-only.

Putting Client Softphone inbound call into a conference hangs up the call after 3 beeps. #54

Open
kishorejena opened this issue Oct 18, 2015 · 0 comments

Comments

@kishorejena
Copy link

I have the following code to transfer an inbound call to a browser soft phone from one agent to another agent. This code works well for transferring an outbound call from the same browser softphone to another phone. But for inbound calls the browser phone disconnects when it puts into a conference room.

Here is the code

    public void transferCall() {
        System.Debug('Phone Number = ' + callTo + ' Transfer Number = ' + transferTo);

        // Get the default Twilio Client
        TwilioRestClient client = TwilioAPI.getDefaultClient();
        Map<String,String> filters = new Map<String,String>{'Status'=>'in-progress'};
        Iterator<TwilioCall> calls = client.getAccount().getCalls(filters).iterator();
        System.Debug('Before Redirecting Calls to Conference');
        // Redirect the ongoing call to a conference room
        while (calls.hasNext()) {
            TwilioCall call = calls.next();
            System.Debug('Parent Call Sid = ' + call.getParentCallSid());
            System.Debug('Sid = ' + call.getSid());
            System.Debug('Call URI = ' + call.getUri());
            System.Debug('Call Status = ' + call.getStatus());
            System.Debug('Call Direction = ' + call.getDirection());
            if(((call.getDirection() == 'inbound' && call.getParentCallSid() != null) || 
               (call.getDirection() != 'inbound')) && (call.getStatus() == 'in-progress') 
              ){
                System.Debug('Before Re-directing call to conference Call URI = ' + call.getUri()); 
                call.redirect('http://test-businessfunding.cs10.force.com/conference', 'POST');
                System.Debug('After Re-directing call to conference Call URI = ' + call.getUri());
            }
        }
        System.Debug('After Redirecting Calls to Conference');

        // Dial the transfer number to join the conference room
        Map<String,String> params = new Map<String,String>{
            'To' => transferTo,
            'From' => TwilioAPI.getTwilioConfig().CallerId__c,
            'Url' => 'http://test-businessfunding.cs10.force.com/conference'
        };
        System.Debug('Before Making new call to Transfer number to join the same conference');
        TwilioCall call = client.getAccount().getCalls().create(params);
        System.Debug('After Making new call to Transfer number to join the same conference');
        System.debug(call.getDuration());
        System.debug(call.getSid());             
    } 

Any help in resolving this critical issue will be highly appreciated.

Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant