余尚辉 4 mesi fa
parent
commit
968867f227
3 ha cambiato i file con 28 aggiunte e 58 eliminazioni
  1. 5 1
      src/hs-cti/HsCTI.ts
  2. 12 12
      src/hs-cti/SessionManager.ts
  3. 11 45
      src/sdk.html

+ 5 - 1
src/hs-cti/HsCTI.ts

@@ -385,7 +385,11 @@ export class HsCTI extends EventEmitter {
         authorizationPassword: initOptions.phonePwd,
         sessionDescriptionHandlerFactoryOptions: {
           constraints: {
-            audio: true,
+            audio: {
+              echoCancellation: true,
+              noiseSuppression: true,
+              autoGainControl: true
+            },
             video: false
           },
           peerConnectionConfiguration: {

+ 12 - 12
src/hs-cti/SessionManager.ts

@@ -341,16 +341,16 @@ export class SessionManagerPlus {
    * @param session - Session to get the media stream from.
    */
   public getLocalMediaStream(session: Session): MediaStream | undefined {
-    const sdh = session.sessionDescriptionHandler
-    if (!sdh) {
+    const hsh = session.sessionDescriptionHandler
+    if (!hsh) {
       return undefined
     }
-    if (!(sdh instanceof Web.SessionDescriptionHandler)) {
+    if (!(hsh instanceof Web.SessionDescriptionHandler)) {
       throw new Error(
         'Session description handler not instance of web SessionDescriptionHandler'
       )
     }
-    return sdh.localMediaStream
+    return hsh.localMediaStream
   }
 
   /**
@@ -358,16 +358,16 @@ export class SessionManagerPlus {
    * @param session - Session to get the media stream from.
    */
   public getRemoteMediaStream(session: Session): MediaStream | undefined {
-    const sdh = session.sessionDescriptionHandler
-    if (!sdh) {
+    const hsh = session.sessionDescriptionHandler
+    if (!hsh) {
       return undefined
     }
-    if (!(sdh instanceof Web.SessionDescriptionHandler)) {
+    if (!(hsh instanceof Web.SessionDescriptionHandler)) {
       throw new Error(
         'Session description handler not instance of web SessionDescriptionHandler'
       )
     }
-    return sdh.remoteMediaStream
+    return hsh.remoteMediaStream
   }
 
   /**
@@ -605,11 +605,11 @@ export class SessionManagerPlus {
                   `[${inviter.id}] Found srflx ICE candidate, stop waiting...`
                 )
                 // In sip.js > 0.20.1 this cast should be removed as iceGatheringComplete will be public
-                const sdh =
+                const hsh =
                   sessionDescriptionHandler as Web.SessionDescriptionHandler & {
                     iceGatheringComplete: () => void
                   }
-                sdh.iceGatheringComplete()
+                hsh.iceGatheringComplete()
               }
             }
           }
@@ -1524,14 +1524,14 @@ export class SessionManagerPlus {
     // Session properties used to pass options to the SessionDescriptionHandler:
     //
     // 1) Session.sessionDescriptionHandlerOptions
-    //    SDH options for the initial INVITE transaction.
+    //    hsH options for the initial INVITE transaction.
     //    - Used in all cases when handling the initial INVITE transaction as either UAC or UAS.
     //    - May be set directly at anytime.
     //    - May optionally be set via constructor option.
     //    - May optionally be set via options passed to Inviter.invite() or Invitation.accept().
     //
     // 2) Session.sessionDescriptionHandlerOptionsReInvite
-    //    SDH options for re-INVITE transactions.
+    //    hsH options for re-INVITE transactions.
     //    - Used in all cases when handling a re-INVITE transaction as either UAC or UAS.
     //    - May be set directly at anytime.
     //    - May optionally be set via constructor option.

+ 11 - 45
src/sdk.html

@@ -17,52 +17,18 @@
 
 
 <body>
-
-  <div id="login-page"
-    style="width: 424px; height: 260px; background-color: #f2f4f4; border: 1px solid grey; padding-top: 4px">
-    <table border="0" frame="void" width="418px">
-      <tr>
-        <td class="td_label" width="160px" align="right"><label for="sip_uri">SIP URI:</label></td>
-        <td width="258px"><input style="width:250px" id="sip_uri" type="text" placeholder="sip:1001@pbx.fuxicarbon.com"
-            value="sip:1001@pbx.fuxicarbon.com" /></td>
-      </tr>
-      <tr>
-        <td class="td_label" align="right"><label for="sip_password">SIP Password:</label></td>
-        <td><input style="width:250px" id="sip_password" type="password" placeholder="SIP password"
-            value="slibra@#123456" /></td>
-      </tr>
-      <tr>
-        <td class="td_label" align="right"><label for="ws_uri">WSS URI:</label></td>
-        <td><input style="width:250px" id="ws_uri" class="last unset" type="text"
-            placeholder="WSS URI (i.e: wss://example.com)" value="wss://pbx.fuxicarbon.com:7443" /></td>
-      </tr>
-      <tr>
-        <td class="td_label" align="right"><label class="input_label" for="sip_phone_number">SIP Phone Info:</label>
-        </td>
-        <td><input style="width:250px" id="sip_phone_number" type="text"
-            placeholder="sip:13269511810@pbx.fuxicarbon.com" value="sip:13269511810@pbx.fuxicarbon.com"></td>
-      </tr>
-      <tr>
-        <td colspan="2" align="center"><button onclick="testStart()"> Initialize </button></td>
-      </tr>
-      <tr>
-        <td colspan="2" align="center"><button onclick="testCall()"> Call1 </button></td>
-      </tr>
-      <tr>
-        <td colspan="2" align="center"><button onclick="captureLocalMedia()"> Capture Local Media</button></td>
-      </tr>
-    </table>
-  </div>
-
-  <div
-    style="width: 424px; height: 324px;background-color: #333333; border: 2px solid blue; padding:0px; margin-top: 4px;">
-    <video id="localVideoView" width="420px" height="320px" autoplay></video>
+  <div>
+      <div id="log">登录</div>
+      <div>账号:<input type="text"></div>
+      <div>密码:<input type="text"></div>
+      <div><button>登录</button></div>
   </div>
-  <div
-    style="width: 424px; height: 324px;background-color: #333333; border: 2px solid blue; padding:0px; margin-top: 4px;">
-    <video id="remoteVideoView" width="420px" height="320px" autoplay></video>
-  </div>
-
+  <br>
+<div class="button-group">
+  <button>置忙</button>
+  <button>置闲</button>
+  <button>接听</button>
+</div>
 </body>
 <script type="text/javascript">
 const { Scene, getInstance, LoggerLevels } = window.HS_CTI