fix(LinphoneUtils): check correctly sip address string in getContactUsername

This commit is contained in:
Ronan Abhamon 2017-06-27 09:37:20 +02:00
parent 8a6afd79d6
commit fa149d22af

View file

@ -17,7 +17,10 @@ function getContactUsername (contact) {
return object.vcard.username
}
object = contact.sipAddress || contact // String from `SipAddressObserver` or just a String.
object = Utils.isString(contact.sipAddress)
? contact.sipAddress // String from `SipAddressObserver`.
: contact // Just a String.
var index = object.indexOf('@')
return object.substring(4, index !== -1 ? index : undefined) // 4 = length('sip:')
}