"Call ended" Ruby script

New features you'd like see on SIP Sorcery
Post Reply
MikeTelis
Posts: 1582
Joined: Wed Jul 30, 2008 6:48 am

"Call ended" Ruby script

Post by MikeTelis » Sat Jul 24, 2010 3:15 pm

Dear Aaron,

It would be nice if you invoked a script upon the end of a call (incoming and outgoing). Currently you have two dialplans assigned to every SIP account: "In" and "Out". I'm suggesting yet another script, "Call ended".

Ideally, I'd like to get the call direction in sys.In / sys.Out and other details in req.Header and req.User, as it was at the time the call was established. If it's not possible, it would be enough to get some call-id, I'd save whatever parameters I need using Marshal.dump / DBWrite and restored them later with DBRead / Marshal.load.

Sincerely,

Mike

AviMarcus
Posts: 153
Joined: Sun May 16, 2010 7:07 am

Re: "Call ended" Ruby script

Post by AviMarcus » Sat Jul 24, 2010 6:08 pm

What is Marshal.dump ?

And if you want the connection data, the bridgeID gives you access to the incoming & outgoing account info, call length, ring time, etc. Well, through the REST api, at least.
Help document SIP Sorcery on the wiki!
If you solved an issue you were having or figured out how to do something, please share on the wiki! It will save everyone lots of time and frustration.

MikeTelis
Posts: 1582
Joined: Wed Jul 30, 2008 6:48 am

Re: "Call ended" Ruby script

Post by MikeTelis » Sat Jul 24, 2010 6:25 pm

Look for the Marshal module description on the net. Note that _load and _dump hook methods have been replaced with marshal_dump and marshal_load (starting from Ruby 1.8, if I'm not wrong).

I know of several methods of retrieving of the call-id (guess that yours works only if called from ensure or rescue because call-id doesn't exist when you initiate the call with sys.Dial). Anyway, I need something I could use to identify the call which has just ended and if Aaron's willing to implement all this, he'll need to document the way of doing it.

Post Reply