Javascript: record ringing of session
Hi, In Javascript, I do the following: var mSession = new Session("{ignore_early_media=true,originate_timeout=8}" + endpoint_url); mSession.execute("record_session", recordfile); This works very well, however, the client would like the rings to be recorded as well. I've tried using various channel variables, but 'new Session' only returns after the call is answered. I tried calling apiExecute("record", <file_path>); before 'new Session', but that returns an error. Is is possible to record the rings (in javascript)? And if so, how would I do that? Thanks, Birgit -- -- Birgit Arkesteijn, birgit@westhawk.co.uk, -- Westhawk Ltd, Albion Wharf, 19 Albion Street, Manchester M1 5LN, UK -- Company no: 1769350 -- Registered Office: -- 15 London Road, Stockton Heath, Warrington WA4 6SJ. UK. -- tel.: +44 (0)161 237 0660 -- <URL: http://www.westhawk.co.uk>
Birgit, I'm pretty sure that ringing is early media and you've got ignore_early_media set to true. If you can work without ignoring early media then you'll get rings. However, there's probably a reason you're ignoring early media so be sure to test thoroughly without ignoring early media just to make sure something else doesn't break. Actually I just noticed the call timeout you have. IIRC that does require you to ignore early media. Is there a way you can work without that call timeout? Let me know. Also, I might have an alternate solution but I can't give you more info until I get to my desk in an hour or so. -MC Sent from my iPhone On Nov 18, 2008, at 7:40 AM, Birgit Arkesteijn <birgit@westhawk.co.uk> wrote:
Hi,
In Javascript, I do the following:
var mSession = new Session("{ignore_early_media=true,originate_timeout=8}" + endpoint_url); mSession.execute("record_session", recordfile);
This works very well, however, the client would like the rings to be recorded as well.
I've tried using various channel variables, but 'new Session' only returns after the call is answered.
I tried calling apiExecute("record", <file_path>); before 'new Session', but that returns an error.
Is is possible to record the rings (in javascript)? And if so, how would I do that?
Thanks, Birgit
-- -- Birgit Arkesteijn, birgit@westhawk.co.uk, -- Westhawk Ltd, Albion Wharf, 19 Albion Street, Manchester M1 5LN, UK -- Company no: 1769350 -- Registered Office: -- 15 London Road, Stockton Heath, Warrington WA4 6SJ. UK. -- tel.: +44 (0)161 237 0660 -- <URL: http://www.westhawk.co.uk>
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Hi Michael, Thanks for your reply. I tried a variety of options: var mSession = new Session(endpoint_url); var mSession = new Session("{ignore_early_media=false}" + endpoint_url); both only return after the session is answered (originated?). The customer wants "the number of seconds we wait for each user to pick up" configurable, hence I use "originate_timeout". I noticed (by try and error) that this is the timeout that does the trick. The other timeout variables behaved differently. I'm currently trying to see how I can do recording of the rings. If that clashes with this neat "originate_timeout" variable, I'll have to see what my options are. I did read the http://wiki.freeswitch.org/wiki/Channel_Variables page, but to be honest, even with descriptions I don't really understand the implications of using these variables, sorry. Thanks, Birgit On 18/11/08 17:03, Michael S Collins wrote:
Birgit,
I'm pretty sure that ringing is early media and you've got ignore_early_media set to true. If you can work without ignoring early media then you'll get rings. However, there's probably a reason you're ignoring early media so be sure to test thoroughly without ignoring early media just to make sure something else doesn't break. Actually I just noticed the call timeout you have. IIRC that does require you to ignore early media. Is there a way you can work without that call timeout? Let me know. Also, I might have an alternate solution but I can't give you more info until I get to my desk in an hour or so.
-MC
Sent from my iPhone
On Nov 18, 2008, at 7:40 AM, Birgit Arkesteijn <birgit@westhawk.co.uk> wrote:
Hi,
In Javascript, I do the following:
var mSession = new Session("{ignore_early_media=true,originate_timeout=8}" + endpoint_url); mSession.execute("record_session", recordfile);
This works very well, however, the client would like the rings to be recorded as well.
I've tried using various channel variables, but 'new Session' only returns after the call is answered.
I tried calling apiExecute("record", <file_path>); before 'new Session', but that returns an error.
Is is possible to record the rings (in javascript)? And if so, how would I do that?
Thanks, Birgit
-- -- Birgit Arkesteijn, birgit@westhawk.co.uk, -- Westhawk Ltd, Albion Wharf, 19 Albion Street, Manchester M1 5LN, UK -- Company no: 1769350 -- Registered Office: -- 15 London Road, Stockton Heath, Warrington WA4 6SJ. UK. -- tel.: +44 (0)161 237 0660 -- <URL: http://www.westhawk.co.uk>
Birgit, I'm almost to my office. I will give you more info soon. I have not used js in this capacity so we will have to do some experimenting. -MC Sent from my iPhone On Nov 18, 2008, at 9:51 AM, Birgit Arkesteijn <birgit@westhawk.co.uk> wrote:
Hi Michael,
Thanks for your reply.
I tried a variety of options: var mSession = new Session(endpoint_url); var mSession = new Session("{ignore_early_media=false}" + endpoint_url);
both only return after the session is answered (originated?).
The customer wants "the number of seconds we wait for each user to pick up" configurable, hence I use "originate_timeout". I noticed (by try and error) that this is the timeout that does the trick. The other timeout variables behaved differently.
I'm currently trying to see how I can do recording of the rings. If that clashes with this neat "originate_timeout" variable, I'll have to see what my options are.
I did read the http://wiki.freeswitch.org/wiki/Channel_Variables page, but to be honest, even with descriptions I don't really understand the implications of using these variables, sorry.
Thanks, Birgit
On 18/11/08 17:03, Michael S Collins wrote:
Birgit,
I'm pretty sure that ringing is early media and you've got ignore_early_media set to true. If you can work without ignoring early media then you'll get rings. However, there's probably a reason you're ignoring early media so be sure to test thoroughly without ignoring early media just to make sure something else doesn't break. Actually I just noticed the call timeout you have. IIRC that does require you to ignore early media. Is there a way you can work without that call timeout? Let me know. Also, I might have an alternate solution but I can't give you more info until I get to my desk in an hour or so.
-MC
Sent from my iPhone
On Nov 18, 2008, at 7:40 AM, Birgit Arkesteijn <birgit@westhawk.co.uk> wrote:
Hi,
In Javascript, I do the following:
var mSession = new Session("{ignore_early_media=true,originate_timeout=8}" + endpoint_url); mSession.execute("record_session", recordfile);
This works very well, however, the client would like the rings to be recorded as well.
I've tried using various channel variables, but 'new Session' only returns after the call is answered.
I tried calling apiExecute("record", <file_path>); before 'new Session', but that returns an error.
Is is possible to record the rings (in javascript)? And if so, how would I do that?
Thanks, Birgit
-- -- Birgit Arkesteijn, birgit@westhawk.co.uk, -- Westhawk Ltd, Albion Wharf, 19 Albion Street, Manchester M1 5LN, UK -- Company no: 1769350 -- Registered Office: -- 15 London Road, Stockton Heath, Warrington WA4 6SJ. UK. -- tel.: +44 (0)161 237 0660 -- <URL: http://www.westhawk.co.uk>
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Hi Michael, Sorry to nag you, but did you manage to experiment with the Javascript session in this capacity? I hope you reached your office. :-) Cheers, Birgit On 18/11/08 18:10, Michael S Collins wrote:
Birgit,
I'm almost to my office. I will give you more info soon. I have not used js in this capacity so we will have to do some experimenting.
-MC
Sent from my iPhone
On Nov 18, 2008, at 9:51 AM, Birgit Arkesteijn <birgit@westhawk.co.uk> wrote:
Hi Michael,
Thanks for your reply.
I tried a variety of options: var mSession = new Session(endpoint_url); var mSession = new Session("{ignore_early_media=false}" + endpoint_url);
both only return after the session is answered (originated?).
The customer wants "the number of seconds we wait for each user to pick up" configurable, hence I use "originate_timeout". I noticed (by try and error) that this is the timeout that does the trick. The other timeout variables behaved differently.
I'm currently trying to see how I can do recording of the rings. If that clashes with this neat "originate_timeout" variable, I'll have to see what my options are.
I did read the http://wiki.freeswitch.org/wiki/Channel_Variables page, but to be honest, even with descriptions I don't really understand the implications of using these variables, sorry.
Thanks, Birgit
-- -- Birgit Arkesteijn, birgit@westhawk.co.uk, -- Westhawk Ltd, Albion Wharf, 19 Albion Street, Manchester M1 5LN, UK -- Company no: 1769350 -- Registered Office: -- 15 London Road, Stockton Heath, Warrington WA4 6SJ. UK. -- tel.: +44 (0)161 237 0660 -- <URL: http://www.westhawk.co.uk>
On Thu, Nov 20, 2008 at 1:50 AM, Birgit Arkesteijn <birgit@westhawk.co.uk> wrote:
Hi Michael,
Sorry to nag you, but did you manage to experiment with the Javascript session in this capacity? I hope you reached your office. :-)
Cheers, Birgit
Sorry, day job was rough yesterday and I didn't get a chance to tinker. Hopefully later today I will. I'm GMT -0800 so it will probably be pretty late your time before I start playing with this, though if you check the lists tonight I should have something to report. Thanks, MC
On Thu, Nov 20, 2008 at 1:50 AM, Birgit Arkesteijn <birgit@westhawk.co.uk> wrote:
Hi Michael,
Sorry to nag you, but did you manage to experiment with the Javascript session in this capacity? I hope you reached your office. :-)
Cheers, Birgit
Birgit, After reviewing my dialplan I realize now that what I'm doing won't work for the scenario you've got, specifically because I am never dialing multiple endpoints. I'm going to ruminate on this for a little while and see what I can think of. I'm sure there's a way to do it. "If FreeSWITCH can't do it, nothing can!" :) -MC
Hi Michael, Thanks for your effort and feedback. I dial multiple endpoints, but I dial them sequentially, i.e. I will only dial the next merchant, when the previous one hangs up. In this scenario, each "task" always only involves two channels: one consumer and one merchant. One potential complication is that after the merchant picks up, I'll transfer (bridge?) him/her to a conference call where the consumer is waiting. I would like the recording to continue after this bridging. "Long live FreeSWITCH!" ;-) Cheers, Birgit On 21/11/08 01:05, Michael Collins wrote:
Birgit,
After reviewing my dialplan I realize now that what I'm doing won't work for the scenario you've got, specifically because I am never dialing multiple endpoints. I'm going to ruminate on this for a little while and see what I can think of. I'm sure there's a way to do it. "If FreeSWITCH can't do it, nothing can!" :)
-MC
-- -- Birgit Arkesteijn, birgit@westhawk.co.uk, -- Westhawk Ltd, Albion Wharf, 19 Albion Street, Manchester M1 5LN, UK -- Company no: 1769350 -- Registered Office: -- 15 London Road, Stockton Heath, Warrington WA4 6SJ. UK. -- tel.: +44 (0)161 237 0660 -- <URL: http://www.westhawk.co.uk>
Hi Michael, Sorry to nag you again. I'm getting close to my deadline and I would like to give our customer some feedback on this issue. Would you be so kind to explain what the issue is with recording rings when doing 'new Session(originate_url)'? As far as I've been able to work out, this statement will only return after a) the (or some) timeout has expired or b) the user has picked up Only in case b) we've got a originated session, that can be used to record. However, since the user has already answered, the rings are not recorded. Is that right? Cheers, Birgit On 24/11/08 11:11, Birgit Arkesteijn wrote:
Hi Michael,
Thanks for your effort and feedback.
I dial multiple endpoints, but I dial them sequentially, i.e. I will only dial the next merchant, when the previous one hangs up. In this scenario, each "task" always only involves two channels: one consumer and one merchant.
One potential complication is that after the merchant picks up, I'll transfer (bridge?) him/her to a conference call where the consumer is waiting. I would like the recording to continue after this bridging.
"Long live FreeSWITCH!" ;-)
Cheers, Birgit
On 21/11/08 01:05, Michael Collins wrote:
Birgit,
After reviewing my dialplan I realize now that what I'm doing won't work for the scenario you've got, specifically because I am never dialing multiple endpoints. I'm going to ruminate on this for a little while and see what I can think of. I'm sure there's a way to do it. "If FreeSWITCH can't do it, nothing can!" :)
-MC
-- -- Birgit Arkesteijn, birgit@westhawk.co.uk, -- Westhawk Ltd, Albion Wharf, 19 Albion Street, Manchester M1 5LN, UK -- Company no: 1769350 -- Registered Office: -- 15 London Road, Stockton Heath, Warrington WA4 6SJ. UK. -- tel.: +44 (0)161 237 0660 -- <URL: http://www.westhawk.co.uk>
The originate method does not return until either early media or answer has been received. in other words the very instant it returns is the soonest there is even any media to record. you can execute record_session app on the A leg before you call and that's the best you can do. session.execute("record_session"); session.execute("bridge", LIST_OF_DESTINATIONS); if you are not doing much else in your script it may be better to set the dest as a variable then exit your script and execute bridge from the regular dialplan to avoid extra JS overhead during the call. On Tue, Nov 25, 2008 at 8:03 AM, Birgit Arkesteijn <birgit@westhawk.co.uk>wrote:
Hi Michael,
Sorry to nag you again. I'm getting close to my deadline and I would like to give our customer some feedback on this issue.
Would you be so kind to explain what the issue is with recording rings when doing 'new Session(originate_url)'?
As far as I've been able to work out, this statement will only return after a) the (or some) timeout has expired or b) the user has picked up
Only in case b) we've got a originated session, that can be used to record. However, since the user has already answered, the rings are not recorded.
Is that right?
Cheers, Birgit
On 24/11/08 11:11, Birgit Arkesteijn wrote:
Hi Michael,
Thanks for your effort and feedback.
I dial multiple endpoints, but I dial them sequentially, i.e. I will only dial the next merchant, when the previous one hangs up. In this scenario, each "task" always only involves two channels: one consumer and one merchant.
One potential complication is that after the merchant picks up, I'll transfer (bridge?) him/her to a conference call where the consumer is waiting. I would like the recording to continue after this bridging.
"Long live FreeSWITCH!" ;-)
Cheers, Birgit
On 21/11/08 01:05, Michael Collins wrote:
Birgit,
After reviewing my dialplan I realize now that what I'm doing won't work for the scenario you've got, specifically because I am never dialing multiple endpoints. I'm going to ruminate on this for a little while and see what I can think of. I'm sure there's a way to do it. "If FreeSWITCH can't do it, nothing can!" :)
-MC
-- -- Birgit Arkesteijn, birgit@westhawk.co.uk, -- Westhawk Ltd, Albion Wharf, 19 Albion Street, Manchester M1 5LN, UK -- Company no: 1769350 -- Registered Office: -- 15 London Road, Stockton Heath, Warrington WA4 6SJ. UK. -- tel.: +44 (0)161 237 0660 -- <URL: http://www.westhawk.co.uk>
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
Hi Anthony, Thanks for your feedback. I still cannot get it to work, maybe the snippet and the output will give you an idea? *** I've got the following javascript: var endpoint_url = 'sofia/gateway/westhawk/0663'; var recordfile = "/usr/local/freeswitch/recordings/dispatcher.wav"; setGlobalVariable("RECORD_ANSWER_REQ", false); var mSession = new Session("{ignore_early_media=false}" + endpoint_url); console_log("info", "mSession created, start recording\n"); mSession.execute("record_session", recordfile); *** When I run it: freeswitch@apso> jsrun record_rings.js API CALL [jsrun(record_rings.js)] output: OK freeswitch@apso> 2008-11-25 14:22:10 [NOTICE] switch_channel.c:551 switch_channel_set_name() New Channel sofia/external/0663 [7225b30a-bafc-11dd-be4c-05a0d8dd6ae1] 2008-11-25 14:22:10 [NOTICE] sofia.c:2327 sofia_handle_sip_i_state() Ring-Ready sofia/external/0663! 2008-11-25 14:22:22 [NOTICE] sofia.c:2723 sofia_handle_sip_i_state() Channel [sofia/external/0663] has been answered 2008-11-25 14:22:22 [INFO] record_rings.js:1 console_log() mSession created, start recording 2008-11-25 14:22:22 [NOTICE] mod_spidermonkey.c:2959 session_destroy() Hangup sofia/external/0663 [CS_SOFT_EXECUTE] [NORMAL_CLEARING] 2008-11-25 14:22:22 [NOTICE] switch_core_session.c:927 switch_core_session_thread() Session 3 (sofia/external/0663) Ended 2008-11-25 14:22:22 [NOTICE] switch_core_session.c:929 switch_core_session_thread() Close Channel sofia/external/0663 [CS_HANGUP] As you can see, 'new Session' does not return on the 'ring ready' and therefore doesn't record the rings to/on this new channel (that is mSession). Having said that, I don't know if 'ring ready' qualifies as 'early media'. Cheers, Birgit On 25/11/08 14:13, Anthony Minessale wrote:
The originate method does not return until either early media or answer has been received. in other words the very instant it returns is the soonest there is even any media to record.
you can execute record_session app on the A leg before you call and that's the best you can do.
session.execute("record_session"); session.execute("bridge", LIST_OF_DESTINATIONS);
if you are not doing much else in your script it may be better to set the dest as a variable then exit your script and execute bridge from the regular dialplan to avoid extra JS overhead during the call.
On Tue, Nov 25, 2008 at 8:03 AM, Birgit Arkesteijn <birgit@westhawk.co.uk <mailto:birgit@westhawk.co.uk>> wrote:
Hi Michael,
Sorry to nag you again. I'm getting close to my deadline and I would like to give our customer some feedback on this issue.
Would you be so kind to explain what the issue is with recording rings when doing 'new Session(originate_url)'?
As far as I've been able to work out, this statement will only return after a) the (or some) timeout has expired or b) the user has picked up
Only in case b) we've got a originated session, that can be used to record. However, since the user has already answered, the rings are not recorded.
Is that right?
Cheers, Birgit
-- -- Birgit Arkesteijn, birgit@westhawk.co.uk, -- Westhawk Ltd, Albion Wharf, 19 Albion Street, Manchester M1 5LN, UK -- Company no: 1769350 -- Registered Office: -- 15 London Road, Stockton Heath, Warrington WA4 6SJ. UK. -- tel.: +44 (0)161 237 0660 -- <URL: http://www.westhawk.co.uk>
ring_ready does not have audio so there is nothing to record. ring_ready is a 180 ringing which is just a packet telling your phone to play a ringing sound on your end. Remember what i said? originate returns the exact instant there is any audio. On Tue, Nov 25, 2008 at 8:29 AM, Birgit Arkesteijn <birgit@westhawk.co.uk>wrote:
Hi Anthony,
Thanks for your feedback. I still cannot get it to work, maybe the snippet and the output will give you an idea?
*** I've got the following javascript:
var endpoint_url = 'sofia/gateway/westhawk/0663'; var recordfile = "/usr/local/freeswitch/recordings/dispatcher.wav";
setGlobalVariable("RECORD_ANSWER_REQ", false); var mSession = new Session("{ignore_early_media=false}" + endpoint_url); console_log("info", "mSession created, start recording\n");
mSession.execute("record_session", recordfile);
*** When I run it: freeswitch@apso> jsrun record_rings.js API CALL [jsrun(record_rings.js)] output: OK
freeswitch@apso> 2008-11-25 14:22:10 [NOTICE] switch_channel.c:551 switch_channel_set_name() New Channel sofia/external/0663 [7225b30a-bafc-11dd-be4c-05a0d8dd6ae1] 2008-11-25 14:22:10 [NOTICE] sofia.c:2327 sofia_handle_sip_i_state() Ring-Ready sofia/external/0663! 2008-11-25 14:22:22 [NOTICE] sofia.c:2723 sofia_handle_sip_i_state() Channel [sofia/external/0663] has been answered 2008-11-25 14:22:22 [INFO] record_rings.js:1 console_log() mSession created, start recording 2008-11-25 14:22:22 [NOTICE] mod_spidermonkey.c:2959 session_destroy() Hangup sofia/external/0663 [CS_SOFT_EXECUTE] [NORMAL_CLEARING] 2008-11-25 14:22:22 [NOTICE] switch_core_session.c:927 switch_core_session_thread() Session 3 (sofia/external/0663) Ended 2008-11-25 14:22:22 [NOTICE] switch_core_session.c:929 switch_core_session_thread() Close Channel sofia/external/0663 [CS_HANGUP]
As you can see, 'new Session' does not return on the 'ring ready' and therefore doesn't record the rings to/on this new channel (that is mSession). Having said that, I don't know if 'ring ready' qualifies as 'early media'.
Cheers, Birgit
On 25/11/08 14:13, Anthony Minessale wrote:
The originate method does not return until either early media or answer has been received. in other words the very instant it returns is the soonest there is even any media to record.
you can execute record_session app on the A leg before you call and that's the best you can do.
session.execute("record_session"); session.execute("bridge", LIST_OF_DESTINATIONS);
if you are not doing much else in your script it may be better to set the dest as a variable then exit your script and execute bridge from the regular dialplan to avoid extra JS overhead during the call.
On Tue, Nov 25, 2008 at 8:03 AM, Birgit Arkesteijn <birgit@westhawk.co.uk <mailto:birgit@westhawk.co.uk>> wrote:
Hi Michael,
Sorry to nag you again. I'm getting close to my deadline and I would like to give our customer some feedback on this issue.
Would you be so kind to explain what the issue is with recording rings when doing 'new Session(originate_url)'?
As far as I've been able to work out, this statement will only return after a) the (or some) timeout has expired or b) the user has picked up
Only in case b) we've got a originated session, that can be used to record. However, since the user has already answered, the rings are not recorded.
Is that right?
Cheers, Birgit
-- -- Birgit Arkesteijn, birgit@westhawk.co.uk, -- Westhawk Ltd, Albion Wharf, 19 Albion Street, Manchester M1 5LN, UK -- Company no: 1769350 -- Registered Office: -- 15 London Road, Stockton Heath, Warrington WA4 6SJ. UK. -- tel.: +44 (0)161 237 0660 -- <URL: http://www.westhawk.co.uk>
_______________________________________________ Freeswitch-users mailing list Freeswitch-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
participants (4)
-
Anthony Minessale
-
Birgit Arkesteijn
-
Michael Collins
-
Michael S Collins