Skip to content

Commit

Permalink
DialCallDuration should be on ActiveCalls.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dag Liodden committed Jan 25, 2011
1 parent c6c7b2b commit 34f1550
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 5 additions & 3 deletions core/src/main/scala/scwilio/callback/callbackevents.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ case class ActiveCall(
status: ActiveCallStatus,
forwardedFrom: Option[Phonenumber],
answeredBy: Option[AnsweredBy],
digits: Option[String]
digits: Option[String],
duration: Option[Int]
) extends Call with CallbackEvent

object ActiveCall {
Expand All @@ -56,7 +57,8 @@ object ActiveCall {
case Some(s) => Some(Unknown(s))
case None => None
},
p.get("Digits")
p.get("Digits"),
p.get("DialCallDuration").map(_.toInt)
)
}
}
Expand Down Expand Up @@ -93,7 +95,7 @@ object CompletedCall {
case Some(s) => Some(Unknown(s))
case None => None
},
p.get("CallDuration").getOrElse(p.get("DialCallDuration").getOrElse("0")).toInt
p.get("CallDuration").getOrElse("0").toInt
)
}
}
Expand Down
6 changes: 4 additions & 2 deletions core/src/test/scala/scwilio/callback/CallbackEventsSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class CallbackEventsSpec extends Specification {
"Direction" -> "inbound",
"ForwardedFrom" -> "+14444",
"AnsweredBy" -> "human",
"Digits" -> "555"
"Digits" -> "555",
"DialCallDuration" -> "1"
)

ActiveCall.parse(params) must_==
Expand All @@ -26,7 +27,8 @@ class CallbackEventsSpec extends Specification {
Ringing,
Some(Phonenumber("+14444")),
Some(Human),
Some("555")
Some("555"),
Some(1)
)
}
}
Expand Down

0 comments on commit 34f1550

Please sign in to comment.