Skip to content
Browse files

DialCallDuration should be on ActiveCalls.

  • Loading branch information...
1 parent c6c7b2b commit 34f1550e7de1da62dbc833b2efa15912cdaad7bc Dag Liodden committed Jan 25, 2011
View
8 core/src/main/scala/scwilio/callback/callbackevents.scala
@@ -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 {
@@ -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)
)
}
}
@@ -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
)
}
}
View
6 core/src/test/scala/scwilio/callback/CallbackEventsSpec.scala
@@ -16,7 +16,8 @@ class CallbackEventsSpec extends Specification {
"Direction" -> "inbound",
"ForwardedFrom" -> "+14444",
"AnsweredBy" -> "human",
- "Digits" -> "555"
+ "Digits" -> "555",
+ "DialCallDuration" -> "1"
)
ActiveCall.parse(params) must_==
@@ -26,7 +27,8 @@ class CallbackEventsSpec extends Specification {
Ringing,
Some(Phonenumber("+14444")),
Some(Human),
- Some("555")
+ Some("555"),
+ Some(1)
)
}
}

0 comments on commit 34f1550

Please sign in to comment.
Something went wrong with that request. Please try again.