Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[Freeswitch-users] Problems with Originate


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users
View previous topic :: View next topic  
Author Message
alex at sinapticode.ro
Guest





PostPosted: Fri Feb 13, 2009 6:51 am    Post subject: [Freeswitch-users] Problems with Originate Reply with quote

On Fri, 2009-02-13 at 13:33 +0200, Alexandru Nedelcu wrote:
Quote:
The problem with this setup is that origination_caller_id_number doesn't
work from inside the JS file (when calling session.originate).

I just discovered something interesting.

When originating the call like this ...
session = new Session("<connection_string>")
instead of this ...
session = new Session(); session.originate("<connection_string>")

... then it works. Is this some kind of bug, or what's the difference
here?

Thanks,

--
Alexandru Nedelcu
Software Developer, Sinapticode



_______________________________________________
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
Back to top
nik.middleton at noble...
Guest





PostPosted: Fri Feb 13, 2009 6:51 am    Post subject: [Freeswitch-users] Problems with Originate Reply with quote

Use this method in js

var session = new
Session('{absolute_codec_string=PCMA,accountcode=54321,ignore_early_medi
a=true,origination_caller_id_number=40711222222,originate_timeout=25}sof
ia/gateway/myprovider/873040711222222);

-----Original Message-----
From: freeswitch-users-bounces@lists.freeswitch.org
[mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of
Alexandru Nedelcu
Sent: 13 February 2009 11:33
To: freeswitch-users@lists.freeswitch.org
Subject: [Freeswitch-users] Problems with Originate

Hi all,

I'm using "originate" to initiate calls, and streamFile to play audio
files on the answered sessions. All the logic was encapsulated in a
Javascript file.

The problem with this setup is that origination_caller_id_number doesn't
work from inside the JS file (when calling session.originate). My setup
only works when doing a direct originate command, with the JS script
attached as an application to it, i.e...

originate
{ignore_early_media=true}sofia/gateway/myprovider/873040711222222
'&javascript(dialer.js <params>)'

Now, my next problem ... this doesn't work properly because with
"ignore_early_media=true" then "dialer.js" isn't executed on FAIL. And I
need that. If "ignore_early_media" is not specified, then "dialer.js"
executes, but the recording starts before the phone is answered.

Can you give me any tips?

Thanks,

--
Alexandru Nedelcu
Software Developer, Sinapticode


_______________________________________________
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

_______________________________________________
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
Back to top
anthony.minessale at g...
Guest





PostPosted: Fri Feb 13, 2009 9:02 am    Post subject: [Freeswitch-users] Problems with Originate Reply with quote

The first way is deprecated and will be removed.
The 2nd way is the correct way.


On Fri, Feb 13, 2009 at 5:48 AM, Alexandru Nedelcu <alex@sinapticode.ro (alex@sinapticode.ro)> wrote:
Quote:
On Fri, 2009-02-13 at 13:33 +0200, Alexandru Nedelcu wrote:
Quote:
The problem with this setup is that origination_caller_id_number doesn't
work from inside the JS file (when calling session.originate).


I just discovered something interesting.

When originating the call like this ...
session = new Session("<connection_string>")
instead of this ...
session = new Session(); session.originate("<connection_string>")

... then it works. Is this some kind of bug, or what's the difference
here?


Thanks,

--
Alexandru Nedelcu
Software Developer, Sinapticode



_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (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 ([email]MSN%3Aanthony_minessale@hotmail.com[/email])
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com ([email]PAYPAL%3Aanthony.minessale@gmail.com[/email])
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org ([email]sip%3A888@conference.freeswitch.org[/email])
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org ([email]googletalk%3Aconf%2B888@conference.freeswitch.org[/email])
pstn:213-799-1400
Back to top
nik.middleton at noble...
Guest





PostPosted: Sat Feb 14, 2009 8:19 am    Post subject: [Freeswitch-users] Problems with Originate Reply with quote

Understood.

However, using the second method, how can I trap on call failure?

If I originate a call and the user is busy, the console reports this fact, but then the script continues to execute

if (session.ready()) {
console_log("notice","Session result=[" + session.cause + "] \n");
if (session.cause == "USER_BUSY") {
Disposition = "BUSY";
session.Hangup();
}
In this case session.cause reports ‘NONE’ and what’s surprising is that even though the call failed (busy) session.ready returns a true value.

From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Anthony Minessale
Sent: 13 February 2009 13:55
To: freeswitch-users@lists.freeswitch.org
Subject: Re: [Freeswitch-users] Problems with Originate


The first way is deprecated and will be removed.
The 2nd way is the correct way.


On Fri, Feb 13, 2009 at 5:48 AM, Alexandru Nedelcu <alex@sinapticode.ro (alex@sinapticode.ro)> wrote:
On Fri, 2009-02-13 at 13:33 +0200, Alexandru Nedelcu wrote:
Quote:
The problem with this setup is that origination_caller_id_number doesn't
work from inside the JS file (when calling session.originate).

I just discovered something interesting.

When originating the call like this ...
session = new Session("<connection_string>")
instead of this ...
session = new Session(); session.originate("<connection_string>")

... then it works. Is this some kind of bug, or what's the difference
here?

Thanks,

--
Alexandru Nedelcu
Software Developer, Sinapticode



_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (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 ([email]MSN%3Aanthony_minessale@hotmail.com[/email])
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com ([email]PAYPAL%3Aanthony.minessale@gmail.com[/email])
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org ([email]sip%3A888@conference.freeswitch.org[/email])
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org ([email]googletalk%3Aconf%2B888@conference.freeswitch.org[/email])
pstn:213-799-1400
Back to top
anthony.minessale at g...
Guest





PostPosted: Sat Feb 14, 2009 12:22 pm    Post subject: [Freeswitch-users] Problems with Originate Reply with quote

are you running this as a dialplan app?
session is a reserved variable name for the session you executed the app on.

are you using an alternate name for your new session like my_session etc....?

this works for me, try it yourself.

var my_session = new Session("sofia/external/7003@conference.freeswitch.org (7003@conference.freeswitch.org)");
consoleLog("err", "ready: " + my_session.ready() + "\n");




On Sat, Feb 14, 2009 at 7:17 AM, Nik Middleton <nik.middleton@noblesolutions.co.uk (nik.middleton@noblesolutions.co.uk)> wrote:
Quote:

Understood.

However, using the second method, how can I trap on call failure?

If I originate a call and the user is busy, the console reports this fact, but then the script continues to execute

if (session.ready()) {
console_log("notice","Session result=[" + session.cause + "] \n");
if (session.cause == "USER_BUSY") {
Disposition = "BUSY";
session.Hangup();
}
In this case session.cause reports 'NONE' and what's surprising is that even though the call failed (busy) session.ready returns a true value.

From: freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org) [mailto:freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org)] On Behalf Of Anthony Minessale
Sent: 13 February 2009 13:55
To: freeswitch-users@lists.freeswitch.org (freeswitch-users@lists.freeswitch.org)

Subject: Re: [Freeswitch-users] Problems with Originate



The first way is deprecated and will be removed.
The 2nd way is the correct way.


On Fri, Feb 13, 2009 at 5:48 AM, Alexandru Nedelcu <alex@sinapticode.ro (alex@sinapticode.ro)> wrote:
On Fri, 2009-02-13 at 13:33 +0200, Alexandru Nedelcu wrote:
Quote:
The problem with this setup is that origination_caller_id_number doesn't
work from inside the JS file (when calling session.originate).

I just discovered something interesting.

When originating the call like this ...
session = new Session("<connection_string>")
instead of this ...
session = new Session(); session.originate("<connection_string>")

... then it works. Is this some kind of bug, or what's the difference
here?

Thanks,

--
Alexandru Nedelcu
Software Developer, Sinapticode



_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (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 ([email]MSN%3Aanthony_minessale@hotmail.com[/email])
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com ([email]PAYPAL%3Aanthony.minessale@gmail.com[/email])
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org ([email]sip%3A888@conference.freeswitch.org[/email])
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org ([email]googletalk%3Aconf%2B888@conference.freeswitch.org[/email])
pstn:213-799-1400




_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (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 ([email]MSN%3Aanthony_minessale@hotmail.com[/email])
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com ([email]PAYPAL%3Aanthony.minessale@gmail.com[/email])
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org ([email]sip%3A888@conference.freeswitch.org[/email])
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org ([email]googletalk%3Aconf%2B888@conference.freeswitch.org[/email])
pstn:213-799-1400
Back to top
nik.middleton at noble...
Guest





PostPosted: Sat Feb 14, 2009 2:51 pm    Post subject: [Freeswitch-users] Problems with Originate Reply with quote

Nope,

Still not working. Here’s my little test javascript

var new_session = new Session('{ignore_early_media=true,}sofia/internal/1001@192.168.3.206');

//set the on_hangup function to be called when this session is hungup
new_session.setHangupHook(on_hangup,"hup");

var on_hangup = function(hup_session, how) {
console_log("err","In hangup section\n");
//exit here would end the script so you could cleanup and just be done
exit();
}


if (new_session.ready()) {
new_session.answer( );
new_session.sleep(1500);
new_session.streamFile("female2.wav");
}

And this is the output

[NOTICE] sofia.c:3090 sofia_handle_sip_i_state() Hangup sofia/internal/sip:1001@192.168.0.29:5060 [CS_CONSUME_MEDIA] [USER_BUSY]
[ERR] switch_ivr_originate.c:1116 switch_ivr_originate() Cannot create outgoing channel of type [user] cause: [USER_BUSY]
[INFO] mod_dptools.c:1909 audio_bridge_function() Originate Failed. Cause: USER_BUSY
[NOTICE] switch_core_session.c:957 switch_core_session_thread() Session 95 (sofia/internal/sip:1001@192.168.0.29:5060) Ended
[NOTICE] switch_core_session.c:959 switch_core_session_thread() Close Channel sofia/internal/sip:1001@192.168.0.29:5060 [CS_HANGUP]
[NOTICE] mod_dptools.c:600 answer_function() Channel [sofia/internal/0000000000@192.168.3.206] has been answered


From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Anthony Minessale
Sent: 14 February 2009 17:20
To: freeswitch-users@lists.freeswitch.org
Subject: Re: [Freeswitch-users] Problems with Originate


are you running this as a dialplan app?
session is a reserved variable name for the session you executed the app on.

are you using an alternate name for your new session like my_session etc....?

this works for me, try it yourself.

var my_session = new Session("sofia/external/7003@conference.freeswitch.org (7003@conference.freeswitch.org)");
consoleLog("err", "ready: " + my_session.ready() + "\n");




On Sat, Feb 14, 2009 at 7:17 AM, Nik Middleton <nik.middleton@noblesolutions.co.uk (nik.middleton@noblesolutions.co.uk)> wrote:
Understood.

However, using the second method, how can I trap on call failure?

If I originate a call and the user is busy, the console reports this fact, but then the script continues to execute

if (session.ready()) {
console_log("notice","Session result=[" + session.cause + "] \n");
if (session.cause == "USER_BUSY") {
Disposition = "BUSY";
session.Hangup();
}
In this case session.cause reports 'NONE' and what's surprising is that even though the call failed (busy) session.ready returns a true value.

From: freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org) [mailto:freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org)] On Behalf Of Anthony Minessale
Sent: 13 February 2009 13:55

To: freeswitch-users@lists.freeswitch.org (freeswitch-users@lists.freeswitch.org)

Subject: Re: [Freeswitch-users] Problems with Originate


The first way is deprecated and will be removed.
The 2nd way is the correct way.
On Fri, Feb 13, 2009 at 5:48 AM, Alexandru Nedelcu <alex@sinapticode.ro (alex@sinapticode.ro)> wrote:
On Fri, 2009-02-13 at 13:33 +0200, Alexandru Nedelcu wrote:
Quote:
The problem with this setup is that origination_caller_id_number doesn't
work from inside the JS file (when calling session.originate).

I just discovered something interesting.

When originating the call like this ...
session = new Session("<connection_string>")
instead of this ...
session = new Session(); session.originate("<connection_string>")

... then it works. Is this some kind of bug, or what's the difference
here?

Thanks,

--
Alexandru Nedelcu
Software Developer, Sinapticode



_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (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 ([email]MSN%3Aanthony_minessale@hotmail.com[/email])
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com ([email]PAYPAL%3Aanthony.minessale@gmail.com[/email])
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org ([email]sip%3A888@conference.freeswitch.org[/email])
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org ([email]googletalk%3Aconf%2B888@conference.freeswitch.org[/email])
pstn:213-799-1400





_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (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 ([email]MSN%3Aanthony_minessale@hotmail.com[/email])
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com ([email]PAYPAL%3Aanthony.minessale@gmail.com[/email])
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org ([email]sip%3A888@conference.freeswitch.org[/email])
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org ([email]googletalk%3Aconf%2B888@conference.freeswitch.org[/email])
pstn:213-799-1400
Back to top
anthony.minessale at g...
Guest





PostPosted: Sat Feb 14, 2009 5:47 pm    Post subject: [Freeswitch-users] Problems with Originate Reply with quote

What do you suggest is not working?

the call failed and it *did not* run the code inside if (new_session.ready())
The call was never established therefore it would not run the hangup hook either.
In order to trigger the hangup hook the session would need to exist. If the session could not originate the new_session obj
is an empty shell with no actual session inside.

var new_session = new Session(<dial string>, <existing session>);
if (!new_session.ready()) {
// the call never was established.
}

I gave you real code to try in my last email that you completely ignored.....


and finally you are declaring the function wrong

declare it at the top.

function on_hangup(hup_session, how)
{
.....
}

I sense you seem to think things are going to magically transform into however you are thinking they should work
instead of you perhaps learning how they actually work.



On Sat, Feb 14, 2009 at 1:47 PM, Nik Middleton <nik.middleton@noblesolutions.co.uk (nik.middleton@noblesolutions.co.uk)> wrote:
Quote:

Nope,

Still not working. Here's my little test javascript

var new_session = new Session('{ignore_early_media=true,}sofia/internal/1001@192.168.3.206 (1001@192.168.3.206)');

//set the on_hangup function to be called when this session is hungup
new_session.setHangupHook(on_hangup,"hup");

var on_hangup = function(hup_session, how) {
console_log("err","In hangup section\n");
//exit here would end the script so you could cleanup and just be done
exit();
}


if (new_session.ready()) {
new_session.answer( );
new_session.sleep(1500);
new_session.streamFile("female2.wav");
}

And this is the output

[NOTICE] sofia.c:3090 sofia_handle_sip_i_state() Hangup sofia/internal/sip:1001@192.168.0.29:5060 [CS_CONSUME_MEDIA] [USER_BUSY]
[ERR] switch_ivr_originate.c:1116 switch_ivr_originate() Cannot create outgoing channel of type [user] cause: [USER_BUSY]
[INFO] mod_dptools.c:1909 audio_bridge_function() Originate Failed. Cause: USER_BUSY
[NOTICE] switch_core_session.c:957 switch_core_session_thread() Session 95 (sofia/internal/sip:1001@192.168.0.29:5060) Ended
[NOTICE] switch_core_session.c:959 switch_core_session_thread() Close Channel sofia/internal/sip:1001@192.168.0.29:5060 [CS_HANGUP]
[NOTICE] mod_dptools.c:600 answer_function() Channel [sofia/internal/0000000000@192.168.3.206 (0000000000@192.168.3.206)] has been answered


From: freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org) [mailto:freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org)] On Behalf Of Anthony Minessale
Sent: 14 February 2009 17:20

To: freeswitch-users@lists.freeswitch.org (freeswitch-users@lists.freeswitch.org)
Subject: Re: [Freeswitch-users] Problems with Originate





are you running this as a dialplan app?
session is a reserved variable name for the session you executed the app on.

are you using an alternate name for your new session like my_session etc....?

this works for me, try it yourself.

var my_session = new Session("sofia/external/7003@conference.freeswitch.org (7003@conference.freeswitch.org)");
consoleLog("err", "ready: " + my_session.ready() + "\n");




On Sat, Feb 14, 2009 at 7:17 AM, Nik Middleton <nik.middleton@noblesolutions.co.uk (nik.middleton@noblesolutions.co.uk)> wrote:
Understood.

However, using the second method, how can I trap on call failure?

If I originate a call and the user is busy, the console reports this fact, but then the script continues to execute

if (session.ready()) {
console_log("notice","Session result=[" + session.cause + "] \n");
if (session.cause == "USER_BUSY") {
Disposition = "BUSY";
session.Hangup();
}
In this case session.cause reports 'NONE' and what's surprising is that even though the call failed (busy) session.ready returns a true value.

From: freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org) [mailto:freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org)] On Behalf Of Anthony Minessale
Sent: 13 February 2009 13:55

To: freeswitch-users@lists.freeswitch.org (freeswitch-users@lists.freeswitch.org)

Subject: Re: [Freeswitch-users] Problems with Originate


The first way is deprecated and will be removed.
The 2nd way is the correct way.
On Fri, Feb 13, 2009 at 5:48 AM, Alexandru Nedelcu <alex@sinapticode.ro (alex@sinapticode.ro)> wrote:
On Fri, 2009-02-13 at 13:33 +0200, Alexandru Nedelcu wrote:
Quote:
The problem with this setup is that origination_caller_id_number doesn't
work from inside the JS file (when calling session.originate).

I just discovered something interesting.

When originating the call like this ...
session = new Session("<connection_string>")
instead of this ...
session = new Session(); session.originate("<connection_string>")

... then it works. Is this some kind of bug, or what's the difference
here?

Thanks,

--
Alexandru Nedelcu
Software Developer, Sinapticode



_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (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 ([email]MSN%3Aanthony_minessale@hotmail.com[/email])
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com ([email]PAYPAL%3Aanthony.minessale@gmail.com[/email])
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org ([email]sip%3A888@conference.freeswitch.org[/email])
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org ([email]googletalk%3Aconf%2B888@conference.freeswitch.org[/email])
pstn:213-799-1400





_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (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 ([email]MSN%3Aanthony_minessale@hotmail.com[/email])
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com ([email]PAYPAL%3Aanthony.minessale@gmail.com[/email])
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org ([email]sip%3A888@conference.freeswitch.org[/email])
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org ([email]googletalk%3Aconf%2B888@conference.freeswitch.org[/email])
pstn:213-799-1400




_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (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 ([email]MSN%3Aanthony_minessale@hotmail.com[/email])
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com ([email]PAYPAL%3Aanthony.minessale@gmail.com[/email])
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org ([email]sip%3A888@conference.freeswitch.org[/email])
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org ([email]googletalk%3Aconf%2B888@conference.freeswitch.org[/email])
pstn:213-799-1400
Back to top
nik.middleton at noble...
Guest





PostPosted: Sun Feb 15, 2009 6:43 am    Post subject: [Freeswitch-users] Problems with Originate Reply with quote

You are indeed correct. I still had my asterisk hat on, and was expecting a hang-up event to be fired with the call outcome. I was explicitly testing for call failure. I’ve not modified the code to test the result of the originate and it works as expected.

I will add some words to the wiki explaining this for those converting from Asterisk

Regards,


From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Anthony Minessale
Sent: 14 February 2009 22:45
To: freeswitch-users@lists.freeswitch.org
Subject: Re: [Freeswitch-users] Problems with Originate



What do you suggest is not working?

the call failed and it *did not* run the code inside if (new_session.ready())
The call was never established therefore it would not run the hangup hook either.
In order to trigger the hangup hook the session would need to exist. If the session could not originate the new_session obj
is an empty shell with no actual session inside.

var new_session = new Session(<dial string>, <existing session>);
if (!new_session.ready()) {
// the call never was established.
}

I gave you real code to try in my last email that you completely ignored.....


and finally you are declaring the function wrong

declare it at the top.

function on_hangup(hup_session, how)
{
.....
}

I sense you seem to think things are going to magically transform into however you are thinking they should work
instead of you perhaps learning how they actually work.



On Sat, Feb 14, 2009 at 1:47 PM, Nik Middleton <nik.middleton@noblesolutions.co.uk (nik.middleton@noblesolutions.co.uk)> wrote:
Nope,

Still not working. Here's my little test javascript

var new_session = new Session('{ignore_early_media=true,}sofia/internal/1001@192.168.3.206 (1001@192.168.3.206)');

//set the on_hangup function to be called when this session is hungup
new_session.setHangupHook(on_hangup,"hup");

var on_hangup = function(hup_session, how) {
console_log("err","In hangup section\n");
//exit here would end the script so you could cleanup and just be done
exit();
}


if (new_session.ready()) {
new_session.answer( );
new_session.sleep(1500);
new_session.streamFile("female2.wav");
}

And this is the output

[NOTICE] sofia.c:3090 sofia_handle_sip_i_state() Hangup sofia/internal/sip:1001@192.168.0.29:5060 [CS_CONSUME_MEDIA] [USER_BUSY]
[ERR] switch_ivr_originate.c:1116 switch_ivr_originate() Cannot create outgoing channel of type [user] cause: [USER_BUSY]
[INFO] mod_dptools.c:1909 audio_bridge_function() Originate Failed. Cause: USER_BUSY
[NOTICE] switch_core_session.c:957 switch_core_session_thread() Session 95 (sofia/internal/sip:1001@192.168.0.29:5060) Ended
[NOTICE] switch_core_session.c:959 switch_core_session_thread() Close Channel sofia/internal/sip:1001@192.168.0.29:5060 [CS_HANGUP]
[NOTICE] mod_dptools.c:600 answer_function() Channel [sofia/internal/0000000000@192.168.3.206 (0000000000@192.168.3.206)] has been answered


From: freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org) [mailto:freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org)] On Behalf Of Anthony Minessale
Sent: 14 February 2009 17:20

To: freeswitch-users@lists.freeswitch.org (freeswitch-users@lists.freeswitch.org)
Subject: Re: [Freeswitch-users] Problems with Originate




are you running this as a dialplan app?
session is a reserved variable name for the session you executed the app on.

are you using an alternate name for your new session like my_session etc....?

this works for me, try it yourself.

var my_session = new Session("sofia/external/7003@conference.freeswitch.org (7003@conference.freeswitch.org)");
consoleLog("err", "ready: " + my_session.ready() + "\n");



On Sat, Feb 14, 2009 at 7:17 AM, Nik Middleton <nik.middleton@noblesolutions.co.uk (nik.middleton@noblesolutions.co.uk)> wrote:
Understood.

However, using the second method, how can I trap on call failure?

If I originate a call and the user is busy, the console reports this fact, but then the script continues to execute

if (session.ready()) {
console_log("notice","Session result=[" + session.cause + "] \n");
if (session.cause == "USER_BUSY") {
Disposition = "BUSY";
session.Hangup();
}
In this case session.cause reports 'NONE' and what's surprising is that even though the call failed (busy) session.ready returns a true value.

From: freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org) [mailto:freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org)] On Behalf Of Anthony Minessale
Sent: 13 February 2009 13:55

To: freeswitch-users@lists.freeswitch.org (freeswitch-users@lists.freeswitch.org)

Subject: Re: [Freeswitch-users] Problems with Originate


The first way is deprecated and will be removed.
The 2nd way is the correct way.
On Fri, Feb 13, 2009 at 5:48 AM, Alexandru Nedelcu <alex@sinapticode.ro (alex@sinapticode.ro)> wrote:
On Fri, 2009-02-13 at 13:33 +0200, Alexandru Nedelcu wrote:
Quote:
The problem with this setup is that origination_caller_id_number doesn't
work from inside the JS file (when calling session.originate).

I just discovered something interesting.

When originating the call like this ...
session = new Session("<connection_string>")
instead of this ...
session = new Session(); session.originate("<connection_string>")

... then it works. Is this some kind of bug, or what's the difference
here?

Thanks,

--
Alexandru Nedelcu
Software Developer, Sinapticode



_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (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 ([email]MSN%3Aanthony_minessale@hotmail.com[/email])
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com ([email]PAYPAL%3Aanthony.minessale@gmail.com[/email])
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org ([email]sip%3A888@conference.freeswitch.org[/email])
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org ([email]googletalk%3Aconf%2B888@conference.freeswitch.org[/email])
pstn:213-799-1400





_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (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 ([email]MSN%3Aanthony_minessale@hotmail.com[/email])
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com ([email]PAYPAL%3Aanthony.minessale@gmail.com[/email])
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org ([email]sip%3A888@conference.freeswitch.org[/email])
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org ([email]googletalk%3Aconf%2B888@conference.freeswitch.org[/email])
pstn:213-799-1400





_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (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 ([email]MSN%3Aanthony_minessale@hotmail.com[/email])
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com ([email]PAYPAL%3Aanthony.minessale@gmail.com[/email])
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org ([email]sip%3A888@conference.freeswitch.org[/email])
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org ([email]googletalk%3Aconf%2B888@conference.freeswitch.org[/email])
pstn:213-799-1400
Back to top
anthony.minessale at g...
Guest





PostPosted: Sun Feb 15, 2009 8:16 pm    Post subject: [Freeswitch-users] Problems with Originate Reply with quote

btw on the failed session you can still access the attribute session.cause and session.causecode to see why it failed to setup


On Sun, Feb 15, 2009 at 5:39 AM, Nik Middleton <nik.middleton@noblesolutions.co.uk (nik.middleton@noblesolutions.co.uk)> wrote:
Quote:

You are indeed correct. I still had my asterisk hat on, and was expecting a hang-up event to be fired with the call outcome. I was explicitly testing for call failure. I've not modified the code to test the result of the originate and it works as expected.

I will add some words to the wiki explaining this for those converting from Asterisk

Regards,


From: freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org) [mailto:freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org)] On Behalf Of Anthony Minessale
Sent: 14 February 2009 22:45
To: freeswitch-users@lists.freeswitch.org (freeswitch-users@lists.freeswitch.org)
Subject: Re: [Freeswitch-users] Problems with Originate



What do you suggest is not working?

the call failed and it *did not* run the code inside if (new_session.ready())
The call was never established therefore it would not run the hangup hook either.
In order to trigger the hangup hook the session would need to exist. If the session could not originate the new_session obj
is an empty shell with no actual session inside.

var new_session = new Session(<dial string>, <existing session>);
if (!new_session.ready()) {
// the call never was established.
}

I gave you real code to try in my last email that you completely ignored.....


and finally you are declaring the function wrong

declare it at the top.

function on_hangup(hup_session, how)
{
.....
}

I sense you seem to think things are going to magically transform into however you are thinking they should work
instead of you perhaps learning how they actually work.



On Sat, Feb 14, 2009 at 1:47 PM, Nik Middleton <nik.middleton@noblesolutions.co.uk (nik.middleton@noblesolutions.co.uk)> wrote:
Nope,

Still not working. Here's my little test javascript

var new_session = new Session('{ignore_early_media=true,}sofia/internal/1001@192.168.3.206 (1001@192.168.3.206)');

//set the on_hangup function to be called when this session is hungup
new_session.setHangupHook(on_hangup,"hup");

var on_hangup = function(hup_session, how) {
console_log("err","In hangup section\n");
//exit here would end the script so you could cleanup and just be done
exit();
}


if (new_session.ready()) {
new_session.answer( );
new_session.sleep(1500);
new_session.streamFile("female2.wav");
}

And this is the output

[NOTICE] sofia.c:3090 sofia_handle_sip_i_state() Hangup sofia/internal/sip:1001@192.168.0.29:5060 [CS_CONSUME_MEDIA] [USER_BUSY]
[ERR] switch_ivr_originate.c:1116 switch_ivr_originate() Cannot create outgoing channel of type [user] cause: [USER_BUSY]
[INFO] mod_dptools.c:1909 audio_bridge_function() Originate Failed. Cause: USER_BUSY
[NOTICE] switch_core_session.c:957 switch_core_session_thread() Session 95 (sofia/internal/sip:1001@192.168.0.29:5060) Ended
[NOTICE] switch_core_session.c:959 switch_core_session_thread() Close Channel sofia/internal/sip:1001@192.168.0.29:5060 [CS_HANGUP]
[NOTICE] mod_dptools.c:600 answer_function() Channel [sofia/internal/0000000000@192.168.3.206 (0000000000@192.168.3.206)] has been answered


From: freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org) [mailto:freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org)] On Behalf Of Anthony Minessale
Sent: 14 February 2009 17:20

To: freeswitch-users@lists.freeswitch.org (freeswitch-users@lists.freeswitch.org)
Subject: Re: [Freeswitch-users] Problems with Originate




are you running this as a dialplan app?
session is a reserved variable name for the session you executed the app on.

are you using an alternate name for your new session like my_session etc....?

this works for me, try it yourself.

var my_session = new Session("sofia/external/7003@conference.freeswitch.org (7003@conference.freeswitch.org)");
consoleLog("err", "ready: " + my_session.ready() + "\n");



On Sat, Feb 14, 2009 at 7:17 AM, Nik Middleton <nik.middleton@noblesolutions.co.uk (nik.middleton@noblesolutions.co.uk)> wrote:
Understood.

However, using the second method, how can I trap on call failure?

If I originate a call and the user is busy, the console reports this fact, but then the script continues to execute

if (session.ready()) {
console_log("notice","Session result=[" + session.cause + "] \n");
if (session.cause == "USER_BUSY") {
Disposition = "BUSY";
session.Hangup();
}
In this case session.cause reports 'NONE' and what's surprising is that even though the call failed (busy) session.ready returns a true value.

From: freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org) [mailto:freeswitch-users-bounces@lists.freeswitch.org (freeswitch-users-bounces@lists.freeswitch.org)] On Behalf Of Anthony Minessale
Sent: 13 February 2009 13:55

To: freeswitch-users@lists.freeswitch.org (freeswitch-users@lists.freeswitch.org)

Subject: Re: [Freeswitch-users] Problems with Originate


The first way is deprecated and will be removed.
The 2nd way is the correct way.
On Fri, Feb 13, 2009 at 5:48 AM, Alexandru Nedelcu <alex@sinapticode.ro (alex@sinapticode.ro)> wrote:
On Fri, 2009-02-13 at 13:33 +0200, Alexandru Nedelcu wrote:
Quote:
The problem with this setup is that origination_caller_id_number doesn't
work from inside the JS file (when calling session.originate).

I just discovered something interesting.

When originating the call like this ...
session = new Session("<connection_string>")
instead of this ...
session = new Session(); session.originate("<connection_string>")

... then it works. Is this some kind of bug, or what's the difference
here?

Thanks,

--
Alexandru Nedelcu
Software Developer, Sinapticode



_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (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 ([email]MSN%3Aanthony_minessale@hotmail.com[/email])
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com ([email]PAYPAL%3Aanthony.minessale@gmail.com[/email])
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org ([email]sip%3A888@conference.freeswitch.org[/email])
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org ([email]googletalk%3Aconf%2B888@conference.freeswitch.org[/email])
pstn:213-799-1400





_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (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 ([email]MSN%3Aanthony_minessale@hotmail.com[/email])
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com ([email]PAYPAL%3Aanthony.minessale@gmail.com[/email])
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org ([email]sip%3A888@conference.freeswitch.org[/email])
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org ([email]googletalk%3Aconf%2B888@conference.freeswitch.org[/email])
pstn:213-799-1400





_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (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 ([email]MSN%3Aanthony_minessale@hotmail.com[/email])
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com ([email]PAYPAL%3Aanthony.minessale@gmail.com[/email])
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org ([email]sip%3A888@conference.freeswitch.org[/email])
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org ([email]googletalk%3Aconf%2B888@conference.freeswitch.org[/email])
pstn:213-799-1400


_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (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 ([email]MSN%3Aanthony_minessale@hotmail.com[/email])
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com ([email]PAYPAL%3Aanthony.minessale@gmail.com[/email])
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org ([email]sip%3A888@conference.freeswitch.org[/email])
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org ([email]googletalk%3Aconf%2B888@conference.freeswitch.org[/email])
pstn:213-799-1400
Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services