Code: Select all
calls = sys.CallsInProgress(sys.Username)
count = 0
calls.each do |c|
count += 1 if c.To =~ /@provider/
end
Code: Select all
calls = sys.CallsInProgress(sys.Username)
count = 0
calls.each do |c|
count += 1 if c.To =~ /@provider/
end
Code: Select all
sys.GetCurrentCalls().each { |call|
sys.Log("remote user field = " + call.RemoteUserField)
}
Code: Select all
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
If I use dbwrite to say it's in use, then how do I ever unlock it? Once it connects, doesn't the script stop running? Is there some code, e.g. rescue, in ruby that will allow it to continue executing even after a sip200 message? I'm no ruby expert...Aaron wrote:You could keep track of which calls you have in progress using the DBWrite and DBRead functions or just capture the failure response from the VSP.
Yes, rescue and ensure code blocks are executed even if the dial plan script is aborted because of successful sys.Dial or sys.Respond. Therefore, they can be used to "unlock" a resource. However, if SS server is rebooted or Ruby engine "recycled" due to memory leak there is a thick chance your ensure block won't be executed and the resource will remain locked.MikeTelis wrote:If I use dbwrite to say it's in use, then how do I ever unlock it? Once it connects, doesn't the script stop running? Is there some code, e.g. rescue, in ruby that will allow it to continue executing even after a sip200 message? I'm no ruby expert...