NSRPureCld | 2018-08-15 16:07:30 UTC | #1
Tim, We are using a WEB RTC Soft Phone. We need to make an outbound call and get the conversation id of the placed call.
We are under the impression that for this we will need WebRTC Softphone SDK. Question #1. Is this a correct statement ?
We were given a link to information regarding this SDK WebRTC Softphone SDK: https://developer.mypurecloud.com/api/webrtcsdk/
It only explains the concept says to include the following java script etc.
<script src="https://sdk-cdn.mypurecloud.com/webrtc-sdk/latest/purecloud-webrtc-sdk.js"></script> <script> const sdk = new window.PureCloudWebrtcSdk({ accessToken: 'your access token' }); sdk.initialize(); </script>
What we need is a java script sample code for using this SDK. Question #2. Can you provide a java script sample please ?
Question #3. does //sdk-cdn.mypurecloud.com/webrtc-sdk/latest/purecloud-webrtc-sdk.js use ES6 syntax. It seems that ES6 does not work in IE11 !
Thanks
tim.smith | 2018-08-15 20:20:51 UTC | #2
See step 5. https://help.mypurecloud.com/articles/select-purecloud-webrtc-phone-as-your-phone/
NSRPureCld | 2018-08-16 12:38:57 UTC | #3
Tim,
My question was not regarding setting a switch on the WEB RTC Phone. I understand that to make the call "Placing calls with another app?" should be On. Thanks.
My question was requesting you to provide a java script example in using the following sdk: https://sdk-cdn.mypurecloud.com/webrtc-sdk/latest/purecloud-webrtc-sdk.js
In any event, I started writing java script code to use this sdk and need help from Genysis to fix an issue that I am encountering. I am following instructions in the document at the following link: (https://developer.mypurecloud.com/api/webrtcsdk/
Please read all the steps and if you could answer the question at the end ?
1. I am initializing the sdk as follows:
function initializeSDK() { console.log("in initialize JJJJJ SDK"); sdk = new window.PureCloudWebrtcSdk({ accessToken: receivedToken, environment: 'mypurecloud.com' });
console.log("sdk = " + sdk); var aPromise = sdk.initialize();
aPromise.then(function() { sdk.on('pendingSession', ({id,address,conversationId,autoAnswer}) => pendingSessionSuccess(id, address, conversationId, autoAnswer));
sdk.on('sessionStarted', (session) => sessionStarted(session));
sdk.on('trace', function(level, message, details){ console.log("in trace level: " + level); console.log("in trace message: " + message); console.log("in trace details: " + details); });
}, function(){ console.log("failed failed failed"); });
Notes:
1. I do have the correct access token.
2. The sdk is being initialized correctly.
3. The promise is being fulfilled.
4. When I step thru the code, my debugger does stop on two sdk.on statements indicating that the events are being registered:
sdk.on('pendingSession', ({id,address,conversationId,autoAnswer}) => pendingSessionSuccess(id, address, conversationId, autoAnswer));
sdk.on('sessionStarted', (session) => sessionStarted(session));
Notes
1. I have the two functions coded correctly as shown below:
function pendingSessionSuccess(id, address, conversationId, autoAnswer){ console.log("in pendingSessionSuccess"); console.log("in sdk.on id = " + id); console.log("in sdk.on address = " + address); console.log("in sdk.on conversationId = " + conversationId); console.log("in sdk.on autoAnswer = " + autoAnswer) sdk.acceptPendingSession(id); }
function sessionStarted(session){ console.log("in sessionStarted session: " + session); }
But when we make the outbound call via makeOutBoundCall function, (see makeOutBoundCall down below), these events are not being fired.
Notes
2. the WEB RTC phone does ring however. But there is no way to answer he phone.
function makeOutBoundCall() {
console.log("in makeOutBoundCall");
$.ajax({ url:"https://api.mypurecloud.com/api/v2/conversations/calls", type:"POST", data: payload, contentType: "application/json", beforeSend: function(xhr){ xhr.setRequestHeader('Authorization', 'bearer ' + receivedToken); }, success: function(data){ console.log("in success function of makeOutBoundCall"); var stringifiedData = JSON.stringify(data); console.log("in success function of makeOutBoundCall stringifiedData = " + stringifiedData);
} });
console.log("made outbound call"); }
Question. What am I doing wrong ?
anon57595521 | 2018-08-16 15:13:22 UTC | #4
Hi, and thanks for working with the webrtc-sdk. Sorry to hear you're having some trouble. There is an example application here -
https://github.com/MyPureCloud/purecloud-webrtc-sdk/blob/master/test/test-pages/
The SDK integration code is here - https://github.com/MyPureCloud/purecloud-webrtc-sdk/blob/master/test/test-pages/common/sdk-controller.js
I'm looking over your code, but I don't see anything obvious that's wrong. Could you make sure that you're not getting any javascript errors in the console?
Additionally, try wiring up the trace and error sdk events (see below) which will log out additional information about what's going on in the SDK.
sdk.on('trace', console.log.bind(console, 'webrtc sdk trace'))
sdk.on('error', console.log.bind(console, 'webrtc sdk error'))
anon57595521 | 2018-08-16 15:26:09 UTC | #5
Rereading I see you already have the trace event wired up - are you getting any logs from that? If so, could you post them here?
Additionally, could you clarify what you mean by this?
the [WebRTC] phone does ring however. But there is no way to answer [the] phone.`
Which application is ringing? With an outbound call, there should be no audible ringing, or a need to "answer" - only to connect the session, since with outbound, it's implied that the connection should establish immediately, and the user should not hear ringing or need to answer a call that was just placed.
system | 2018-09-16 15:26:13 UTC | #6
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 3376