stephenlb / webrtc-sdk

WebRTC Simple Calling API + Mobile SDK - A simplified approach to RTCPeerConnection for mobile and web video calling apps.
https://stephenlb.github.io/webrtc-sdk/
MIT License
855 stars 278 forks source link

Static phone number #43

Closed lekarinfo closed 6 years ago

lekarinfo commented 6 years ago

is it possible to have only one (static) phone number? So anyone who wanna use video chat can chose only one phone number. Every time page loads there is different number so where in code is possibility to make it static. Thank you for answer.

stephenlb commented 6 years ago

Yes! You are correct. You can pick the static phone number. You can either set one per user, or you can use localStorage.

lekarinfo commented 6 years ago

Thank you for your answer. Can you tell me where in code i need to set up static phone number?

stephenlb commented 6 years ago

Static Number Example

// create static number
let number = localStorage.getItem('static-number') || (''+Math.random()).split('.').join('');
localStorage.setItem( 'static-number', number );

var phone = PHONE({
    number        : number,
    publish_key   : 'pub-c-561a7378-fa06-4c50-a331-5c0056d0163c',
    subscribe_key : 'sub-c-17b7db8a-3915-11e4-9868-02ee2ddab7fe',
    ssl           : true
});