Skip to content

Commit

Permalink
SipHandler: Fix Security-Client value
Browse files Browse the repository at this point in the history
If we don't tell the server we accept hmac-md5-96 the tunnel won't be
setup with it

Fixes: #13
  • Loading branch information
martinetd authored and phhusson committed Jul 7, 2023
1 parent 96c8d99 commit f5477f3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/src/main/java/me/phh/sip/SipHandler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,13 @@ class SipHandler(val ctxt: Context) {

val writer = _writer ?: socket.writer

fun secClient(ealg: String, alg: String) =
fun secClient(alg: String, ealg: String) =
"ipsec-3gpp;prot=esp;mod=trans;spi-c=${clientSpiC.spi};spi-s=${clientSpiS.spi};port-c=${socket.localPort};port-s=${serverSocket.localPort};ealg=${ealg};alg=${alg}"
val algs = listOf("hmac-sha-1-96", "hmac-md5-96")
val ealgs = listOf("null", "aes-cbc")
val secClients = algs.flatMap { alg -> ealgs.map { ealg -> secClient(alg, ealg) }}
val secClientLine =
"Security-Client: ${secClient("null", "hmac-sha-1-96")}, ${secClient("aes-cbc", "hmac-sha-1-96")}"
"Security-Client: ${secClients.joinToString(", ")}"

val msg =
SipRequest(
Expand Down

0 comments on commit f5477f3

Please sign in to comment.