CallsInProgress

From sipsorcery

Jump to: navigation, search

sys.CallsInProgress allows you to see and process based on the current call data.

This can be useful in cases, such as:

  • A provider of an unlimited trunk only allows one concurrent outgoing call for that fixed rate

The list of attributes are the following:

  • Id
  • Owner - your account name
  • AdminMemberId
  • LocalTag
  • RemoteTag
  • LocalUserField - your SIP username and server for the current call
  • RemoteUserField
  • CallId
  • CSeq
  • BridgeId
  • RemoteTarget
  • RouteSet
  • CDRId
  • CallDurationLimit - how long until the server hangs up the call. 0 means disabled. See "cd" in Dial
  • Inserted - call start time, in "dd MMM yyyy HH:mm:ss zz" format. e.g. 7/4/2010 1:20:19 AM +00:00
  • Direction - In or Out.
  • SDP - information from the UA - codec preferences, etc.
  • RemoteSDP - information from the server - codec preferences, etc.
  • TransferMode - See "tr" in Dial


Each individual piece of information can be accessed as such:

sys.GetCurrentCalls().each { |call|
 sys.Log("remote user field = " + call.RemoteUserField)
 }


If you would like a dump of all the available information, try this code written by MikeTelis:

Attributes = %w{
Id
Owner
AdminMemberId
LocalTag
RemoteTag
LocalUserField
RemoteUserField
CallId
CSeq
BridgeId
RemoteTarget
RouteSet
CDRId
CallDurationLimit
Inserted
Direction
SDP
RemoteSDP
TransferMode
}

def callsInProgress()
 str = 
 
 sys.GetCurrentCalls().each_with_index do |c,i|
   str << "\n*** call \# #{i} ***\n\n"
   Attributes.each { |f| str << ("#{f} = #{c.send(f)}\n") }
 end
 
 sys.Log(str)
end
Personal tools